diff --git a/copanier/models.py b/copanier/models.py index bd4bdaf..ceb6b96 100644 --- a/copanier/models.py +++ b/copanier/models.py @@ -319,6 +319,7 @@ class Delivery(PersistedBase): OPEN = 2 ADJUSTMENT = 3 WAITING_PRODUCTS = 4 + OVER = 5 name: str from_date: datetime_field @@ -332,6 +333,7 @@ class Delivery(PersistedBase): producers: Dict[str, Producer] = field(default_factory=dict) orders: Dict[str, Order] = field(default_factory=dict) shipping: Dict[str, price_field] = field(default_factory=dict) + over: bool = False def __post_init__(self): self.id = None # Not a field because we don't want to persist it. @@ -339,6 +341,8 @@ class Delivery(PersistedBase): @property def status(self): + if self.over: + return self.OVER if not self.products: return self.EMPTY if self.products_need_price_update(): diff --git a/copanier/static/app.css b/copanier/static/app.css index bfa6ae7..41985a2 100644 --- a/copanier/static/app.css +++ b/copanier/static/app.css @@ -788,4 +788,12 @@ small { #instructions { height: 100px; +} + +.important-message { + padding: 1em; + text-align: center; + + background-color: rgba(233, 161, 28, 0.2); + border: 2px black dashed; } \ No newline at end of file diff --git a/copanier/templates/delivery/show_delivery.html b/copanier/templates/delivery/show_delivery.html index ab6b2bf..0a3c0e7 100644 --- a/copanier/templates/delivery/show_delivery.html +++ b/copanier/templates/delivery/show_delivery.html @@ -2,6 +2,11 @@ {% block is_wide %}{% endblock %} {% block body %} +{% if delivery.status == delivery.CLOSED %} +
Une fois la distribution terminée, reviens ici pour passer le relai !
+{% endif %} + +

{{ delivery.name }}

{% include "includes/delivery_progress.html" %} @@ -48,8 +53,6 @@
Tu es la personne contact pour l'organisation de cette distribution, merci :-) Pour t'aider, tu peux accéder à  la boîte à outils ! - -{% if delivery.status == delivery.CLOSED %}

La distribution est maintenant terminée. C'est le moment de passer le relai, merci !

{% endif %}
{% endif %} {% if delivery.has_products %} diff --git a/copanier/templates/delivery/show_toolbox.html b/copanier/templates/delivery/show_toolbox.html index fe7ce26..81eadae 100644 --- a/copanier/templates/delivery/show_toolbox.html +++ b/copanier/templates/delivery/show_toolbox.html @@ -12,57 +12,7 @@ {% include "includes/delivery_head.html" %}

Rappel des dates

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quoi ?DatesCoordinatrice⋅eurRéférent⋅e⋅s produits
Création de la distribution{{ delivery.dates.creation_date | date}}Rappeler aux référent⋅e⋅s produit de mettre leurs prix à jour, vérifier que tous les producteurs⋅rices sont bien présentes, en ajouter si besoin-
Mise à jour des prixDu {{ delivery.dates.price_update_start | date }} au {{ delivery.dates.price_update_deadline | date}}Les référent⋅e⋅s produit mettent les prix à jour.
Commandes - Du {{ delivery.dates.price_update_deadline | date }} au {{ delivery.dates.order_before | date }}Envoyer le lien de commande aux groupes pour qu'iels commandent
AjustementsDu {{ delivery.dates.order_before | date }} au {{ delivery.dates.adjustment_deadline | date }}S'assurer que les ajustements sont bien faits par les participant⋅e⋅sFaire les ajustements à la main si besoin
ApprovisionnementsDu {{ delivery.dates.adjustment_deadline | date }} au {{ delivery.dates.delivery_date | date }}Envoyer les infos de commande aux référent⋅e⋅sFaire les commandes aux producteurs⋅rices, récupérer les produits
Préparation de la distributionLa veille du {{ delivery.dates.delivery_date | date }}Imprimer les bons de commandes par colocation
Distribution{{ delivery.dates.delivery_date | date }}Coordoner la distribution, faire la répartition des chèquesArriver 30mn avant le début de la distribution, répartir les produits par coloc
+{% include "includes/delivery_dates_table.html" %}

Emails des référent⋅e⋅s

Ça peut être utile pour leur envoyer un email groupé.

diff --git a/copanier/templates/emails/handover_delivery.html b/copanier/templates/emails/handover_delivery.html index 0506c9d..424d3c4 100644 --- a/copanier/templates/emails/handover_delivery.html +++ b/copanier/templates/emails/handover_delivery.html @@ -2,35 +2,46 @@

La personne référente de la dernière distribution vient de la clôturer, et a indiqué que vous étiez la personne référente pour la prochaine distribution.

-

Bravo :-)

+

Voici donc quelques infos !

-{% if email_body %} -

Elle vous a même laissé un petit message :

- -

{{ email_body}}

- -{% endif %} - -

Voici les informations renseignées :

+

Infos de distrib

-Référent·es produits : +

Référent·es produits

-{% for producer_name, producer in delivery.producers.items() %} -
  • {{ producer.name }} : {{ producer.referent_name }} - {{ producer.referent }} - {{ producer.referent_tel }}
  • -{% endfor %} +

    Liens utiles

    + -

    Si vous avez besoin de modifier ces informations, vous pouvez le faire en suivant ce lien.

    +

    Au cas où, voici les contacts de dernière personne référente : mail {{ old_delivery.contact }}, tel {{ old_delivery.contact_phone }}

    + +{% if email_body %} +

    Elle vous a même laissé un petit message :

    +
    + +

    {{ email_body}}

    + +
    +{% endif %} + +

    Rappel des dates

    + +

    (Les dates sont calculées en fonction de ce qui à été renseigné)

    +{% include "includes/delivery_dates_table.html" %}

    Bonne journée,

    diff --git a/copanier/templates/emails/handover_delivery.txt b/copanier/templates/emails/handover_delivery.txt index 52a38c7..d70b78e 100644 --- a/copanier/templates/emails/handover_delivery.txt +++ b/copanier/templates/emails/handover_delivery.txt @@ -2,29 +2,45 @@ Bonjour, La personne référente de la dernière distribution vient de la clôturer, et a indiqué que vous étiez la personne référente pour la prochaine distribution. -Bravo :-) +Voici donc quelques infos ! -{% if email_body %} -Elle vous a même laissé un petit message : {{ email_body }} - -{% endif %} -Voici les informations renseignées : +Info de distrib +——————————————— Nom : {{ delivery.name }} Date et heure : {{ delivery.from_date|date }} de {{ delivery.from_date|time }} à {{ delivery.to_date|time }}. -Lieu : {{ delivery.location }} +Lieu : {{ delivery.where }} Commandes avant le {{ delivery.order_before|date }}. -Référent·es produits : +Référent·es produits +———————————————————— {% for producer_name, producer in delivery.producers.items() %} - {{ producer.name }} : {{ producer.referent_name }} - {{ producer.referent }} - {{ producer.referent_tel }} {% endfor %} -Si vous avez besoin de modifier ces informations, vous pouvez le faire en suivant ce lien : +Liens utiles +———————————— - {{ url_for('show_delivery', id=delivery.id) }} +- Distribution : {{ url_for('show_delivery', id=delivery.id) }} +- Boîte à outils : {{ url_for('show_delivery_toolbox', id=delivery.id) }} (avec un rappel des dates) +Au cas où, voici les contacts de dernière personne référente : + +- mail {{ old_delivery.contact }} +- tel {{ old_delivery.contact_phone }} + +{% if email_body %} + +Elle vous a même laissé un petit message : + +———— + +{{ email_body}} + +———— + +{% endif %} Bonne journée, {{ config.EMAIL_SIGNATURE }} diff --git a/copanier/templates/includes/delivery_progress.html b/copanier/templates/includes/delivery_progress.html index af4d04d..8c03e73 100644 --- a/copanier/templates/includes/delivery_progress.html +++ b/copanier/templates/includes/delivery_progress.html @@ -4,7 +4,7 @@
  • Commande
  • Ajustements
  • Récupération des commandes
  • -
  • Distribution
  • -
  • Répartition des paiements
  • +
  • Distribution
  • +
  • Répartition des paiements
  • \ No newline at end of file diff --git a/copanier/templates/includes/delivery_status.html b/copanier/templates/includes/delivery_status.html index b0707d0..3fbcbe6 100644 --- a/copanier/templates/includes/delivery_status.html +++ b/copanier/templates/includes/delivery_status.html @@ -1,5 +1,6 @@ {% if delivery.status == delivery.OPEN %}Commandes ouvertes jusqu'au {{ delivery.order_before|date }} {% elif delivery.status == delivery.ADJUSTMENT %}Ajustements en cours {% elif delivery.status == delivery.CLOSED %}Fermée +{% elif delivery.status == delivery.OVER %}Terminée {% elif delivery.status == delivery.NEED_PRICE_UPDATE %}Mise à jour des prix* {% endif %} \ No newline at end of file diff --git a/copanier/views/delivery.py b/copanier/views/delivery.py index 8f0e4bf..339f170 100644 --- a/copanier/views/delivery.py +++ b/copanier/views/delivery.py @@ -70,7 +70,7 @@ async def hand_over_delivery_post(request, response, id): new_delivery.producers = old_delivery.producers new_delivery.products = old_delivery.products - # Update referent fields + # Update referent fields. for producer_id, producer in new_delivery.producers.items(): producer.referent = form.get(f'producer_{producer_id}_referent_email') producer.referent_name = form.get(f'producer_{producer_id}_referent_name') @@ -78,6 +78,10 @@ async def hand_over_delivery_post(request, response, id): new_delivery.producers[producer_id] = producer new_delivery.persist() + # Mark the old delivery as over. + old_delivery.over = True + old_delivery.persist() + emails.send_from_template( env, "handover_delivery", @@ -88,6 +92,7 @@ async def hand_over_delivery_post(request, response, id): email_body = form.get('email_body'), hostname=request.host, url_for=app.url_for, + old_delivery=old_delivery ) response.message("La distribution à bien été créée et le mail envoyé, merci !")