Enhance style

This commit is contained in:
Alexis Métaireau 2021-07-11 01:30:23 +02:00
parent 2a1483ece5
commit 9bccd8be25
16 changed files with 197 additions and 137 deletions

View file

@ -110,7 +110,7 @@ legend {
}
h1 { font-size: 2.2rem }
h2 { font-size: 1.8rem }
h2 { font-size: 1rem }
h3 { font-size: 1.4rem }
h4 { font-size: 1.1rem }
@ -317,6 +317,7 @@ th + td,
th + th,
td + th {
border-left: 1px solid #aaa;
padding: 5px;
}
th {
color: #363636;
@ -335,7 +336,7 @@ th.price {
text-align: center;
}
th.amount {
width: 5rem;
width: 10rem;
}
.ref {
width: 5rem;
@ -351,7 +352,7 @@ th.total {
}
tr:nth-child(even) {
background-color: #ddd;
background-color: #f0efef;
}
thead tr {
background-color: var(--neutral-color);
@ -362,6 +363,9 @@ thead tr * {
thead th + th {
border-left: 1px solid white;
}
th, td {
padding: 5px !important;
}
tr .producer {
border-bottom: 1px solid #aaa;
@ -376,18 +380,28 @@ article.order {
margin-left: auto;
margin-right: auto;
}
table.order th.product {
table th.product {
min-width: 10rem;
width: inherit;
max-width: 25em;
overflow: hidden;
max-width: 15em;
word-wrap: break-word;
overflow: auto;
white-space: initial;
}
table.order td.quantity {
max-width: 10em;
word-wrap: break-word;
overflow: auto;
white-space: initial;
}
td.with-input {
padding: 0;
text-align: left;
}
td.with-input input {
width: 50%;
text-align: center;
}
@ -566,10 +580,12 @@ details summary {
}
.rupture {
background-color: #ff000083 !important;
text-decoration: line-through;
font-style: italic;
background-color: #fbb !important;
}
.list-emails {
display: block;
width: 700px;
@ -623,7 +639,7 @@ table.paiements tr:hover td {
.container {
width: 600px;
margin: 100px auto;
margin: 100px auto;
}
.progressbar {
counter-reset: step;
@ -715,7 +731,7 @@ ul.actions > li {
}
.fixed-table td, .fixed-table th{
white-space:pre-wrap;
white-space:pre-wrap;
}
small {
@ -793,7 +809,7 @@ small {
.important-message {
padding: 1em;
text-align: center;
background-color: rgba(233, 161, 28, 0.2);
border: 2px black dashed;
}
@ -806,4 +822,6 @@ footer {
padding: 1em;
background: #fafafa;
text-align: center;
}
}
.big-button { margin: 2em;}

View file

@ -0,0 +1,54 @@
(function (window, document) {
// we fetch the elements each time because docusaurus removes the previous
// element references on page navigation
function getElements() {
return {
layout: document.getElementById('layout'),
menu: document.getElementById('menu'),
menuLink: document.getElementById('menuLink')
};
}
function toggleClass(element, className) {
var classes = element.className.split(/\s+/);
var length = classes.length;
var i = 0;
for (; i < length; i++) {
if (classes[i] === className) {
classes.splice(i, 1);
break;
}
}
// The className is not found
if (length === classes.length) {
classes.push(className);
}
element.className = classes.join(' ');
}
function toggleAll() {
var active = 'active';
var elements = getElements();
toggleClass(elements.layout, active);
toggleClass(elements.menu, active);
toggleClass(elements.menuLink, active);
}
function handleEvent(e) {
var elements = getElements();
if (e.target.id === elements.menuLink.id) {
toggleAll();
e.preventDefault();
} else if (elements.menu.className.indexOf('active') !== -1) {
toggleAll();
}
}
document.addEventListener('click', handleEvent);
}(this, this.document));

View file

@ -25,4 +25,7 @@
.page-break {
page-break-after: always;
}
}
footer {
display: none;
}
}

View file

@ -29,26 +29,25 @@ This is the parent `<div>` that contains the menu and the content area.
padding-left: 0;
}
#layout.active #menu {
left: 150px;
width: 150px;
left: 200px;
width: 200px;
}
#layout.active .menu-link {
left: 150px;
left: 200px;
}
/*
The content `<div>` is where all your content goes.
*/
.content {
margin: 0 auto;
padding: 0 2em;
margin-bottom: 50px;
line-height: 1.6em;
}
.narrow {
margin: 0 auto;
max-width: 800px;
max-width: 800px;
}
.header {
@ -65,7 +64,7 @@ The content `<div>` is where all your content goes.
}
.header h2 {
font-weight: 300;
color: #ccc;
color: #777;
padding: 0;
margin-top: 0;
}
@ -93,7 +92,6 @@ appears on the left side of the page.
z-index: 1000; /* so the menu or its navicon stays above all content */
background: #191818;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
}
/*
All anchors inside the menu should be styled like this.
@ -190,6 +188,7 @@ small screens.
.menu-link span:before,
.menu-link span:after {
background-color: #fff;
pointer-events: none;
width: 100%;
height: 0.2em;
}
@ -250,13 +249,3 @@ Hides the menu at `48em`, but modify this based on your app's needs.
left: 200px;
}
}
.pure-menu-item a {
display: block;
}
#sitename {
color: #ccc;
display: block;
padding-left: 1em;
}

View file

@ -34,23 +34,24 @@
{% if request.user %}
<div id="menu">
<div class="pure-menu">
<h1 id="sitename">{{ config.SITE_NAME }}</h1>
<h1 id="sitename"><a href="{{ url_for('home') }}">{{ config.SITE_NAME }}</a></h1>
{% block additional_menu %}{% endblock %}
<ul class="pure-menu-list">
<li class="pure-menu-item">
<a href="{{ url_for('home') }}"><i class="icon-happy"></i>&nbsp;Voir les distrib</a>
<a class="pure-menu-link" href="{{ url_for('archives') }}"><i class="icon-happy"></i>&nbsp;Voir les archives</a>
</li>
{% if request.user and request.user.is_staff %}
<li class="pure-menu-item">
<a href="{{ url_for('new_delivery') }}"><i class="icon-hotairballoon"></i>&nbsp;Nouvelle distribution</a>
<a class="pure-menu-link" href="{{ url_for('new_delivery') }}"><i class="icon-hotairballoon"></i>&nbsp;Nouvelle distribution</a>
</li>
{% endif %}
{% if request.user and (request.user.is_staff or not config.HIDE_GROUPS_LINK) %}
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ url_for('groups') }}"><i class="icon-globe"></i>&nbsp;Gérer les groupes</a>
<a class="pure-menu-link" class="pure-menu-link" href="{{ url_for('groups') }}"><i class="icon-globe"></i>&nbsp;Gérer les groupes</a>
</li>
{% endif %}
<li class="pure-menu-item">
<a href="{{ url_for('logout') }}"><i class="icon-lock"></i>&nbsp;Se déconnecter</a>
<a class="pure-menu-link" href="{{ url_for('logout') }}"><i class="icon-lock"></i>&nbsp;Se déconnecter</a>
</li>
</ul>
</div>
@ -73,6 +74,7 @@
<script src="{{ url_for('/static/js/flash.min.js') }}"></script>
<script src="{{ url_for('/static/js/app.js') }}"></script>
<script src="{{ url_for('/static/js/menus.js') }}"></script>
{% if message %}
<script>
new window.FlashMessage("{{ message[0] }}", "{{ message[1] }}", {

View file

@ -3,16 +3,6 @@
<div class="header">
<h1>Distributions</h1>
{% include "includes/delivery_list.html" %}
</div>
{% with deliveries=incoming %}
{% include "includes/delivery_list.html" %}
{% endwith %}
{% if former %}
<div class="header">
<h1>Distributions passées</h1>
</div>
{% with deliveries=former %}
{% include "includes/delivery_small_list.html" %}
{% endwith %}
{% endif %}
{% endblock body %}

View file

@ -22,7 +22,7 @@
<tr>
<th class="product">Produit</th>
<th class="price">Prix</th>
{% if delivery.has_packing %}
{% if producer.has_packing %}
<th class="packing">Conditionnement</th>
{% endif %}
<th class="amount">Commande</th>
@ -41,7 +41,7 @@
{% endif %}
</th>
<td>{{ product.price | round(2) }} €</td>
{% if delivery.has_packing %}
{% 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 }}">{% if not (delivery.status == delivery.ADJUSTMENT or force_adjustments) %} x {{ product.unit }}{% endif %}</td>

View file

@ -1,5 +1,27 @@
{% extends "base.html" %}
{% block is_wide %}{% endblock %}
{% block additional_menu %}
<div class="pure-menu">
<ul class="pure-menu-list">
<li class="pure-menu-item"><a href="{{ url_for('list_products', id=delivery.id) }}/produits.pdf" class="pure-menu-link"><i class="icon-ribbon"></i>&nbsp;Bons de commande</a></li>
<li class="pure-menu-item"><a href="{{ url_for('show_orders_summary', id=delivery.id) }}" class="pure-menu-link"><i class="icon-grid"></i>&nbsp;Commandes groupes</a></li>
<li class="pure-menu-item"><a href="{{ url_for('compute_payments', id=delivery.id) }}" class="pure-menu-link"><i class="icon-wallet"></i>&nbsp;Paiements</a></li>
{% if request['user'].email == delivery.contact and delivery.status > delivery.EMPTY %}
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ url_for('show_delivery_toolbox', id=delivery.id) }}"><i class="icon-tools"></i>&nbsp;Boîte à outils</a>
</li>
{% endif %}
{% if request.user and request.user.is_staff %}
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ url_for('edit_delivery', id=delivery.id) }}"><i class="icon-adjustments"></i>&nbsp;Modifier la distrib</a>
</li>
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ url_for('list_products', id=delivery.id) }}"><i class="icon-pricetags"></i>&nbsp;Éditer produits</a>
</li>
{% endif %}
</ul>
</div>
{% endblock %}
{% block body %}
{% if delivery.status == delivery.CLOSED %}
@ -9,50 +31,24 @@
<div class="header">
<h1>{{ delivery.name }}</h1>
{% include "includes/delivery_progress.html" %}
<h4>{% if delivery.products %}
<h2>
Distribution le <i class="icon-clock"></i> {{ delivery.from_date|date }}, {{ delivery.from_date|time }} - {{ delivery.to_date|time }}, à <i class="icon-streetsign"></i> {{ delivery.where }}.
</h2>
<h3>{% if delivery.products %}
{% include "includes/delivery_status.html" %}
{% endif %}
{% include "includes/order_button.html" %}
</h4>
<h4>
Distribution le <i class="icon-clock"></i> {{ delivery.from_date|date }}, {{ delivery.from_date|time }} - {{ delivery.to_date|time }}, à <i class="icon-streetsign"></i> {{ delivery.where }}.
</h4>
<div class="pure-menu pure-menu-horizontal">
<ul class="pure-menu-list">
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
<a href="#" class="pure-menu-link"><i class="icon-printer"></i>&nbsp;Imprimer…</a>
<ul class="pure-menu-children">
<li class="pure-menu-item"><a href="{{ url_for('list_products', id=delivery.id) }}/produits.pdf" class="pure-menu-link"><i class="icon-ribbon"></i>&nbsp;Commande producteurs⋅rices</a></li>
<li class="pure-menu-item"><a href="{{ url_for('show_orders_summary', id=delivery.id) }}" class="pure-menu-link"><i class="icon-grid"></i>&nbsp;Résumé de commande par groupe</a></li>
<li class="pure-menu-item"><a href="{{ url_for('compute_payments', id=delivery.id) }}" class="pure-menu-link"><i class="icon-wallet"></i>&nbsp;Répartition des paiements</a></li>
</ul>
</li>
{% if request['user'].email == delivery.contact and delivery.status > delivery.EMPTY %}
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ url_for('show_delivery_toolbox', id=delivery.id) }}"><i class="icon-tools"></i>&nbsp;Boîte à outils</a>
</li>
{% endif %}
{% if request.user and request.user.is_staff %}
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ url_for('edit_delivery', id=delivery.id) }}"><i class="icon-adjustments"></i>&nbsp;Modifier la distrib</a>
</li>
<li class="pure-menu-item">
<a class="pure-menu-link" href="{{ url_for('list_products', id=delivery.id) }}"><i class="icon-pricetags"></i>&nbsp;Produits</a>
</li>
{% endif %}
</ul>
</div>
</ul>
</h3>
{% include "includes/delivery_progress.html" %}
</div>
<article class="delivery">
{% if request['user'].email == delivery.contact %}
<div class="placeholder center">
Tu es la personne contact pour l'organisation de cette distribution, merci :-) Pour t'aider, tu peux accéder à
<a href="{{ url_for('show_delivery_toolbox', id=delivery.id) }}"><i class="icon-tools"></i>&nbsp;la boîte à outils</a> !
Hey, jettes un coup d'oeil à
<a href="{{ url_for('show_delivery_toolbox', id=delivery.id) }}">&nbsp;la boîte à outils</a> !
</div>
{% endif %}
{% if delivery.has_products %}
@ -79,13 +75,12 @@ Tu es la personne contact pour l'organisation de cette distribution, merci :-) P
<li><a href="{{ url_for('create_producer', delivery_id=delivery.id) }}">Ajouter les product⋅eurs⋅rices</a> à la main ;</li>
<li>Ou bien <a href="{{ url_for('copy_products', id=delivery.id) }}">copier les produits d'une autre distribution</a>.</li>
</ol>
</div>
{% endif %}
</div>
{% endif %}
</article>
<hr>
<ul class="toolbox">
</ul>
{% endblock body %}

View file

@ -5,11 +5,10 @@
{% block body %}
<div class="header">
<h1>Gestion de la distribution « {{ delivery.name }} »</h1>
<h1>{{ delivery.name }}</h1>
</div>
{% set display_counts = True %}
{% include "includes/delivery_head.html" %}
<i class="icon-lightbulb"></i> <strong>{{ delivery.orders|length }}</strong> groupes, <strong>{{ delivery.products|length }}</strong> produits et <strong>{{ delivery.producers | length}}</strong> fournisseurs. <br /> Total de la commande : <strong>{{ delivery.total }}€</strong></li>
<h2>Rappel des dates</h2>
{% include "includes/delivery_dates_table.html" %}
@ -41,4 +40,4 @@ Pour préparer la distribution :
<li><a href="{{ url_for('compute_payments', id=delivery.id) }}"><i class="icon-gears"></i>&nbsp; Faire la répartition des paiements</a></li>
</ul>
{% endblock %}
{% endblock %}

View file

@ -1,14 +1,14 @@
<table class="pure-table fixed-table">
<thead>
<tr>
<th>Quoi ?</th><th>Dates</th><th>Coordinatrice⋅eur</th><th>Référent⋅e⋅s produits</th>
<th></th><th>Dates</th><th>Coord</th><th>Référent⋅e⋅s</th>
</tr>
</thead>
<tbody>
<tr>
<th>Création de la distribution</th>
<td>{{ delivery.dates.creation_date | date}}</td>
<td>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</td>
<td>Rappeler aux référent⋅e⋅s produit de mettre leurs prix à jour, vérifier que tous les produits sont bien présentes, en ajouter si besoin</td>
<td>-</td>
</tr>
<tr>
@ -18,27 +18,27 @@
<td>Les référent⋅e⋅s produit mettent les prix à jour.</td>
</tr>
<tr>
<th>Commandes</td>
<th>Commandes</th>
<td>Du {{ delivery.dates.price_update_deadline | date }} au {{ delivery.dates.order_before | date }}</td>
<td>Envoyer le lien de commande aux groupes pour qu'iels commandent</td>
<td>Envoyer le lien de commande aux groupes</td>
<td></td>
</tr>
<tr>
<th>Ajustements</th>
<td>Du {{ delivery.dates.order_before | date }} au {{ delivery.dates.adjustment_deadline | date }}</td>
<td>S'assurer que les ajustements sont bien faits par les participant⋅e⋅s</td>
<td>S'assurer que les produits qui doivent être tomber rond tombent bien rond ! Ajuster si besoin.</td>
<td>Faire les ajustements à la main si besoin</td>
</tr>
<tr>
<th>Approvisionnements</th>
<th>Récup des produits</th>
<td>Du {{ delivery.dates.adjustment_deadline | date }} au {{ delivery.dates.delivery_date | date }}</td>
<td><a href="{{ url_for('send_referent_emails', id=delivery.id) }}">Envoyer les infos de commande aux référent⋅e⋅s</a></td>
<td>Faire les commandes aux producteurs⋅rices, <strong>récupérer les produits</strong></td>
<td>Transmettre les commandes, <strong>récupérer les produits</strong></td>
</tr>
<tr>
<th>Préparation de la distribution</th>
<td>La veille du {{ delivery.dates.delivery_date | date }}</td>
<td><a href="{{ url_for('show_orders_summary', id=delivery.id) }}">Imprimer les bons de commandes par colocation</a></td>
<td><a href="{{ url_for('show_orders_summary', id=delivery.id) }}">Imprimer les bons de commandes par groupe</a></td>
<td></td>
</tr>
<tr>
@ -54,4 +54,4 @@
<td></td>
</tr>
</tbody>
</table>
</table>

View file

@ -1,15 +1,8 @@
<ul class="delivery-head">
{% if delivery.description %}<li><i class="icon-basket"></i> <strong>Produits</strong> {{ delivery.description }}</li>{% endif %}
<li><i class="icon-clock"></i> <strong>Distribution le</strong> <time datetime="{{ delivery.from_date }}">{{ delivery.from_date|date }} ({{ delivery.from_date|time }} à {{ delivery.to_date|time }}</time></li>
<li><i class="icon-clock"></i> <strong>Distribution le</strong> <time datetime="{{ delivery.from_date }}">{{ delivery.from_date|date }} ({{ delivery.from_date|time }} à {{ delivery.to_date|time }})</time></li>
<li><i class="icon-hourglass"></i> <strong>Commandes avant le</strong> <time datetime="{{ delivery.order_before }}">{{ delivery.order_before|date }}</time></li>
<li class="hide-on-print"><i class="icon-calendar"></i>
{% include "includes/delivery_status.html" %}
</li>
{% if display_counts %}
<li><i class="icon-lightbulb"></i> <strong>{{ delivery.orders|length }}</strong> colocs</strong>, <strong>{{ delivery.products|length }}</strong> produits et <strong>{{ delivery.producers | length}}</strong> product⋅eurs⋅rices, <strong>{{ delivery.total }}€</strong></li>
{% else %}
<li class="hide-on-print"><i class="icon-strategy"></i> <strong>Référent⋅e</strong> <a href="mailto:{{ delivery.contact }}">{{ delivery.contact }}</a></li>
{% endif %}
<li class="hide-on-print"><i class="icon-strategy"></i> <strong>Référent⋅e</strong> : <a href="tel:{{ delivery.contact_phone }}">{{ delivery.contact_phone }}</a></li>
{% if delivery.instructions %}<li><i class="icon-lightbulb"></i> <strong>À savoir</strong> {{ delivery.instructions }}</li>{% endif %}
{% if delivery.infos_url %}<li><i class="icon-global"></i><strong>Plus d'infos</strong> <a href="{{ delivery.infos_url }}" title="{{ delivery.infos_url }}">{{ delivery.infos_url|truncate(20)}}</a></li>{% endif %}
</ul>
</ul>

View file

@ -1,10 +1,10 @@
<ul class="progressbar">
<li>Mise à jour des référent·es</li>
<li {% if delivery.status == delivery.NEED_PRICE_UPDATE %}class="active"{% endif %}>Mise à jour des prix</li>
<li>Création</li>
<li {% if delivery.status == delivery.NEED_PRICE_UPDATE %}class="active"{% endif %}>Mise à jour</li>
<li {% if delivery.status == delivery.OPEN %}class="active"{% endif %}>Commande</li>
<li {% if delivery.status == delivery.ADJUSTMENT %}class="active"{% endif %}>Ajustements</li>
<li {% if delivery.status == delivery.WAITING_PRODUCTS %}class="active"{% endif %}>Récupération des commandes</li>
<li><a href="{{ url_for('show_orders_summary', id=delivery.id) }}">Distribution</a></li>
<li {% if delivery.status == delivery.CLOSED %}class="active"{% endif %}><a href="{{ url_for('compute_payments', id=delivery.id) }}">Répartition des paiements</a></li>
<li {% if delivery.status == delivery.WAITING_PRODUCTS %}class="active"{% endif %}>Appro</li>
<li><a href="{{ url_for('show_orders_summary', id=delivery.id) }}">Distrib</a></li>
<li {% if delivery.status == delivery.CLOSED %}class="active"{% endif %}><a href="{{ url_for('compute_payments', id=delivery.id) }}">Paiements</a></li>
</ul>
<div style="clear: both"></div>
<div style="clear: both"></div>

View file

@ -6,21 +6,18 @@
{% for producer in producers %}
{% set producer_obj = delivery.producers[producer] %}
{% if edit_mode or producer_obj.has_active_products(delivery) %}
<h2>{{ producer_obj.name }}
<h3>{{ producer_obj.name }}
{% if producer_obj.needs_price_update(delivery) %}*{% endif %}
{% if edit_mode or request.user.is_staff or producer_obj.referent == request.user.email %}
<span class="edit">
<a class="button" href="{{ url_for('edit_producer', delivery_id=delivery.id, producer_id=producer_obj.id) }}"><i class="icon-ribbon"></i>&nbsp; Gérer ce⋅tte producteur⋅rice</a>
<a class="button" href="{{ url_for('edit_producer', delivery_id=delivery.id, producer_id=producer_obj.id) }}"><i class="icon-ribbon"></i>&nbsp; Gérer les produits</a>
</span>
{% endif %}
</h2>
<h5>{% if producer_obj.description %}{{ producer_obj.description }}. {% endif %}Référent⋅e : <a href="mailto:{{ producer_obj.referent }}">{{ producer_obj.referent_name }}</a> / {{ producer_obj.referent_tel }}.
{% if not edit_mode and producer_obj.has_rupture_products(delivery) %}
<p><em>Certains produits sont en rupture de stock.</em></p>
{% endif %}
</h3>
<h5>{% if producer_obj.description %}{{ producer_obj.description }}. {% endif %}Référent⋅e : <a href="mailto:{{ producer_obj.referent }}">{{ producer_obj.referent_name }}</a> / <a href="tel:{{ producer_obj.referent_tel }}">{{ producer_obj.referent_tel }}</a>
</h5>
{% if not delivery.get_products_by(producer) %}
😔 Ce⋅tte producteur⋅rice n'a pas encore de produits. Voulez vous <a href="{{ url_for('create_product', delivery_id=delivery.id, producer_id=producer_obj.id) }}">en rajouter un ?</a>
😔 Aucun produit. Voulez vous <a href="{{ url_for('create_product', delivery_id=delivery.id, producer_id=producer_obj.id) }}">en rajouter un ?</a>
{% else %}
<table class="delivery pure-table">
<thead>
@ -47,9 +44,9 @@
</thead>
<tbody>
{% for product in delivery.get_products_by(producer) %}
{% if edit_mode or not product.rupture %}
<tr>
<th class="product {% if product.rupture %}rupture{% endif %}">{% if edit_mode %}<a href="{{ url_for('edit_product', delivery_id=delivery.id, producer_id=producer_obj.id, product_ref=product.ref) }}">{% endif %}{% if edit_mode %}<i class="icon-pencil"></i>&nbsp;{% endif %}{% if product.rupture %} (rupture){% endif %} {{ product }}{% if edit_mode %}</a>{% endif %}
<tr {% if product.rupture %}class="rupture"{% endif %}>
<th class="product">{% if edit_mode %}<a href="{{ url_for('edit_product', delivery_id=delivery.id, producer_id=producer_obj.id, product_ref=product.ref) }}">{% endif %}{% if edit_mode %}<i class="icon-pencil"></i>&nbsp;{% endif %}{% if product.rupture %}{% endif %} {{ product }}{% if edit_mode %}</a>{% endif %}
<td>{{ product.price | round(2) }} €</td>
{% if delivery.has_packing %}
<td class="packing">{% if product.packing %}{{ product.packing }} x {% endif %} {{ product.unit }}</td>
@ -66,7 +63,7 @@
{% endfor %}
{% endif %}
</tr>
{% endif %}
{% endfor %}
{% if delivery.shipping.get(producer) %}
<tr>
@ -88,7 +85,7 @@
{% if delivery.has_packing %}
<td></td>
{% endif %}
<th class="total">{{ delivery.total_for_producer(producer) }} €</th>
{% if not list_only %}
{% for email, order in delivery.orders.items() %}
@ -101,4 +98,4 @@
{% endif %}
<br />
{%- endif %}
{% endfor %}
{% endfor %}

View file

@ -1,5 +1,5 @@
{% if (delivery.status == delivery.OPEN or delivery.status == delivery.ADJUSTMENT) and delivery.has_products %}
<a class="button" href="{{ url_for('place_order', id=delivery.id) }}">
<a class="button big-button" href="{{ url_for('place_order', id=delivery.id) }}">
{% if delivery.status == delivery.ADJUSTMENT %}
Ajuster ma commande
{% elif delivery.status == delivery.OPEN %}

View file

@ -7,7 +7,7 @@
{% if display_prices %}
<td>{{ product.price | round(2) }} €</td>
{% endif %}
<td>{{ order[product].quantity }} x {{ product.unit }}</td>
<td class="quantity">{{ order[product].quantity }} x {{ product.unit }}</td>
{% if display_prices %}
<td>{{ order.total([product], delivery, group_id, False) }}</td>
{% endif %}
@ -15,4 +15,6 @@
{% endif %}
{% endfor %}
</table>
<p>Total: {{ order.total(delivery.products, delivery, group_id) if order else 0 }} € (dont {{ order.compute_shipping(delivery, delivery.producers, group_id) | round(2) }} de port)</p>
{% set shipping = order.compute_shipping(delivery, delivery.producers, group_id) | round(2) %}
<p>Total: {{ order.total(delivery.products, delivery, group_id) if order else 0 }} € {% if shipping > 0 %}(dont {{ shipping }}€ de port){% endif %}</p>

View file

@ -16,6 +16,25 @@ async def on_startup():
@app.route("/", methods=["GET"])
async def home(request, response):
if not Delivery.is_defined() and not Groups.is_defined():
response.redirect = app.url_for("onboarding")
return
if not request["user"].group_id:
response.redirect = app.url_for("groups")
return
deliveries=Delivery.incoming()
if len(deliveries) == 1:
response.redirect = app.url_for("show_delivery", id=deliveries[0].id)
else:
response.html(
"delivery/list_deliveries.html",
deliveries=Delivery.incoming(),
)
@app.route("/archives", methods=["GET"])
async def archives(request, response):
if not Delivery.is_defined() and not Groups.is_defined():
response.redirect = app.url_for("onboarding")
return
@ -24,8 +43,7 @@ async def home(request, response):
return
response.html(
"delivery/list_deliveries.html",
incoming=Delivery.incoming(),
former=Delivery.former(),
deliveries=Delivery.former(),
)
@ -94,7 +112,7 @@ async def hand_over_delivery_post(request, response, id):
url_for=app.url_for,
old_delivery=old_delivery
)
response.message("La distribution à bien été créée et le mail envoyé, merci !")
response.redirect = f"/distribution/{new_delivery.id}"
@ -297,7 +315,7 @@ async def show_orders_summary(request, response, id):
delivery = Delivery.load(id)
response.pdf(
"delivery/show_orders_summary.html",
{"delivery": delivery},
{"delivery": delivery, "display_prices": True},
css="order-summary.css",
filename=utils.prefix("résumé-de-commandes.pdf", delivery),
)