From c12efee413bf2bf1dfb83fad48dee90ca2bd5579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Fri, 19 Aug 2016 02:56:45 +0200 Subject: [PATCH] Ajout de boutons raccourcis pour les comptes et les caisses --- kfet/static/kfet/css/kpsul.css | 12 ++++++++++++ kfet/templates/kfet/kpsul.html | 20 +++++++++++++++++++- kfet/views.py | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/kfet/static/kfet/css/kpsul.css b/kfet/static/kfet/css/kpsul.css index 83994683..387a7168 100644 --- a/kfet/static/kfet/css/kpsul.css +++ b/kfet/static/kfet/css/kpsul.css @@ -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 */ diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index 628641ef..3113a6ef 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -36,6 +36,8 @@
+
+
@@ -53,6 +55,8 @@ à par +
+
@@ -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 += ''; + } + 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 += ''; + buttons += ''; + } + checkout_container.find('.buttons').html(buttons); } // Clear data diff --git a/kfet/views.py b/kfet/views.py index 49d4dc8a..59985f4c 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -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,