Display product weigth when available

This commit is contained in:
Yohan Boniface 2019-04-02 09:56:29 +02:00
parent 1a0bda56b0
commit d8e9e6f714
4 changed files with 16 additions and 4 deletions

View file

@ -97,6 +97,13 @@ class Product(Base):
url: str = "" url: str = ""
img: str = "" img: str = ""
@property
def label(self):
out = self.name
if self.weight:
out += f" ({self.weight})"
return out
@dataclass @dataclass
class ProductOrder(Base): class ProductOrder(Base):

View file

@ -317,8 +317,13 @@ th.price {
th.amount { th.amount {
width: 5rem; width: 5rem;
} }
th.ref { .ref {
width: 5rem; width: 5rem;
text-align: left;
}
td.ref {
font-weight: 300;
font-style: normal;
} }
td.total, td.total,
th.total { th.total {

View file

@ -23,8 +23,8 @@
</tr> </tr>
{% for product in delivery.products %} {% for product in delivery.products %}
<tr> <tr>
<th class="product">{{ product.ref }}</th> <td class="ref">{{ product.ref }}</td>
<th class="product">{{ product.name }}</th> <th class="product">{{ product.label }}</th>
<td>{{ product.price }} €</td> <td>{{ product.price }} €</td>
<th>{{ delivery.product_wanted(product) }}</th> <th>{{ delivery.product_wanted(product) }}</th>
{% for email, order in delivery.orders.items() %} {% for email, order in delivery.orders.items() %}

View file

@ -9,7 +9,7 @@
<tr><th class="product">Produit</th><th class="price">Prix</th><th class="amount">Quantité</th></tr> <tr><th class="product">Produit</th><th class="price">Prix</th><th class="amount">Quantité</th></tr>
{% for product in delivery.products %} {% for product in delivery.products %}
<tr> <tr>
<th class="product">{{ product.name }} <th class="product">{{ product.label }}
{% if product.description or product.img %} {% if product.description or product.img %}
{% with unique_id=loop.index %} {% with unique_id=loop.index %}
{% include "includes/modal_product.html" %} {% include "includes/modal_product.html" %}