copanier/copanier/templates/includes/delivery_table.html

83 lines
No EOL
4.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% if not producers and referent %}
{% set producers = delivery.get_producers_for_referent(referent) %}
{% elif not producers %}
{% set producers = delivery.producers %}
{% endif %}
{% for producer in producers %}
{% set producer_obj = delivery.producers[producer] %}
<h2>{{ producer }}
{% if edit_mode or request.user.is_staff or producer_obj.referent == request.user.email %}
<span class="edit">
<a class="button" href="/livraison/{{ delivery.id }}/{{ producer }}/éditer"><i class="icon-ribbon"></i>&nbsp; Éditer</a>
<a class="button" href="/livraison/{{ delivery.id }}/{{ producer }}/ajouter-produit"><i class="icon-puzzle"></i>&nbsp; Ajouter un produit </a>
{% if delivery.can_generate_reports %}
<a class="button" href="/livraison/{{ delivery.id }}/{{ producer }}/bon-de-commande.pdf"><i class="icon-grid"></i>&nbsp; Télécharger le bon de commande</a>
{% endif %}
</span>
{% endif %}
</h2>
<h5>{% if producer_obj.description %}{{ producer_obj.description }}{% endif %}. Référent⋅e : <a href="mailto:{{ producer_obj.referent }}">{{ producer_obj.referent_name }}</a> / {{ producer_obj.referent_tel }}</h5>
<table class="delivery">
<thead>
<tr>
<th class="product">Produit</th>
<th class="price">Prix</th>
{% if delivery.has_packing %}
<th class="packing">Conditionnement</th>
{% endif %}
{% if edit_mode %}<th>Éditer</th>{% endif %}
<th class="amount">Total</th>
{% if not list_only %}
{% for orderer, order in delivery.orders.items() %}
{% set orderer_name = request.groups.groups[orderer].name %}
<th class="person">
{% if request.user and (request.user.is_staff or request.user.is_referent(delivery)) %}
<a href="/livraison/{{ delivery.id }}/commander?orderer={{ orderer }}" title="{{ orderer }}">{{ orderer_name }}</a>
{% else %}
<span title="{{ orderer }}">{{ orderer_name }}</span>
{% endif %}
</th>
{% endfor %}
{% endif %}
</tr>
</thead>
<tbody>
{% for product in delivery.get_products_by(producer) %}
<tr>
<th class="product {% if product.rupture %}rupture{% endif %}">{% if edit_mode %}<a href="/livraison/{{ delivery.id }}/{{ product.producer }}/{{ product.ref }}/éditer">{% endif %}{{ product }}{% if edit_mode %}</a>{% endif %}{% if product.rupture %} {{ product.rupture }}{% endif %}
<td>{{ product.price | round(2) }} €</td>
{% if delivery.has_packing %}
<td class="packing">{% if product.packing %}{{ product.packing }} x {% endif %} {{ product.unit }}</td>
{% endif %}
{% if edit_mode %}<td><a href="/livraison/{{ delivery.id }}/{{ product.producer }}/{{ product.ref }}/éditer">modifier</a></td>{% endif %}
<th{% if delivery.status == delivery.ADJUSTMENT and delivery.product_missing(product) %} class="missing" title="Les commandes individuelles ne correspondent pas aux conditionnements"{% endif %}>
{{ delivery.product_wanted(product) }}
{% if delivery.status == delivery.ADJUSTMENT and delivery.product_missing(product) %} ({{ delivery.product_missing(product) }})
{% if request.user.is_staff %}<a href="/livraison/{{ delivery.id }}/ajuster/{{ product.ref }}" class="button" title="ajuster le produit">ajuster</a>{% endif %}
{% endif %}
</th>
{% if not list_only %}
{% for email, order in delivery.orders.items() %}
<td title="Commandé: {{ order[product.ref].wanted }} — Ajusté: {{ "%+d"|format(order[product.ref].adjustment) }}">{{ order[product.ref].quantity or "—" }}</td>
{% endfor %}
{% endif %}
</tr>
{% endfor %}
<tr>
<th class="total"><i class="icon-pricetags"></i> Total</th><td></td>
{% if delivery.has_packing %}
<td></td>
{% endif %}
{% if edit_mode %}
<td></td>
{% endif %}
<th class="total">{{ delivery.total_for_producer(producer) }} €</th>
{% if not list_only %}
{% for email, order in delivery.orders.items() %}
<td>{{ order.total(delivery.get_products_by(producer)) }} €</td>
{% endfor %}
{% endif %}
</tr>
</tbody>
</table>
{% endfor %}