diff --git a/kfet/static/kfet/css/history.css b/kfet/static/kfet/css/history.css index 64b82f96..fc6a46ad 100644 --- a/kfet/static/kfet/css/history.css +++ b/kfet/static/kfet/css/history.css @@ -40,7 +40,7 @@ width:90px; } -#history .opegroup .info { +#history .opegroup .infos { text-align:center; width:145px; } diff --git a/kfet/static/kfet/js/history.js b/kfet/static/kfet/js/history.js index f870b4cc..bde8b149 100644 --- a/kfet/static/kfet/js/history.js +++ b/kfet/static/kfet/js/history.js @@ -58,7 +58,7 @@ function KHistory(options={}) { var addcost_for = ope['addcost_for__trigramme']; if (addcost_for) { var addcost_amount = parseFloat(ope['addcost_amount']); - $ope_html.find('.addcost').text('('+amountDisplay(addcost_amount, is_cof)+'UKF pour '+addcost_for+')'); + $ope_html.find('.addcost').text('('+amountDisplay(addcost_amount, is_cof)+' UKF pour '+addcost_for+')'); } if (ope['canceled_at']) @@ -88,7 +88,7 @@ function KHistory(options={}) { this.cancelOpe = function(ope, $ope = null) { if (!$ope) - $ope = this.findOpe(ope['id']); + $ope = this.findOpe(ope['id'], ope['type']); var cancel = 'Annulé'; var canceled_at = dateUTCToParis(ope['canceled_at']); @@ -123,7 +123,7 @@ function KHistory(options={}) { .data('id', opegroup['id']) .find('.time').text(at).end() .find('.trigramme').text(trigramme).end() - .find('.info').text("Transferts").end() + .find('.infos').text("Transferts").end() .find('.amount').text(amount).end() .find('.comment').text(comment).end(); @@ -155,7 +155,7 @@ function KHistory(options={}) { }); } - this.findOpe = function(id, type) { + this.findOpe = function(id, type='ope') { return this.$container.find('.ope').filter(function() { return ($(this).data('id') == id && $(this).data('type') == type) }); @@ -175,7 +175,7 @@ KHistory.default_options = { container: '#history', template_day: '
', template_opegroup: '
', - template_transfergroup: '
', + template_transfergroup: '
', template_ope: '
', template_transfer: '
', display_trigramme: true, diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index fb59060b..a27d9069 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -1211,7 +1211,7 @@ $(document).ready(function() { // DEL (Suppr) var opes_to_cancel = []; khistory.$container.find('.ope.ui-selected').each(function () { - opes_to_cancel.push($(this).data('ope')); + opes_to_cancel.push($(this).data('type')+' '+$(this).data('id')); }); if (opes_to_cancel.length > 0) cancelOperations(opes_to_cancel); diff --git a/kfet/views.py b/kfet/views.py index b5ade6ae..5cec6eff 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -1053,6 +1053,7 @@ def kpsul_perform_operations(request): websocket_data = {} websocket_data['opegroups'] = [{ 'add': True, + 'type': 'opegroup', 'id': operationgroup.pk, 'amount': operationgroup.amount, 'checkout__name': operationgroup.checkout.name, @@ -1282,10 +1283,20 @@ def kpsul_cancel_operations(request): for ope in opes: websocket_data['opes'].append({ 'cancellation': True, + 'type': 'ope', 'id': ope, 'canceled_by__trigramme': canceled_by__trigramme, 'canceled_at': canceled_at, }) + for ope in transfers: + websocket_data['opes'].append({ + 'cancellation': True, + 'type': 'transfer', + 'id': ope, + 'canceled_by__trigramme': canceled_by__trigramme, + 'canceled_at': canceled_at, + }) + # Need refresh from db cause we used update on querysets checkouts_pk = [checkout.pk for checkout in to_checkouts_balances] checkouts = (Checkout.objects