mirror of
https://github.com/almet/copanier.git
synced 2025-04-29 03:52:38 +02:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
642163b756
7 changed files with 103 additions and 13 deletions
|
@ -293,12 +293,15 @@ class Order(Base):
|
||||||
p.quantity * _get_price(ref) for ref, p in self.products.items()
|
p.quantity * _get_price(ref) for ref, p in self.products.items()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
shipping = self.compute_shipping(delivery, producers, email) if include_shipping else 0
|
||||||
|
|
||||||
|
return round(total_products + shipping, 2)
|
||||||
|
|
||||||
|
def compute_shipping(self, delivery, producers, email):
|
||||||
total_shipping = 0
|
total_shipping = 0
|
||||||
if include_shipping:
|
|
||||||
for producer in producers:
|
for producer in producers:
|
||||||
total_shipping = total_shipping + delivery.shipping_for(email, producer)
|
total_shipping = total_shipping + delivery.shipping_for(email, producer)
|
||||||
|
return total_shipping
|
||||||
return round(total_products + total_shipping, 2)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_adjustments(self):
|
def has_adjustments(self):
|
||||||
|
@ -315,6 +318,7 @@ class Delivery(PersistedBase):
|
||||||
NEED_PRICE_UPDATE = 1
|
NEED_PRICE_UPDATE = 1
|
||||||
OPEN = 2
|
OPEN = 2
|
||||||
ADJUSTMENT = 3
|
ADJUSTMENT = 3
|
||||||
|
WAITING_PRODUCTS = 4
|
||||||
|
|
||||||
name: str
|
name: str
|
||||||
from_date: datetime_field
|
from_date: datetime_field
|
||||||
|
@ -343,6 +347,9 @@ class Delivery(PersistedBase):
|
||||||
return self.OPEN
|
return self.OPEN
|
||||||
if self.needs_adjustment:
|
if self.needs_adjustment:
|
||||||
return self.ADJUSTMENT
|
return self.ADJUSTMENT
|
||||||
|
if self.is_waiting_products:
|
||||||
|
return self.WAITING_PRODUCTS
|
||||||
|
|
||||||
return self.CLOSED
|
return self.CLOSED
|
||||||
|
|
||||||
def products_need_price_update(self, products=None):
|
def products_need_price_update(self, products=None):
|
||||||
|
@ -376,6 +383,15 @@ class Delivery(PersistedBase):
|
||||||
def is_open(self):
|
def is_open(self):
|
||||||
return datetime.now().date() <= self.order_before.date()
|
return datetime.now().date() <= self.order_before.date()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_waiting_products(self):
|
||||||
|
return (
|
||||||
|
datetime.now().date() >= self.order_before.date()
|
||||||
|
and
|
||||||
|
datetime.now().date() <= self.from_date.date()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_foreseen(self):
|
def is_foreseen(self):
|
||||||
return datetime.now().date() <= self.from_date.date()
|
return datetime.now().date() <= self.from_date.date()
|
||||||
|
|
|
@ -566,7 +566,8 @@ details summary {
|
||||||
}
|
}
|
||||||
|
|
||||||
.rupture {
|
.rupture {
|
||||||
background-color: #ff000083;
|
background-color: #ff000083 !important;
|
||||||
|
text-decoration: line-through;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list-emails {
|
.list-emails {
|
||||||
|
@ -729,3 +730,58 @@ small {
|
||||||
.header {
|
.header {
|
||||||
padding-bottom: 2em !important;
|
padding-bottom: 2em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 1100px) {
|
||||||
|
.progressbar {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.progressbar {
|
||||||
|
counter-reset: step;
|
||||||
|
}
|
||||||
|
.progressbar li {
|
||||||
|
list-style-type: none;
|
||||||
|
width: 13%;
|
||||||
|
float: left;
|
||||||
|
font-size: 12px;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #7d7d7d;
|
||||||
|
}
|
||||||
|
.progressbar li:before {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
content: counter(step);
|
||||||
|
counter-increment: step;
|
||||||
|
line-height: 30px;
|
||||||
|
border: 2px solid #7d7d7d;
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
margin: 0 auto 10px auto;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
.progressbar li:after {
|
||||||
|
width: 100%;
|
||||||
|
height: 2px;
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
background-color: #7d7d7d;
|
||||||
|
top: 15px;
|
||||||
|
left: -50%;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
.progressbar li:first-child:after {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
.progressbar li.active {
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
.progressbar li.active:before {
|
||||||
|
border-color: #55b776;
|
||||||
|
}
|
||||||
|
.progressbar li.active + li:after {
|
||||||
|
background-color: #55b776;
|
||||||
|
}
|
2
copanier/static/flash.min.css
vendored
2
copanier/static/flash.min.css
vendored
|
@ -1 +1 @@
|
||||||
.flash-container{position:fixed;top:75px;right:15px;z-index:1000;max-width:25%}.flash-container .flash-message{position:relative;opacity:0;min-height:28px;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);-webkit-transition:all .5s;-o-transition:all .5s;transition:all .5s;background-color:#fff;color:#2c3433;-webkit-border-radius:0;border-radius:0;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;margin-bottom:10px;padding:5px 35px 5px 20px;-webkit-box-shadow:2px 2px 33px 8px rgba(0,0,0,.1);box-shadow:2px 2px 33px 8px rgba(0,0,0,.1);line-height:1.4;cursor:pointer}.flash-container .flash-message .flash-progress{position:absolute;right:0;top:auto;bottom:0;left:0;width:0;height:3px;opacity:1;background-color:rgba(0,0,0,.15);-webkit-transition:opacity .1s;-o-transition:opacity .1s;transition:opacity .1s}.flash-container .flash-message .flash-progress.is-hidden{opacity:0}.flash-container .flash-message .flash-progress.flash-progress-top{top:0;bottom:auto}.flash-container .flash-message:before{position:absolute;content:"";width:7px;height:100%;top:0;bottom:0;left:-7px;background-color:transparent;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.flash-container .flash-message:after{position:absolute;content:"";font-family:fontAwesome;top:5px;right:8px;text-align:center;vertical-align:middle;color:#9e9e9e}.flash-container .flash-message.is-visible{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.flash-container .flash-message.flash-success .flash-progress{background-color:rgba(76,175,80,.15)}.flash-container .flash-message.flash-success:before{background-color:#4caf50}.flash-container .flash-message.flash-success:after{color:rgba(76,175,80,.5);content:"\F058"}.flash-container .flash-message.flash-warning .flash-progress{background-color:rgba(255,133,27,.15)}.flash-container .flash-message.flash-warning:before{background-color:#ff851b}.flash-container .flash-message.flash-warning:after{color:rgba(255,133,27,.5);content:"\F071"}.flash-container .flash-message.flash-danger .flash-progress,.flash-container .flash-message.flash-error .flash-progress{background-color:rgba(255,65,54,.15)}.flash-container .flash-message.flash-danger:before,.flash-container .flash-message.flash-error:before{background-color:#ff4136}.flash-container .flash-message.flash-danger:after,.flash-container .flash-message.flash-error:after{color:rgba(255,65,54,.5);content:"\F06A"}.flash-container .flash-message.flash-info .flash-progress{background-color:rgba(0,116,217,.15)}.flash-container .flash-message.flash-info:before{background-color:#0074d9}.flash-container .flash-message.flash-info:after{color:rgba(0,116,217,.5);content:"\F05A"}.flash-container .flash-message.flash-bug .flash-progress{background-color:rgba(138,43,226,.15)}.flash-container .flash-message.flash-bug:before{background-color:#8a2be2}.flash-container .flash-message.flash-bug:after{color:rgba(138,43,226,.5);content:"\F188"}.flash-container .flash-message.flash-disabled .flash-progress{background-color:hsla(0,0%,67%,.15)}.flash-container .flash-message.flash-disabled:before{background-color:#aaa}.flash-container .flash-message.flash-disabled:after{color:hsla(0,0%,67%,.5);content:"\F05E"}.flash-container .flash-message.flash-default{padding-right:20px}@media (max-width:1280px){.flash-container{max-width:33.334%}}@media (max-width:768px){.flash-container{max-width:50%}}@media (max-width:480px){.flash-container{right:10px;left:10px;max-width:100%}}.flash-container .flash-message.dark-theme{background-color:#2c3433;color:#fff}.flash-container .flash-message.dark-theme .flash-progress{background-color:hsla(0,0%,100%,.5)}
|
.flash-container{position:fixed;top:75px;right:15px;z-index:1000;max-width:25%}.flash-container .flash-message{position:relative;opacity:0;min-height:28px;-webkit-transform:translateX(-20px);-ms-transform:translateX(-20px);transform:translateX(-20px);-webkit-transition:all .5s;-o-transition:all .5s;transition:all .5s;background-color:#fff;color:#2c3433;-webkit-border-radius:0;border-radius:0;-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;margin-bottom:10px;padding:5px 35px 5px 20px;-webkit-box-shadow:2px 2px 33px 8px rgba(0,0,0,.1);box-shadow:2px 2px 33px 8px rgba(0,0,0,.1);line-height:1.4;cursor:pointer}.flash-container .flash-message .flash-progress{position:absolute;right:0;top:auto;bottom:0;left:0;width:0;height:3px;opacity:1;background-color:rgba(0,0,0,.15);-webkit-transition:opacity .1s;-o-transition:opacity .1s;transition:opacity .1s}.flash-container .flash-message .flash-progress.is-hidden{opacity:0}.flash-container .flash-message .flash-progress.flash-progress-top{top:0;bottom:auto}.flash-container .flash-message:before{position:absolute;content:"";width:7px;height:100%;top:0;bottom:0;left:-7px;background-color:transparent;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.flash-container .flash-message:after{position:absolute;content:"";font-family:fontAwesome;top:5px;right:8px;text-align:center;vertical-align:middle;color:#9e9e9e}.flash-container .flash-message.is-visible{opacity:1;-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.flash-container .flash-message.flash-success .flash-progress{background-color:rgba(76,175,80,.15)}.flash-container .flash-message.flash-success:before{background-color:#4caf50}.flash-container .flash-message.flash-success:after{color:rgba(76,175,80,.5);content:"✓"}.flash-container .flash-message.flash-warning .flash-progress{background-color:rgba(255,133,27,.15)}.flash-container .flash-message.flash-warning:before{background-color:#ff851b}.flash-container .flash-message.flash-warning:after{color:rgba(255,133,27,.5);content:"⚠"}.flash-container .flash-message.flash-danger .flash-progress,.flash-container .flash-message.flash-error .flash-progress{background-color:rgba(255,65,54,.15)}.flash-container .flash-message.flash-danger:before,.flash-container .flash-message.flash-error:before{background-color:#ff4136}.flash-container .flash-message.flash-danger:after,.flash-container .flash-message.flash-error:after{color:rgba(255,65,54,.5);content:"⚠"}.flash-container .flash-message.flash-info .flash-progress{background-color:rgba(0,116,217,.15)}.flash-container .flash-message.flash-info:before{background-color:#0074d9}.flash-container .flash-message.flash-info:after{color:rgba(0,116,217,.5);content:"ℹ"}.flash-container .flash-message.flash-bug .flash-progress{background-color:rgba(138,43,226,.15)}.flash-container .flash-message.flash-bug:before{background-color:#8a2be2}.flash-container .flash-message.flash-bug:after{color:rgba(138,43,226,.5);content:"❌"}.flash-container .flash-message.flash-disabled .flash-progress{background-color:hsla(0,0%,67%,.15)}.flash-container .flash-message.flash-disabled:before{background-color:#aaa}.flash-container .flash-message.flash-disabled:after{color:hsla(0,0%,67%,.5);content:"\F05E"}.flash-container .flash-message.flash-default{padding-right:20px}@media (max-width:1280px){.flash-container{max-width:33.334%}}@media (max-width:768px){.flash-container{max-width:50%}}@media (max-width:480px){.flash-container{right:10px;left:10px;max-width:100%}}.flash-container .flash-message.dark-theme{background-color:#2c3433;color:#fff}.flash-container .flash-message.dark-theme .flash-progress{background-color:hsla(0,0%,100%,.5)}
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>{{ delivery.name }}</h1>
|
<h1>{{ delivery.name }}</h1>
|
||||||
|
{% include "includes/delivery_progress.html" %}
|
||||||
|
|
||||||
<h4>{% if delivery.products %}
|
<h4>{% if delivery.products %}
|
||||||
{% include "includes/delivery_status.html" %}
|
{% include "includes/delivery_status.html" %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
10
copanier/templates/includes/delivery_progress.html
Normal file
10
copanier/templates/includes/delivery_progress.html
Normal file
|
@ -0,0 +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 {% 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>Distribution</li>
|
||||||
|
<li {% if delivery.status == delivery.CLOSED %}class="active"{% endif %}>Répartition des paiements</li>
|
||||||
|
</ul>
|
||||||
|
<div style="clear: both"></div>
|
|
@ -1,12 +1,18 @@
|
||||||
<table class="order">
|
<table class="order">
|
||||||
<tr><th class="product">Produit</th>{% if display_prices %}<th class="price">Prix unitaire</th>{% endif %}<th class="amount">Quantité</th></tr>
|
<tr><th class="product">Produit</th>{% if display_prices %}<th class="price">Prix unitaire (€)</th>{% endif %}<th class="amount">Quantité</th>{% if display_prices %}<th class="sum">Somme (€)</th>{% endif %}</tr>
|
||||||
{% for product in delivery.products %}
|
{% for product in delivery.products %}
|
||||||
{% if order[product].quantity %}
|
{% if order[product].quantity %}
|
||||||
<tr>
|
<tr {% if product.rupture %}class="rupture"{% endif %}>
|
||||||
<th class="product" style="text-align: left;">{{ product }}</th>
|
<th class="product" style="text-align: left;">{{ product }}{% if product.rupture %} (rupture){% endif %}</th>
|
||||||
{% if display_prices %}<td>{{ product.price | round(2) }} €</td>{% endif %}<td>{{ order[product].quantity }} x {{ product.unit }}</td>
|
{% if display_prices %}
|
||||||
|
<td>{{ product.price | round(2) }} €</td>
|
||||||
|
{% endif %}
|
||||||
|
<td>{{ order[product].quantity }} x {{ product.unit }}</td>
|
||||||
|
{% if display_prices %}
|
||||||
|
<td>{{ order.total([product], delivery, group_id, False) }}</td>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
<p>Total: {{ order.total(delivery.products, delivery, group_id) if order else 0 }} €</p>
|
<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>
|
||||||
|
|
Loading…
Reference in a new issue