diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js index 7048d121..f870b4cc 100644 --- a/kfet/static/kfet/js/history.js +++ b/kfet/static/kfet/js/history.js @@ -129,6 +129,7 @@ function KHistory(options={}) { if (!this.display_trigramme) $opegroup_html.find('.trigramme').remove(); + $opegroup_html.find('.info').remove(); if (opegroup['valid_by__trigramme']) $opegroup_html.find('.valid_by').text('Par '+opegroup['valid_by__trigramme']); diff --git a/kfet/templates/kfet/transfers.html b/kfet/templates/kfet/transfers.html index cbdf0fe3..0ba0c85e 100644 --- a/kfet/templates/kfet/transfers.html +++ b/kfet/templates/kfet/transfers.html @@ -6,7 +6,11 @@ + + + + {% endblock %} {% block title %}Transferts{% endblock %} @@ -31,22 +35,7 @@

Liste des transferts

-
- {% for transfergroup in transfergroups %} -
- {{ transfergroup.at }} - {{ transfergroup.valid_by.trigramme }} - {{ transfergroup.comment }} -
- {% for transfer in transfergroup.transfers.all %} -
- {{ transfer.amount }} € - {{ transfer.from_acc.trigramme }} - - {{ transfer.to_acc.trigramme }} -
- {% endfor %} - {% endfor %} +
@@ -70,15 +59,80 @@ $(document).ready(function() { }); } + khistory = new KHistory({ + display_trigramme: false, + }); + + function getHistory() { + var data = {'transfersonly': true}; - function cancelTransfers(transfers_array, password = '') { - if (lock == 1) - return false - lock = 1; - var data = { 'transfers' : transfers_array } $.ajax({ dataType: "json", - url : "{% url 'kfet.transfers.cancel' %}", + url : "{% url 'kfet.history.json' %}", + method : "POST", + data : data, + }) + .done(function(data) { + for (var i=0; i 0) + confirmCancel(opes_to_cancel); + } + }); + + function confirmCancel(opes_to_cancel) { + var nb = opes_to_cancel.length; + var content = nb+' opération'.pluralize(nb) + +' va'.pluralize(nb, ' vont') + + ' être' + + ' annulée'.pluralize(nb); + $.confirm({ + title: 'Confirmation', + content: content, + backgroundDismiss: true, + animation: 'top', + closeAnimation: 'bottom', + keyboardEnabled: true, + confirm: function() { + cancelOperations(opes_to_cancel); + } + }); + } + + function cancelOperations(opes_array, password = '') { + if (lock == 1) + return false + lock = 1 ; + var data = { 'operations' : opes_array } + $.ajax({ + dataType: "json", + url : "{% url 'kfet.kpsul.cancel_operations' %}", method : "POST", data : data, beforeSend: function ($xhr) { @@ -89,11 +143,7 @@ $(document).ready(function() { }) .done(function(data) { - for (var i=0; i 0) - cancelTransfers(transfers_to_cancel); - } - }); + getHistory(); });