diff --git a/kfet/static/kfet/css/jconfirm-kfet.css b/kfet/static/kfet/css/jconfirm-kfet.css index 86c7c42b..4269fbcc 100644 --- a/kfet/static/kfet/css/jconfirm-kfet.css +++ b/kfet/static/kfet/css/jconfirm-kfet.css @@ -64,3 +64,22 @@ color:#FFF !important; background:#C8102E !important; } + +.jconfirm .capslock { + position: relative ; +} + +.jconfirm .capslock .glyphicon { + position: absolute; + padding: 10px; + right: 0px; + top: 15px; + font-size: 30px; + display: none ; + margin-left: 60px !important; +} + +.jconfirm .capslock input { + padding-right: 50px; + padding-left: 50px; +} diff --git a/kfet/static/kfet/js/kfet.js b/kfet/static/kfet/js/kfet.js index dbfba0b2..e3e5a6d9 100644 --- a/kfet/static/kfet/js/kfet.js +++ b/kfet/static/kfet/js/kfet.js @@ -88,7 +88,7 @@ function getErrorsHtml(data) { function requestAuth(data, callback, focus_next = null) { var content = getErrorsHtml(data); - content += '', + content += '
', $.confirm({ title: 'Authentification requise', content: content, @@ -102,14 +102,39 @@ function requestAuth(data, callback, focus_next = null) { }, onOpen: function() { var that = this; + var capslock = -1 ; // 1 -> caps on ; 0 -> caps off ; -1 or 2 -> unknown this.$content.find('input').on('keypress', function(e) { if (e.keyCode == 13) that.$confirmButton.click(); + + var s = String.fromCharCode(e.which); + if ((s.toUpperCase() === s && s.toLowerCase() !== s && !e.shiftKey)|| //caps on, shift off + (s.toUpperCase() !== s && s.toLowerCase() === s && e.shiftKey)) { //caps on, shift on + capslock = 1 ; + } else if ((s.toLowerCase() === s && s.toUpperCase() !== s && !e.shiftKey)|| //caps off, shift off + (s.toLowerCase() !== s && s.toUpperCase() === s && e.shiftKey)) { //caps off, shift on + capslock = 0 ; + } + if (capslock == 1) + $('.capslock .glyphicon').show() ; + else if (capslock == 0) + $('.capslock .glyphicon').hide() ; + }); + // Capslock key is not detected by keypress + this.$content.find('input').on('keydown', function(e) { + if (e.which == 20) { + capslock = 1-capslock ; + } + if (capslock == 1) + $('.capslock .glyphicon').show() ; + else if (capslock == 0) + $('.capslock .glyphicon').hide() ; }); }, onClose: function() { if (focus_next) this._lastFocused = focus_next; } + }); } diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 0eceebd2..88f8f2f9 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -48,11 +48,11 @@
F2
-
Reset compte
+
Reset panier
Shift + F2
-
Reset panier
+
Reset compte
F9
@@ -114,10 +114,10 @@
- - - - + + + +
@@ -245,12 +245,14 @@ $(document).ready(function() { if (account_data['id'] != 0) { var url_base = '{% url 'kfet.account.read' 'LIQ' %}'; url_base = url_base.substr(0, url_base.length - 3); - buttons += ''; + trigramme = encodeURIComponent(account_data['trigramme']) ; + buttons += ''; } if (account_data['id'] == 0) { var trigramme = triInput.val().toUpperCase(); var url_base = '{% url 'kfet.account.create' %}' if (isValidTrigramme(trigramme)) { + trigramme = encodeURIComponent(trigramme); buttons += ''; } } @@ -924,7 +926,7 @@ $(document).ready(function() { } }); }, - onClose: function() { this._lastFocused = articleSelect; } + onClose: function() { this._lastFocused = (articleSelect.val() ? articleNb : articleSelect) ; } }); } @@ -1250,13 +1252,13 @@ $(document).ready(function() { return false; case 113: if (e.shiftKey) { - // Shift+F2 - Basket reset - resetBasket(); - articleSelect.focus(); - } else { - // F2 - Account reset + // Shift+F2 - Account reset resetAccount(); triInput.focus(); + } else { + // F2 - Basket reset + resetBasket(); + articleSelect.focus(); } return false; case 114: diff --git a/kfet/templates/kfet/transfers_create.html b/kfet/templates/kfet/transfers_create.html index 294db1e5..83a09762 100644 --- a/kfet/templates/kfet/transfers_create.html +++ b/kfet/templates/kfet/transfers_create.html @@ -34,12 +34,12 @@ - + {{ form.from_acc }} {{ form.amount }} - + {{ form.to_acc }} @@ -71,18 +71,21 @@ $(document).ready(function () { var $next = $form.next('.transfer_form').find('.from_acc input'); } var $input_id = $input.next('input'); - getAccountData(trigramme, function(data) { - $input_id.val(data.id); - $data.text(data.name); - $next.focus(); - }); + if (isValidTrigramme(trigramme)) { + getAccountData(trigramme, function(data) { + $input_id.val(data.id); + $data.text(data.name); + $next.focus(); + }); + } else { + $input_id.val(''); + $data.text(''); + } } $('.input_from_acc, .input_to_acc').on('input', function() { var tri = $(this).val().toUpperCase(); - if (isValidTrigramme(tri)) { - updateAccountData(tri, $(this)); - } + updateAccountData(tri, $(this)); }); $('#transfers_form').on('submit', function(e) { diff --git a/kfet/views.py b/kfet/views.py index 1614a27b..848df767 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -493,7 +493,8 @@ class AccountGroupUpdate(UpdateView): class AccountNegativeList(ListView): queryset = (AccountNegative.objects - .select_related('account', 'account__cofprofile__user')) + .select_related('account', 'account__cofprofile__user') + .exclude(account__trigramme='#13')) template_name = 'kfet/account_negative.html' context_object_name = 'negatives' @@ -504,12 +505,13 @@ class AccountNegativeList(ListView): 'overdraft_duration': Settings.OVERDRAFT_DURATION(), } negs_sum = (AccountNegative.objects + .exclude(account__trigramme='#13') .aggregate( bal = Coalesce(Sum('account__balance'),0), offset = Coalesce(Sum('balance_offset'),0), ) ) - context['negatives_sum'] = negs_sum['bal'] + negs_sum['offset'] + context['negatives_sum'] = negs_sum['bal'] - negs_sum['offset'] return context # -----