WIP: Aureplop/kpsul js refactor #501

Draft
delobell wants to merge 215 commits from aureplop/kpsul_js_refactor into master
Showing only changes of commit b3b49d5768 - Show all commits

View file

@ -48,11 +48,11 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-3"><b>F2</b></div> <div class="col-xs-3"><b>F2</b></div>
<div class="col-xs-9">Reset compte</div> <div class="col-xs-9">Reset panier</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-3"><b>Shift + F2</b></div> <div class="col-xs-3"><b>Shift + F2</b></div>
<div class="col-xs-9">Reset panier</div> <div class="col-xs-9">Reset compte</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-3"><b>F9</b></div> <div class="col-xs-3"><b>F9</b></div>
@ -245,12 +245,14 @@ $(document).ready(function() {
if (account_data['id'] != 0) { if (account_data['id'] != 0) {
var url_base = '{% url 'kfet.account.read' 'LIQ' %}'; var url_base = '{% url 'kfet.account.read' 'LIQ' %}';
url_base = url_base.substr(0, url_base.length - 3); url_base = url_base.substr(0, url_base.length - 3);
buttons += '<a href="'+ url_base + account_data['trigramme']+'" class="btn btn-primary" target="_blank" title="Modifier"><span class="glyphicon glyphicon-cog"></span></a>'; trigramme = encodeURIComponent(account_data['trigramme']) ;
buttons += '<a href="'+ url_base + trigramme +'" class="btn btn-primary" target="_blank" title="Modifier"><span class="glyphicon glyphicon-cog"></span></a>';
} }
if (account_data['id'] == 0) { if (account_data['id'] == 0) {
var trigramme = triInput.val().toUpperCase(); var trigramme = triInput.val().toUpperCase();
var url_base = '{% url 'kfet.account.create' %}' var url_base = '{% url 'kfet.account.create' %}'
if (isValidTrigramme(trigramme)) { if (isValidTrigramme(trigramme)) {
trigramme = encodeURIComponent(trigramme);
buttons += '<a href="'+url_base+'?trigramme='+trigramme+'" class="btn btn-primary" target="_blank" title="Créer"><span class="glyphicon glyphicon-plus"></span></a>'; buttons += '<a href="'+url_base+'?trigramme='+trigramme+'" class="btn btn-primary" target="_blank" title="Créer"><span class="glyphicon glyphicon-plus"></span></a>';
} }
} }
@ -1250,13 +1252,13 @@ $(document).ready(function() {
return false; return false;
case 113: case 113:
if (e.shiftKey) { if (e.shiftKey) {
// Shift+F2 - Basket reset // Shift+F2 - Account reset
resetBasket();
articleSelect.focus();
} else {
// F2 - Account reset
resetAccount(); resetAccount();
triInput.focus(); triInput.focus();
} else {
// F2 - Basket reset
resetBasket();
articleSelect.focus();
} }
return false; return false;
case 114: case 114: