Commit 4950aec7 by Damien Moulard

ES: afficher la date d'encaissement des enveloppes

parent 1e561340
Pipeline #2111 passed with stage
in 1 minute 28 seconds
...@@ -132,6 +132,7 @@ class CagetteEnvelops(models.Model): ...@@ -132,6 +132,7 @@ class CagetteEnvelops(models.Model):
def archive_envelop(self, envelop): def archive_envelop(self, envelop):
envelop['archive'] = True envelop['archive'] = True
envelop['cashing_date'] = datetime.date.today().strftime("%d/%m/%Y")
return self.c_db.dbc.update([envelop]) return self.c_db.dbc.update([envelop])
def generate_envelop_display_id(self): def generate_envelop_display_id(self):
......
...@@ -96,8 +96,18 @@ function set_envelop_dom(envelop, envelop_name, envelop_content_id, envelop_inde ...@@ -96,8 +96,18 @@ function set_envelop_dom(envelop, envelop_name, envelop_content_id, envelop_inde
if ((envelop.type == 'cash' || envelop.type == 'ch' && envelop_index == 0) && !envelop.archive) { if ((envelop.type == 'cash' || envelop.type == 'ch' && envelop_index == 0) && !envelop.archive) {
new_html += '<button class="accordion w80">' + envelop_name + ' - <i>' + total_amount + '€</i></button>' new_html += '<button class="accordion w80">' + envelop_name + ' - <i>' + total_amount + '€</i></button>'
+ '<button class="btn--success archive_button item-fluid" onClick="openModal(\'<h3>Êtes-vous sûr ?</h3>\', function() {archive_envelop(\'' + envelop.type + '\', ' + envelop_index + ');}, \'Encaisser\', false)">Encaisser</button>'; + '<button class="btn--success archive_button item-fluid" onClick="openModal(\'<h3>Êtes-vous sûr ?</h3>\', function() {archive_envelop(\'' + envelop.type + '\', ' + envelop_index + ');}, \'Encaisser\', false)">Encaisser</button>';
} else if (envelop.archive && envelop.canceled) { } else if (envelop.archive ===true) {
new_html += '<button class="accordion w100">' + envelop_name + ' - <i>' + total_amount + '€ (Enveloppe supprimée) </i></button>'; new_html += '<button class="accordion w100">' + envelop_name + ' - <i>' + total_amount + '€';
if (envelop.cashing_date !== undefined) {
new_html += ' - Encaissée le ' + envelop.cashing_date;
}
if (envelop.canceled) {
new_html += ' - Enveloppe supprimée';
}
new_html += '</i></button>';
} else { } else {
new_html += '<button class="accordion w100">' + envelop_name + ' - <i>' + total_amount + '€</i></button>'; new_html += '<button class="accordion w100">' + envelop_name + ' - <i>' + total_amount + '€</i></button>';
} }
......
...@@ -21,7 +21,7 @@ def index(request): ...@@ -21,7 +21,7 @@ def index(request):
return HttpResponse(template.render(context, request)) return HttpResponse(template.render(context, request))
def archive_envelop(request): def archive_envelop(request):
"""Save members payment and destroy the envelop""" """Save members payment and archive the envelop"""
m = CagetteEnvelops() m = CagetteEnvelops()
res_payments = [] res_payments = []
res_envelop = "" res_envelop = ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment