From 23623d35630cbe6ac51af24bfe278f4bfa24c81a Mon Sep 17 00:00:00 2001 From: Alexis M Date: Fri, 19 Jul 2019 01:58:06 +0200 Subject: [PATCH] Split orders by producer to ease the reading --- copanier/models.py | 4 ++-- copanier/templates/delivery.html | 4 ++-- copanier/templates/place_order.html | 16 +++++++--------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/copanier/models.py b/copanier/models.py index 77910e8..9769201 100644 --- a/copanier/models.py +++ b/copanier/models.py @@ -163,8 +163,8 @@ class Product(Base): def __str__(self): out = self.name - if self.unit: - out += f" ({self.unit})" + # if self.unit: + # out += f" ({self.unit})" return out diff --git a/copanier/templates/delivery.html b/copanier/templates/delivery.html index f59ec52..89d8b4d 100644 --- a/copanier/templates/delivery.html +++ b/copanier/templates/delivery.html @@ -5,9 +5,9 @@ {% include "includes/delivery_head.html" %}
{% if delivery.has_products %} - {% include "includes/delivery_table.html" %} + {% include "includes/delivery_list.html" %} {% else %} -

Mince, aucun produit n'est encore défini pour cette livraison !

+

Aucun produit n'est encore défini pour cette livraison.

{% if request.user and request.user.is_staff %}
Pour rajouter des produits, il faut d'abord télécharger le tableur avec les produits, le modifier localement sur votre machine puis  
{% with unique_id="import-products" %}{% include "includes/modal_import_products.html" %}{% endwith %}.
{% endif %} diff --git a/copanier/templates/place_order.html b/copanier/templates/place_order.html index 2ce1931..994fa87 100644 --- a/copanier/templates/place_order.html +++ b/copanier/templates/place_order.html @@ -2,15 +2,15 @@ {% block body %}
-

{{ delivery.name }} — Commande de « {{ person.email }} »

+

{{ delivery.name }} — Commande pour « {{ person.email }} »

{% include "includes/delivery_head.html" %}
+ + {% for producer in delivery.producers %} +

{{ producer }}

- {% if delivery.has_multiple_producers %} - - {% endif %} {% if delivery.has_packing %} @@ -23,11 +23,8 @@ - {% for product in delivery.products %} + {% for product in delivery.get_products_by(producer) %} - {% if delivery.has_multiple_producers and (loop.first or loop.previtem.producer != product.producer) %} - - {% endif %} {% endif %} - + {% if delivery.status == delivery.ADJUSTMENT or order.has_adjustments %} {% endif %} @@ -47,6 +44,7 @@ {% endfor %}
ProducteurProduit Prix
{{ product.producer }}{{ product }} {% if product.description or product.img %} {% with unique_id=loop.index %} @@ -39,7 +36,7 @@ {% if delivery.has_packing %} {{ product.packing or "—" }}{% if delivery.status == delivery.ADJUSTMENT and delivery.product_missing(product) %} (−{{ delivery.product_missing(product) }}){% endif %} x {{ product.unit }}
+ {% endfor %}

Total: {{ order.total(delivery.products) if order else 0 }} €

{% if delivery.is_passed %}

Commande soldée: