mirror of
https://framagit.org/la-chariotte/la-chariotte.git
synced 2025-05-01 11:22:24 +02:00
fixes after rebase
This commit is contained in:
parent
ef00d0b367
commit
bc83967330
4 changed files with 17 additions and 12 deletions
|
@ -58,7 +58,7 @@
|
|||
<form method="post" action="{% url 'order:order' grouped_order.id %}">
|
||||
|
||||
<!-- Tableau de commandes - sur ordi -->
|
||||
<table class="table is-hidden-mobile">
|
||||
<table class="table is-hidden-touch">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Produit</th>
|
||||
|
@ -74,7 +74,7 @@
|
|||
<td>{{ item.price }} €</td>
|
||||
<td><input name="quantity_{{ item.id }}" size="2" type="number" value="0" min="0" {% if item.get_remaining_nb == 0 %}disabled{% endif %}></input>
|
||||
{% if item.get_remaining_nb is not null %}
|
||||
<span class="is-italic">
|
||||
<span class="is-italic mini-title">
|
||||
{% if item.get_remaining_nb == 0 %}Produit épuisé
|
||||
{% else %}
|
||||
{{ item.get_remaining_nb }} {% if item.get_remaining_nb == 1 %}disponible{% else %}disponibles{% endif %}</span>
|
||||
|
@ -97,8 +97,13 @@
|
|||
<p>{{ item.price }} €</p>
|
||||
</div>
|
||||
<div class="card-footer-item">
|
||||
<input name="quantity_{{ item.id }}" size="2" type="number" value="0" min="0"></input>
|
||||
{% if item.get_remaining_nb %}<span class="is-italic mini-title"> {{ item.get_remaining_nb }} {% if item.get_remaining_nb == 1 %}disponible{% else %}disponibles{% endif %}</span>{% endif %}
|
||||
<td><input name="quantity_{{ item.id }}" size="2" type="number" value="0" min="0" {% if item.get_remaining_nb == 0 %}disabled{% endif %}></input></td>
|
||||
{% if item.get_remaining_nb is not null %}
|
||||
<span class="is-italic mini-title">
|
||||
{% if item.get_remaining_nb == 0 %}Produit épuisé
|
||||
{% else %}
|
||||
{{ item.get_remaining_nb }} {% if item.get_remaining_nb == 1 %}disponible{% else %}disponibles{% endif %}</span>
|
||||
{% endif %}{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
</tfoot>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>Vous n'avez pas ajouté de produits à cette commande groupée. Ajoutez-en <a href="{% url 'order:manage_items' %}">ici</a></p>
|
||||
<p>Vous n'avez pas ajouté de produits à cette commande groupée. Ajoutez-en <a href="{% url 'order:manage_items' grouped_order.pk %}">ici</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -434,7 +434,7 @@ class TestGroupedOrderDetailView:
|
|||
response = client.post(
|
||||
order_url,
|
||||
{
|
||||
f"quantity_{item.pk}": 2,
|
||||
f"quantity_{item.pk}": [2, 0],
|
||||
"first_name": "Prénom",
|
||||
"last_name": "Nom",
|
||||
"phone": "0645632569",
|
||||
|
@ -480,7 +480,7 @@ class TestGroupedOrderDetailView:
|
|||
response = client.post(
|
||||
order_url,
|
||||
{
|
||||
f"quantity_{item.pk}": 1,
|
||||
f"quantity_{item.pk}": [0, 1],
|
||||
"first_name": "Prénom",
|
||||
"last_name": "Nom",
|
||||
"phone": "0645632569",
|
||||
|
@ -526,7 +526,7 @@ class TestGroupedOrderDetailView:
|
|||
response = client.post(
|
||||
order_url,
|
||||
{
|
||||
f"quantity_{item.pk}": 2,
|
||||
f"quantity_{item.pk}": [2, 0],
|
||||
"first_name": "Prénom",
|
||||
"last_name": "Nom",
|
||||
"phone": "0645632569",
|
||||
|
@ -537,7 +537,7 @@ class TestGroupedOrderDetailView:
|
|||
response = client.post(
|
||||
order_url,
|
||||
{
|
||||
f"quantity_{item.pk}": 1,
|
||||
f"quantity_{item.pk}": [1, 0],
|
||||
"first_name": "Prénom",
|
||||
"last_name": "Nom",
|
||||
"phone": "0645632569",
|
||||
|
@ -590,8 +590,8 @@ class TestGroupedOrderDetailView:
|
|||
response = client.post(
|
||||
order_url,
|
||||
{
|
||||
f"quantity_{item.pk}": 4,
|
||||
f"quantity_{item2.pk}": 0,
|
||||
f"quantity_{item.pk}": [4, 0],
|
||||
f"quantity_{item2.pk}": [0, 0],
|
||||
"first_name": "Prénom",
|
||||
"last_name": "Nom",
|
||||
"phone": "0645632569",
|
||||
|
|
|
@ -255,7 +255,7 @@ def order(request, grouped_order_id):
|
|||
|
||||
def validate_item_ordered_nb(item, ordered_nb):
|
||||
"""Returns an error message if the ordered items are not available"""
|
||||
if item.get_remaining_nb() and item.get_remaining_nb() - ordered_nb < 0:
|
||||
if item.get_remaining_nb() is not None and item.get_remaining_nb() - ordered_nb < 0:
|
||||
return f"Trop de {item.name} commandés pour la quantité disponible"
|
||||
return None
|
||||
|
||||
|
|
Loading…
Reference in a new issue