mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 19:42:37 +02:00
Attach phone numbers to orders.
This commit is contained in:
parent
ae3e1e2888
commit
48a6aa9f9a
4 changed files with 16 additions and 6 deletions
|
@ -14,13 +14,13 @@ The main differences are :
|
||||||
- Support for multiple producers (and persons to handle these producers)
|
- Support for multiple producers (and persons to handle these producers)
|
||||||
- A concept of groups was added : multiple persons can belong to the same group (and create / edit orders).
|
- A concept of groups was added : multiple persons can belong to the same group (and create / edit orders).
|
||||||
- A minimal interface to add / remove / update products from the website.
|
- A minimal interface to add / remove / update products from the website.
|
||||||
- Support for out of stock products.
|
- Support out of stock products
|
||||||
- Automatically compute a settlement plan (using the [debts library](https://framagit.org/almet/debts))
|
- Automatically compute a settlement plan (using the [debts library](https://framagit.org/almet/debts))
|
||||||
- Remove paiement tracking (as it conflicts with auto-settlement of debts)
|
- Remove paiement tracking (as it conflicts with auto-settlement of debts)
|
||||||
- A special page with tools to ease delivery management
|
- Add a page with tools to ease delivery management
|
||||||
- Drop support for CSV files
|
- Drop support for CSV files
|
||||||
- Send emails to producers referents, with an order summary
|
- Send emails to producers referents, with an order summary
|
||||||
- Generation of PDF files rather than XLS files (for order summary, signing sheet and paiements repartition)
|
- Generate PDF files rather than XLS files (for order summary, signing sheet and paiements repartition)
|
||||||
|
|
||||||
## Philosophy
|
## Philosophy
|
||||||
|
|
||||||
|
|
|
@ -602,7 +602,7 @@ async def place_order(request, response, id):
|
||||||
return
|
return
|
||||||
|
|
||||||
form = request.form
|
form = request.form
|
||||||
order = Order()
|
order = Order(phone_number=form.get('phone_number', ''))
|
||||||
for product in delivery.products:
|
for product in delivery.products:
|
||||||
try:
|
try:
|
||||||
wanted = form.int(f"wanted:{product.ref}", 0)
|
wanted = form.int(f"wanted:{product.ref}", 0)
|
||||||
|
|
|
@ -221,6 +221,7 @@ class ProductOrder(Base):
|
||||||
@dataclass
|
@dataclass
|
||||||
class Order(Base):
|
class Order(Base):
|
||||||
products: Dict[str, ProductOrder] = field(default_factory=dict)
|
products: Dict[str, ProductOrder] = field(default_factory=dict)
|
||||||
|
phone_number : str = ""
|
||||||
|
|
||||||
def __getitem__(self, ref):
|
def __getitem__(self, ref):
|
||||||
if isinstance(ref, Product):
|
if isinstance(ref, Product):
|
||||||
|
|
|
@ -1,11 +1,18 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
|
{% set group_name = request.groups.groups[person.name].name %}
|
||||||
<article class="order">
|
<article class="order">
|
||||||
<h3><a href="/livraison/{{ delivery.id }}">{{ delivery.name }}</a> — Commande pour « {{ person.name }} »</h3>
|
<h3>
|
||||||
|
<a href="/livraison/{{ delivery.id }}">{{ delivery.name }}</a>
|
||||||
|
— Commande pour {{ group_name }}
|
||||||
|
{% if order.phone_number %}
|
||||||
|
(<a href="tel:{{ order.phone_number }}">{{ order.phone_number }}</a>)
|
||||||
|
{% endif %}</p>
|
||||||
|
</h3>
|
||||||
{% include "includes/delivery_head.html" %}
|
{% include "includes/delivery_head.html" %}
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
{% for producer in delivery.producers %}
|
{% for producer in delivery.producers %}
|
||||||
<h2>{{ producer }}</h2>
|
<h2>{{ producer }}</h2>
|
||||||
<table class="order">
|
<table class="order">
|
||||||
|
@ -45,6 +52,8 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
{% endfor %}
|
{% 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 type="text" name="phone_number" value="{{ order.phone_number }}" placeholder="06 12 34 56 78">
|
||||||
<p>Total: {{ order.total(delivery.products) if order else 0 }} €</p>
|
<p>Total: {{ order.total(delivery.products) if order else 0 }} €</p>
|
||||||
<input type="hidden" name="email" value="{{ person.email }}">
|
<input type="hidden" name="email" value="{{ person.email }}">
|
||||||
{% if delivery.status != delivery.CLOSED or request.user.is_staff %}
|
{% if delivery.status != delivery.CLOSED or request.user.is_staff %}
|
||||||
|
|
Loading…
Reference in a new issue