diff --git a/kfet/templates/kfet/history.html b/kfet/templates/kfet/history.html index 01aaa359..97a0e413 100644 --- a/kfet/templates/kfet/history.html +++ b/kfet/templates/kfet/history.html @@ -62,6 +62,8 @@ $(document).ready(function() { settings = { 'subvention_cof': parseFloat({{ settings.subvention_cof|unlocalize }})} + lock = 0 ; + khistory = new KHistory(); var $from_date = $('#from_date'); @@ -166,7 +168,10 @@ $(document).ready(function() { function confirmCancel(opes_to_cancel) { var nb = opes_to_cancel.length; - var content = nb+" opérations vont être annulées"; + var content = nb+' opération'.pluralize(nb) + +' va'.pluralize(nb, ' vont') + + ' être' + + ' annulée'.pluralize(nb); $.confirm({ title: 'Confirmation', content: content, @@ -180,50 +185,10 @@ $(document).ready(function() { }); } - function requestAuth(data, callback) { - var content = getErrorsHtml(data); - content += '', - $.confirm({ - title: 'Authentification requise', - content: content, - backgroundDismiss: true, - animation:'top', - closeAnimation:'bottom', - keyboardEnabled: true, - confirm: function() { - var password = this.$content.find('input').val(); - callback(password); - }, - onOpen: function() { - var that = this; - this.$content.find('input').on('keypress', function(e) { - if (e.keyCode == 13) - that.$confirmButton.click(); - }); - }, - }); - } - - function getErrorsHtml(data) { - var content = ''; - if ('missing_perms' in data['errors']) { - content += 'Permissions manquantes'; - content += ''; - } - if ('negative' in data['errors']) { - var url_base = "{% url 'kfet.account.update' LIQ}"; - url_base = base_url(0, url_base.length-8); - for (var i=0; iAutorisation de négatif requise pour '+data['errors']['negative'][i]+''; - } - } - return content; - } - function cancelOperations(opes_array, password = '') { + if (lock == 1) + return false + lock = 1 ; var data = { 'operations' : opes_array } $.ajax({ dataType: "json", @@ -239,6 +204,7 @@ $(document).ready(function() { }) .done(function(data) { khistory.$container.find('.ui-selected').removeClass('ui-selected'); + lock = 0 ; }) .fail(function($xhr) { var data = $xhr.responseJSON; @@ -252,6 +218,7 @@ $(document).ready(function() { displayErrors(getErrorsHtml(data)); break; } + lock = 0 ; }); }