Ajout de boutons raccourcis pour les comptes et les caisses

This commit is contained in:
Aurélien Delobelle 2016-08-19 02:56:45 +02:00
parent c6a24733f3
commit c12efee413
3 changed files with 32 additions and 2 deletions

View file

@ -85,6 +85,12 @@ input[type=number]::-webkit-outer-spin-button {
font-weight:bold;
}
#account .buttons {
position:absolute;
bottom:0;
right:0;
}
@media (min-width: 600px) {
#account_form input { font-size:60px; }
@ -151,6 +157,12 @@ input[type=number]::-webkit-outer-spin-button {
padding:0 15px;
}
#checkout_data .buttons {
position:absolute;
bottom:0;
right:0;
}
/*
* Second part
*/

View file

@ -36,6 +36,8 @@
<span id="account-promo"></span>
</div>
<div id="account-email" class="data_line"></div>
<div class="buttons">
</div>
</div>
</div>
</div>
@ -53,6 +55,8 @@
à <span id="checkout-last_statement_at"></span>
par <span id="checkout-last_statement_by_trigramme"></span>
</div>
<div class="buttons">
</div>
</div>
</div>
</div>
@ -139,11 +143,12 @@ $(document).ready(function() {
// -----
// Initializing
var account_container = $('#account');
var triInput = $('#id_trigramme')
var triPattern = /^[^a-z]{3}$/
var account_data = {}
var account_data_default = {
'pk' : 0,
'id' : 0,
'name' : '',
'email': '',
'is_cof' : '',
@ -178,6 +183,12 @@ $(document).ready(function() {
} else {
$('#account').attr('data-balance', 'neg');
}
var buttons = '';
if (account_data['id'] != 0) {
buttons += '<a href="/k-fet/accounts/'+account_data['trigramme']+'" class="btn btn-primary" target="_blank" title="Modifier"><span class="glyphicon glyphicon-cog"></span></a>';
}
account_container.find('.buttons').html(buttons);
}
// Clear data
@ -233,6 +244,7 @@ $(document).ready(function() {
// -----
// Initializing
var checkout_container = $('#checkout');
var checkoutInput = $('#id_checkout_select');
var checkout_data = {}
var checkout_data_default = {
@ -253,6 +265,12 @@ $(document).ready(function() {
for (var elem in checkout_data) {
$('#checkout-'+elem).text(checkout_data[elem]);
}
var buttons = '';
if (checkout_data['id'] !== 0) {
buttons += '<a class="btn btn-primary" href="/k-fet/checkouts/'+checkout_data['id']+'/statements/add" title="Effectuer un relevé" target="_blank"><span class="glyphicon glyphicon-euro"></span></a>';
buttons += '<a class="btn btn-primary" href="/k-fet/checkouts/'+checkout_data['id']+'" title="Modifier" target="_blank"><span class="glyphicon glyphicon-cog"></span></a>';
}
checkout_container.find('.buttons').html(buttons);
}
// Clear data

View file

@ -414,7 +414,7 @@ def kpsul(request):
def kpsul_account_data(request):
trigramme = request.POST.get('trigramme', '')
account = get_object_or_404(Account, trigramme=trigramme)
data = { 'pk': account.pk, 'name': account.name, 'email': account.email,
data = { 'id': account.pk, 'name': account.name, 'email': account.email,
'is_cof': account.is_cof, 'promo': account.promo,
'balance': account.balance, 'is_frozen': account.is_frozen,
'departement': account.departement, 'nickname': account.nickname,