mirror of
https://github.com/almet/copanier.git
synced 2025-04-28 19:42:37 +02:00
Display user order info on home page (total + unpaid)
This commit is contained in:
parent
132884385e
commit
2aeceeca3c
4 changed files with 53 additions and 40 deletions
|
@ -290,3 +290,8 @@ class Delivery(Base):
|
||||||
|
|
||||||
def has_order(self, person):
|
def has_order(self, person):
|
||||||
return person.email in self.orders
|
return person.email in self.orders
|
||||||
|
|
||||||
|
def total_for(self, person):
|
||||||
|
if person.email not in self.orders:
|
||||||
|
return 0
|
||||||
|
return self.orders[person.email].total(self.products)
|
||||||
|
|
|
@ -1,23 +1,14 @@
|
||||||
:root {
|
:root {
|
||||||
--primary-color: #0062b7;
|
--primary-color: #0062b7;
|
||||||
--primary-color-light: #e6f0fa;
|
--link-color: #00d1b2;
|
||||||
--secondary-color: #e10055;
|
|
||||||
--text-color: #414664;
|
--text-color: #414664;
|
||||||
--border-color: #e6e6eb;
|
--light-text-color: #fafafb;
|
||||||
--primary-background-color: #fff;
|
--background-color: #fafafb;
|
||||||
--secondary-background-color: #fafafb;
|
--flag-color: #A87CA0;
|
||||||
--disease: #7846af;
|
--warning-color: #FFA631;
|
||||||
--disease-light: #f5ebfa;
|
--danger-color: #d9534f;
|
||||||
--country: #0f8796;
|
--neutral-color: #4D8FAC;
|
||||||
--country-light: #e6f5f5;
|
--success-color: #0f8796;
|
||||||
--group: #d03800;
|
|
||||||
--group-light: #fff5eb;
|
|
||||||
--keyword: #8c5a2d;
|
|
||||||
--keyword-light: #f5f0eb;
|
|
||||||
--kind: #cd0073;
|
|
||||||
--kind-light: #faf0f5;
|
|
||||||
--ern: #32009b;
|
|
||||||
--ern-light: #ebebf5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +94,7 @@ body {
|
||||||
font-size: .8rem;
|
font-size: .8rem;
|
||||||
font-family: 'Work Sans', sans-serif;
|
font-family: 'Work Sans', sans-serif;
|
||||||
text-rendering: optimizeLegibility;
|
text-rendering: optimizeLegibility;
|
||||||
background-color: var(--secondary-background-color);
|
background-color: var(--background-color);
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +104,6 @@ h3,
|
||||||
h4,
|
h4,
|
||||||
h5,
|
h5,
|
||||||
legend {
|
legend {
|
||||||
/*margin: 0;*/
|
|
||||||
color: #444;
|
color: #444;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
|
@ -125,7 +115,7 @@ h3 { font-size: 1.4rem }
|
||||||
h4 { font-size: 1.1rem }
|
h4 { font-size: 1.1rem }
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #00d1b2;
|
color: var(--link-color);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
-webkit-transition: none 86ms ease-out;
|
-webkit-transition: none 86ms ease-out;
|
||||||
|
@ -165,6 +155,7 @@ main {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flag,
|
||||||
button,
|
button,
|
||||||
a.button,
|
a.button,
|
||||||
input[type=submit] {
|
input[type=submit] {
|
||||||
|
@ -196,7 +187,7 @@ input[type=submit] + a.button {
|
||||||
|
|
||||||
input[type=submit]:hover,
|
input[type=submit]:hover,
|
||||||
.button:hover {
|
.button:hover {
|
||||||
color: #fff;
|
color: var(--light-text-color);
|
||||||
background-color: var(--primary-color);
|
background-color: var(--primary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,29 +195,40 @@ input[type=submit]:hover,
|
||||||
button.primary,
|
button.primary,
|
||||||
a.button.primary,
|
a.button.primary,
|
||||||
input[type=submit].primary {
|
input[type=submit].primary {
|
||||||
color: #fff;
|
color: var(--background-color);
|
||||||
background: var(--primary-color);
|
background: var(--primary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
button.primary:hover,
|
button.primary:hover,
|
||||||
a.button.primary:hover,
|
a.button.primary:hover,
|
||||||
input[type=submit].primary:hover {
|
input[type=submit].primary:hover {
|
||||||
background-color: #fff;
|
background-color: var(--background-color);
|
||||||
color: var(--primary-color);
|
color: var(--primary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
button.danger,
|
button.danger,
|
||||||
a.button.danger,
|
a.button.danger,
|
||||||
input[type=submit].danger {
|
input[type=submit].danger {
|
||||||
color: #d9534f;
|
color: var(--danger-color);
|
||||||
border-color: #d9534f;
|
border-color: var(--danger-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
button.danger:hover,
|
button.danger:hover,
|
||||||
a.button.danger:hover,
|
a.button.danger:hover,
|
||||||
input[type=submit].danger:hover {
|
input[type=submit].danger:hover {
|
||||||
background-color: #d9534f;
|
background-color: var(--danger-color);
|
||||||
color: #fff;
|
color: var(--light-text-color);
|
||||||
|
}
|
||||||
|
.flag {
|
||||||
|
border-color: var(--flag-color);
|
||||||
|
color: var(--light-text-color);
|
||||||
|
background-color: var(--flag-color);
|
||||||
|
cursor: help;
|
||||||
|
}
|
||||||
|
.flag.warning {
|
||||||
|
background-color: var(--warning-color);
|
||||||
|
border-color: var(--warning-color);
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -247,10 +249,10 @@ textarea {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 2rem;
|
height: 2rem;
|
||||||
padding: .4rem .8rem;
|
padding: .4rem .8rem;
|
||||||
color: #50596c;
|
color: var(--text-color);
|
||||||
font-size: .8rem;
|
font-size: .8rem;
|
||||||
line-height: 1rem;
|
line-height: 1rem;
|
||||||
background-color: #fff;
|
background-color: var(--background-color);
|
||||||
border: .05rem solid #bbc;
|
border: .05rem solid #bbc;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
@ -354,10 +356,10 @@ tr:nth-child(even) {
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
}
|
}
|
||||||
thead tr {
|
thead tr {
|
||||||
background-color: #3498db;
|
background-color: var(--neutral-color);
|
||||||
}
|
}
|
||||||
thead tr * {
|
thead tr * {
|
||||||
color: #f1f1f1;
|
color: var(--light-text-color);
|
||||||
}
|
}
|
||||||
thead th + th {
|
thead th + th {
|
||||||
border-left: 1px solid white;
|
border-left: 1px solid white;
|
||||||
|
@ -387,11 +389,11 @@ article.delivery th.person {
|
||||||
}
|
}
|
||||||
td.missing,
|
td.missing,
|
||||||
th.missing {
|
th.missing {
|
||||||
background-color: #db7734;
|
background-color: var(--warning-color);
|
||||||
}
|
}
|
||||||
.missing a {
|
.missing a {
|
||||||
color: #f1f1f1;
|
color: var(--light-text-color);
|
||||||
border-color: #f1f1f1;
|
border-color: var(--light-text-color);
|
||||||
height: 1rem;
|
height: 1rem;
|
||||||
}
|
}
|
||||||
hr {
|
hr {
|
||||||
|
@ -427,26 +429,26 @@ hr {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
.notification.success {
|
.notification.success {
|
||||||
background-color: #0f8796;
|
background-color: var(--success-color);
|
||||||
}
|
}
|
||||||
.notification.error {
|
.notification.error {
|
||||||
background-color: #e10055;
|
background-color: var(--danger-color);
|
||||||
}
|
}
|
||||||
.notification.warning {
|
.notification.warning {
|
||||||
background-color: #f9b42d;
|
background-color: var(--warning-color);
|
||||||
}
|
}
|
||||||
.notification i {
|
.notification i {
|
||||||
font-size: 2rem;
|
font-size: 2rem;
|
||||||
}
|
}
|
||||||
.not-paid {
|
.not-paid {
|
||||||
background-color: #db7734;
|
background-color: var(--warning-color);
|
||||||
}
|
}
|
||||||
.toggle {
|
.toggle {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.toggle-label {
|
.toggle-label {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: #00d1b2;
|
color: var(--link-color);
|
||||||
}
|
}
|
||||||
.toggle-container {
|
.toggle-container {
|
||||||
display: none;
|
display: none;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<li><i class="icon-streetsign"></i> <strong>Lieu</strong> {{ delivery.where }}</li>
|
<li><i class="icon-streetsign"></i> <strong>Lieu</strong> {{ delivery.where }}</li>
|
||||||
<li><i class="icon-strategy"></i> <strong>Référent</strong> <a href="mailto:{{ delivery.contact }}">{{ delivery.contact }}</a></li>
|
<li><i class="icon-strategy"></i> <strong>Référent</strong> <a href="mailto:{{ delivery.contact }}">{{ delivery.contact }}</a></li>
|
||||||
<li><i class="icon-clock"></i> <strong>Date de livraison</strong> <time datetime="{{ delivery.from_date }}">{{ delivery.from_date|date }} de {{ delivery.from_date|time }} à {{ delivery.to_date|time }}</time></li>
|
<li><i class="icon-clock"></i> <strong>Date de livraison</strong> <time datetime="{{ delivery.from_date }}">{{ delivery.from_date|date }} de {{ delivery.from_date|time }} à {{ delivery.to_date|time }}</time></li>
|
||||||
<li><i class="icon-hourglass"></i> {% if delivery.status == delivery.OPEN %}<strong>Date limite de commande</strong> <time datetime="{{ delivery.order_before.date() }}">{{ delivery.order_before|date }}</time>{% elif delivery.status == delivery.ADJUSTMENT %}<strong>Ajustement en cours</strong>{% elif delivery.status == delivery.CLOSED %}<strong>{% if delivery.is_foreseen %}Fermée{% else %}À solder{% endif %}</strong>{% else %}<strong>Archivée</strong>{% endif %}</li>
|
<li><i class="icon-hourglass"></i> {% if delivery.status == delivery.OPEN %}<strong>Date limite de commande</strong> <time datetime="{{ delivery.order_before.date() }}">{{ delivery.order_before|date }}</time>{% elif delivery.status == delivery.ADJUSTMENT %}<strong>Ajustement en cours</strong>{% elif delivery.status == delivery.CLOSED %}<strong>{% if delivery.is_foreseen %}Fermée{% else %}Solde en cours{% endif %}</strong>{% else %}<strong>Archivée</strong>{% endif %}</li>
|
||||||
{% if delivery.instructions %}<li><i class="icon-lightbulb"></i> <strong>À savoir</strong> {{ delivery.instructions }}</li>{% endif %}
|
{% 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 %}
|
{% 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>
|
||||||
|
|
|
@ -7,3 +7,9 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if request.user.email in delivery.orders %}
|
||||||
|
<span class="flag" title="Mon solde"><i class="icon-wallet"></i> {{ delivery.total_for(request.user) }} €</span>
|
||||||
|
{% if delivery.status == delivery.CLOSED and delivery.is_passed and not delivery.orders[request.user.email].paid %}
|
||||||
|
<span class="flag warning" title="Ma commande n'est pas marquée comme soldée"><i class="icon-caution"></i> Commande à solder</span>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue