Display all orderrs in the delivery summary page

This commit is contained in:
Alexis M 2019-07-20 01:00:52 +02:00
parent 23623d3563
commit 49b16a761f
2 changed files with 55 additions and 1 deletions

View file

@ -5,7 +5,7 @@
{% include "includes/delivery_head.html" %}
<article class="delivery">
{% if delivery.has_products %}
{% include "includes/delivery_list.html" %}
{% include "includes/delivery_table.html" %}
{% else %}
<p>Aucun produit n'est encore défini pour cette livraison.</p>
{% if request.user and request.user.is_staff %}

View file

@ -0,0 +1,54 @@
{% for producer in delivery.producers %}
<h2>{{ producer }}</h2>
<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 %}
<th class="amount">Total</th>
{% for email, order in delivery.orders.items() %}
<th class="person{% if delivery.is_passed and not order.paid %} not-paid{% endif %}">
{% if request.user and request.user.is_staff %}
<a href="/livraison/{{ delivery.id }}/commander?email={{ email }}" title="{{ email }}">{{ email }}</a>
{% else %}
<span title="{{ email }}">{{ email }}</span>
{% endif %}
</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for product in delivery.get_products_by(producer) %}
<tr>
<th class="product">{{ product }}</th>
<td>{{ product.price | round(2) }} €</td>
{% if delivery.has_packing %}
<td class="packing">{{ product.packing or '—'}}</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>
{% 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 %}
</tr>
{% endfor %}
<tr>
<th class="total"><i class="icon-pricetags"></i> Total</th><td></td>
{% if delivery.has_packing %}
<td></td>
{% endif %}
<th class="total">{{ delivery.total_for_producer(producer) }} €</th>
{% for email, order in delivery.orders.items() %}
<td>{{ order.total(delivery.get_products_by(producer)) }} €</td>
{% endfor %}
</tr>
</tbody>
</table>
{% endfor %}