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 = ""
img: str = ""
@property
def label(self):
out = self.name
if self.weight:
out += f" ({self.weight})"
return out
@dataclass
class ProductOrder(Base):

View file

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

View file

@ -23,8 +23,8 @@
</tr>
{% for product in delivery.products %}
<tr>
<th class="product">{{ product.ref }}</th>
<th class="product">{{ product.name }}</th>
<td class="ref">{{ product.ref }}</td>
<th class="product">{{ product.label }}</th>
<td>{{ product.price }} €</td>
<th>{{ delivery.product_wanted(product) }}</th>
{% 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>
{% for product in delivery.products %}
<tr>
<th class="product">{{ product.name }}
<th class="product">{{ product.label }}
{% if product.description or product.img %}
{% with unique_id=loop.index %}
{% include "includes/modal_product.html" %}