diff --git a/copanier/models.py b/copanier/models.py index f01f184..bd4bdaf 100644 --- a/copanier/models.py +++ b/copanier/models.py @@ -293,12 +293,15 @@ class Order(Base): p.quantity * _get_price(ref) for ref, p in self.products.items() ) - total_shipping = 0 - if include_shipping: - for producer in producers: - total_shipping = total_shipping + delivery.shipping_for(email, producer) + shipping = self.compute_shipping(delivery, producers, email) if include_shipping else 0 - return round(total_products + total_shipping, 2) + return round(total_products + shipping, 2) + + def compute_shipping(self, delivery, producers, email): + total_shipping = 0 + for producer in producers: + total_shipping = total_shipping + delivery.shipping_for(email, producer) + return total_shipping @property def has_adjustments(self): @@ -315,6 +318,7 @@ class Delivery(PersistedBase): NEED_PRICE_UPDATE = 1 OPEN = 2 ADJUSTMENT = 3 + WAITING_PRODUCTS = 4 name: str from_date: datetime_field @@ -343,6 +347,9 @@ class Delivery(PersistedBase): return self.OPEN if self.needs_adjustment: return self.ADJUSTMENT + if self.is_waiting_products: + return self.WAITING_PRODUCTS + return self.CLOSED def products_need_price_update(self, products=None): @@ -375,6 +382,15 @@ class Delivery(PersistedBase): @property def is_open(self): 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 def is_foreseen(self): diff --git a/copanier/static/app.css b/copanier/static/app.css index 18fce1c..c0f4cd2 100644 --- a/copanier/static/app.css +++ b/copanier/static/app.css @@ -566,7 +566,8 @@ details summary { } .rupture { - background-color: #ff000083; + background-color: #ff000083 !important; + text-decoration: line-through; } .list-emails { @@ -728,4 +729,59 @@ small { .header { 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; } \ No newline at end of file diff --git a/copanier/static/flash.min.css b/copanier/static/flash.min.css index f8fcdac..1564cba 100644 --- a/copanier/static/flash.min.css +++ b/copanier/static/flash.min.css @@ -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)} \ No newline at end of file +.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)} \ No newline at end of file diff --git a/copanier/templates/delivery/show_delivery.html b/copanier/templates/delivery/show_delivery.html index 94fb77f..7c9c2fd 100644 --- a/copanier/templates/delivery/show_delivery.html +++ b/copanier/templates/delivery/show_delivery.html @@ -4,6 +4,8 @@
Produit | {% if display_prices %}Prix unitaire | {% endif %}Quantité | |
---|---|---|---|
Produit | {% if display_prices %}Prix unitaire (€) | {% endif %}Quantité | {% if display_prices %}Somme (€) | {% endif %}
{{ product }} | - {% if display_prices %}{{ product.price | round(2) }} € | {% endif %}{{ order[product].quantity }} x {{ product.unit }} | +|
{{ product }}{% if product.rupture %} (rupture){% endif %} | + {% if display_prices %} +{{ product.price | round(2) }} € | + {% endif %} +{{ order[product].quantity }} x {{ product.unit }} | + {% if display_prices %} +{{ order.total([product], delivery, group_id, False) }} | + {% endif %}
Total: {{ order.total(delivery.products, delivery, group_id) if order else 0 }} €
+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)