Option sur les reset K-Psul pour donner le focus ou non à input

trigramme
This commit is contained in:
Aurélien Delobelle 2016-08-17 11:51:44 +02:00
parent a5e571de97
commit a9cec3a920
2 changed files with 5 additions and 8 deletions

View file

@ -769,7 +769,7 @@ $(document).ready(function() {
// Reset functions // Reset functions
function coolReset() { function coolReset(give_tri_focus=true) {
resetAccountData(); resetAccountData();
articleId.val(0); articleId.val(0);
articleSelect.val(''); articleSelect.val('');
@ -777,16 +777,17 @@ $(document).ready(function() {
displayMatchedArticles(articlesList); displayMatchedArticles(articlesList);
triInput.val(''); triInput.val('');
resetBasket(); resetBasket();
if (give_tri_focus)
triInput.focus();
} }
function hardReset() { function hardReset(give_tri_focus=true) {
coolReset(); coolReset(give_tri_focus);
articles_container.find('tr').remove(); articles_container.find('tr').remove();
articlesList = []; articlesList = [];
resetCheckoutData(); resetCheckoutData();
getArticlesData(); getArticlesData();
getHistory(); getHistory();
} }
// Shorcuts // Shorcuts
@ -796,7 +797,6 @@ $(document).ready(function() {
case 112: case 112:
// F1 - Cool reset // F1 - Cool reset
coolReset(); coolReset();
triInput.focus();
return false; return false;
case 113: case 113:
// F2 - Deposit // F2 - Deposit
@ -809,7 +809,6 @@ $(document).ready(function() {
case 121: case 121:
// F10 - Hard reset // F10 - Hard reset
hardReset(); hardReset();
triInput.focus();
return false; return false;
} }
}); });
@ -819,7 +818,6 @@ $(document).ready(function() {
// ----- // -----
hardReset(); hardReset();
triInput.focus();
}); });
</script> </script>

View file

@ -408,7 +408,6 @@ def kpsul(request):
data['checkout_form'] = KPsulCheckoutForm() data['checkout_form'] = KPsulCheckoutForm()
operation_formset = KPsulOperationFormSet(queryset=Operation.objects.none()) operation_formset = KPsulOperationFormSet(queryset=Operation.objects.none())
data['operation_formset'] = operation_formset data['operation_formset'] = operation_formset
print(operation_formset.empty_form)
return render(request, 'kfet/kpsul.html', data) return render(request, 'kfet/kpsul.html', data)
@permission_required('kfet.is_team') @permission_required('kfet.is_team')