copanier/copanier/templates/delivery/place_order.html
2021-10-10 21:46:18 +02:00

71 lines
4.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% block body %}
{% set group_name = request.groups.groups.get(person.name, person).name %}
<div class="header">
<h1>{{ delivery.name }}</h1>
<h4>Commande pour {{ group_name }}
{% if order.phone_number %}
(<a href="tel:{{ order.phone_number }}">{{ order.phone_number }}</a>)
{% endif %}
</h4>
{% include "includes/delivery_head.html" %}
</div>
<form method="post">
{% for producer in delivery.producers.values() %}
{% if producer.has_active_products(delivery) %}
<h2>{{ producer.name }}</h2>
<table class="order pure-table">
<thead>
<tr>
<th class="product">Produit</th>
<th class="price">Prix</th>
{% if producer.has_packing %}
<th class="packing">Conditionnement</th>
{% endif %}
<th class="amount">Commande</th>
{% if delivery.status == delivery.ADJUSTMENT or force_adjustment %}
<th class="amount">Ajustement +/</th>
{% endif %}
</tr>
</thead>
<tbody>
{% for product in delivery.get_products_by(producer.id) %}
{% if not product.rupture %}
<tr>
<th class="product {% if product.rupture %}rupture{% endif %}"><div {% if product.description %}title="{{ product.description }}"{% endif %}>{{ product }} {% if product.rupture %}(RUPTURE !){% endif %}</div>
{% if product.description and product.description | length > 30 %}
<small title="{{ product.description }}">+ d'infos…</small>
{% else %}
<small title="{{ product.description }}">{{ product.description }}</small>
{% endif %}
</th>
<td>{{ product.price | round(2) }} €</td>
{% if producer.has_packing %}
<td {% if delivery.status == delivery.ADJUSTMENT and delivery.product_missing(product) %} class="missing" title="Les commandes individuelles ne correspondent pas aux conditionnements"{% endif %}>{{ product.packing or "—" }}{% if delivery.status == delivery.ADJUSTMENT and delivery.product_missing(product) %} (manque {{ delivery.product_missing(product) }}){% endif %}</td>
{% endif %}
<td class="with-input"><input {% if not request.user.is_referent(delivery) and delivery.status != delivery.OPEN or product.rupture %}type="text" readonly{% else%}type="number"{% endif%} min=0 name="wanted:{{ product.ref }}" value="{{ order[product].wanted }}"><br />{% if not (delivery.status == delivery.ADJUSTMENT or force_adjustments) %}<div class="product_unit"> x {{ product.unit }}</div>{% endif %}</td>
{% if delivery.status == delivery.ADJUSTMENT or force_adjustments %}
<td class="with-input"><input type="number" name="adjustment:{{ product.ref }}" value="{{ order[product].adjustment }}" min="{{ order[product].wanted * -1 }}" {% if not (delivery.product_missing(product) or force_adjustment) %}readonly{% endif %}> x {{ product.unit }}</td>
{% endif %}
</tr>
{%- endif %}
{% endfor %}
</tbody>
</table>
{%- endif %}
{% endfor %}
<p>On y est presque ! Est-ce que tu peux entrer un numéro de téléphone au cas où on ait besoin de vous joindre ?</p>
<input pattern="((\+|00)?[0-9]{2}|0)[1-9]( ?[0-9]){8}" id="phone" type="text" onInput="prettifyPhoneNumber('phone')" name="phone_number" value="{{ order.phone_number }}" placeholder="Ton numéro de téléphone" required>
<input type="hidden" name="email" value="{{ person.email }}">
{% if delivery.status != delivery.CLOSED or request.user.is_staff %}
<input type="submit" value="Enregistrer la commande" class="primary">
{% endif %}
{% if request.user.is_staff and delivery.status == delivery.CLOSED %}
<a class="button danger" href="{{ url_for('place_order', id=delivery.id) }}?email={{ person.email }}&adjust">Ajuster</a>
{% endif %}
</form>
</article>
{% endblock body %}