Merge branch 'k-fet' of git.eleves.ens.fr:cof-geek/gestioCOF into Aufinal/search_icon

This commit is contained in:
Ludovic Stephan 2016-12-09 00:44:07 -02:00
commit 4453b504da
4 changed files with 53 additions and 7 deletions

View file

@ -64,3 +64,22 @@
color:#FFF !important; color:#FFF !important;
background:#C8102E !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;
}

View file

@ -88,7 +88,7 @@ function getErrorsHtml(data) {
function requestAuth(data, callback, focus_next = null) { function requestAuth(data, callback, focus_next = null) {
var content = getErrorsHtml(data); var content = getErrorsHtml(data);
content += '<input type="password" name="password" autofocus>', content += '<div class="capslock"><span class="glyphicon glyphicon-lock"></span><input type="password" name="password" autofocus><div>',
$.confirm({ $.confirm({
title: 'Authentification requise', title: 'Authentification requise',
content: content, content: content,
@ -102,14 +102,39 @@ function requestAuth(data, callback, focus_next = null) {
}, },
onOpen: function() { onOpen: function() {
var that = this; var that = this;
var capslock = -1 ; // 1 -> caps on ; 0 -> caps off ; -1 or 2 -> unknown
this.$content.find('input').on('keypress', function(e) { this.$content.find('input').on('keypress', function(e) {
if (e.keyCode == 13) if (e.keyCode == 13)
that.$confirmButton.click(); 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() { onClose: function() {
if (focus_next) if (focus_next)
this._lastFocused = focus_next; this._lastFocused = focus_next;
} }
}); });
} }

View file

@ -114,10 +114,10 @@
<div class="kpsul_middle_left"> <div class="kpsul_middle_left">
<div class="kpsul_middle_left_top"> <div class="kpsul_middle_left_top">
<div id="special_operations"> <div id="special_operations">
<button role="button" class="btn" id="operation_deposit">Charge</button> <button role="button" class="btn" id="operation_deposit">Charge (F3)</button>
<button role="button" class="btn" id="operation_withdraw">Retrait</button> <button role="button" class="btn" id="operation_withdraw">Retrait (Shift+F3)</button>
<button role="button" class="btn" id="cool_reset">RAZ</button> <button role="button" class="btn" id="cool_reset">RAZ (F1)</button>
<button role="button" class="btn" id="ask_addcost">Major.</button> <button role="button" class="btn" id="ask_addcost">Major. (F9)</button>
</div> </div>
<div id="article_selection"> <div id="article_selection">
<input type="text" id="article_autocomplete" autocomplete="off"> <input type="text" id="article_autocomplete" autocomplete="off">

View file

@ -490,7 +490,8 @@ class AccountGroupUpdate(UpdateView):
class AccountNegativeList(ListView): class AccountNegativeList(ListView):
queryset = (AccountNegative.objects 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' template_name = 'kfet/account_negative.html'
context_object_name = 'negatives' context_object_name = 'negatives'
@ -501,12 +502,13 @@ class AccountNegativeList(ListView):
'overdraft_duration': Settings.OVERDRAFT_DURATION(), 'overdraft_duration': Settings.OVERDRAFT_DURATION(),
} }
negs_sum = (AccountNegative.objects negs_sum = (AccountNegative.objects
.exclude(account__trigramme='#13')
.aggregate( .aggregate(
bal = Coalesce(Sum('account__balance'),0), bal = Coalesce(Sum('account__balance'),0),
offset = Coalesce(Sum('balance_offset'),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 return context
# ----- # -----