gestioCOF/kfet/templates/kfet/article.html
2018-04-07 14:21:07 +02:00

128 lines
4.1 KiB
HTML

{% extends 'kfet/base_col_2.html' %}
{% block title %}Articles{% endblock %}
{% block header-title %}Articles{% endblock %}
{% block fixed %}
<aside>
<div class="heading">
{{ nb_articles }}
<span class="sub">article{{ nb_articles|pluralize }}</span>
</div>
<div class="heading">
<span class="sub">dont {{ articles|length }} en vente</span>
</div>
</aside>
<div class="buttons">
<a class="btn btn-primary" href="{% url 'kfet.article.create' %}">
<span class="glyphicon glyphicon-plus"></span>
<span>Nouvel article</span>
</a>
<a class="btn btn-primary" href="{% url 'kfet.category' %}">
Catégories
</a>
</div>
{% endblock %}
{% block main %}
<h2>Article{{ articles|length|pluralize}} en vente</h2>
<div class="table-responsive">
<table
class="table table-hover table-condensed sortable"
{# Initial sort: [(is_sold,desc), (name,asc)] #}
data-sortlist="[[3,1], [0,0]]">
<thead>
<tr>
<td>Nom</td>
<td class="text-right">Prix</td>
<td class="text-right">Stock</td>
<td class="text-right" data-sorter="article__is_sold">En vente</td>
<td class="text-right" data-sorter="article__hidden">Affiché</td>
<td class="text-right" data-sorter="shortDate">Dernier inventaire</td>
</tr>
</thead>
{% regroup articles by category as category_list %}
{% for category in category_list %}
<tbody class="tablesorter-no-sort">
<tr class="section">
<td colspan="6">{{ category.grouper }}</td>
</tr>
</tbody>
<tbody>
{% for article in category.list %}
<tr>
<td>
<a href="{% url 'kfet.article.read' article.pk %}">
{{ article.name }}
</a>
</td>
<td class="text-right">{{ article.price }}€</td>
<td class="text-right">{{ article.stock }}</td>
<td class="text-right">{{ article.is_sold | yesno:"En vente,Non vendu"}}</td>
<td class="text-right">{{ article.hidden | yesno:"Caché,Affiché" }}</td>
{% with last_inventory=article.inventory.0 %}
<td class="text-right" title="{{ last_inventory.at }}">
{{ last_inventory.at|date:'d/m/Y H:i' }}
</td>
{% endwith %}
</tr>
{% endfor %}
</tbody>
{% endfor %}
</table>
</div>
<h2>Article{{ not_sold_articles|length|pluralize }} non vendu{{ nots_sold_article|length|pluralize }}</h2>
<div class="table-responsive">
<table
class="table table-hover table-condensed sortable"
{# Initial sort: [(is_sold,desc), (name,asc)] #}
data-sortlist="[[3,1], [0,0]]">
<thead>
<tr>
<td>Nom</td>
<td class="text-right">Prix</td>
<td class="text-right">Stock</td>
<td class="text-right" data-sorter="article__is_sold">En vente</td>
<td class="text-right" data-sorter="article__hidden">Affiché</td>
<td class="text-right" data-sorter="shortDate">Dernier inventaire</td>
</tr>
</thead>
{% regroup not_sold_articles by category as not_sold_category_list %}
{% for category in not_sold_category_list %}
<tbody class="tablesorter-no-sort">
<tr class="section">
<td colspan="6">{{ category.grouper }}</td>
</tr>
</tbody>
<tbody>
{% for article in category.list %}
<tr>
<td>
<a href="{% url 'kfet.article.read' article.pk %}">
{{ article.name }}
</a>
</td>
<td class="text-right">{{ article.price }}€</td>
<td class="text-right">{{ article.stock }}</td>
<td class="text-right">{{ article.is_sold | yesno:"En vente,Non vendu"}}</td>
<td class="text-right">{{ article.hidden | yesno:"Caché,Affiché" }}</td>
{% with last_inventory=article.inventory.0 %}
<td class="text-right" title="{{ last_inventory.at }}">
{{ last_inventory.at|date:'d/m/Y H:i' }}
</td>
{% endwith %}
</tr>
{% endfor %}
</tbody>
{% endfor %}
</table>
</div>
</div>
{% endblock %}