use arrow keys to add/remove article
This commit is contained in:
parent
437233fd10
commit
9443f86298
|
@ -617,8 +617,8 @@ $(document).ready(function() {
|
||||||
var articleSelect = $('#article_autocomplete');
|
var articleSelect = $('#article_autocomplete');
|
||||||
var articleId = $('#article_id');
|
var articleId = $('#article_id');
|
||||||
var articleNb = $('#article_number');
|
var articleNb = $('#article_number');
|
||||||
// 8:Backspace|9:Tab|13:Enter|46:DEL|112-117:F1-6|119-123:F8-F12
|
// 8:Backspace|9:Tab|13:Enter|38-40:Arrows|46:DEL|112-117:F1-6|119-123:F8-F12
|
||||||
var normalKeys = /^(8|9|13|46|112|113|114|115|116|117|119|120|121|122|123)$/;
|
var normalKeys = /^(8|9|13|37|38|39|40|46|112|113|114|115|116|117|119|120|121|122|123)$/;
|
||||||
var articlesList = [];
|
var articlesList = [];
|
||||||
|
|
||||||
function deleteNonMatching(array, str) {
|
function deleteNonMatching(array, str) {
|
||||||
|
@ -818,11 +818,25 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
$(document).on('keydown', function (e) {
|
$(document).on('keydown', function (e) {
|
||||||
if (e.keyCode == 46) {
|
switch(e.which) {
|
||||||
|
case 46:
|
||||||
// DEL (Suppr)
|
// DEL (Suppr)
|
||||||
basket_container.find('.ui-selected').each(function () {
|
basket_container.find('.ui-selected').each(function () {
|
||||||
deleteFromBasket($(this).data('opeindex'));
|
deleteFromBasket($(this).data('opeindex'));
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
|
case 38:
|
||||||
|
// Arrow up
|
||||||
|
basket_container.find('.ui-selected').each(function () {
|
||||||
|
addExistingPurchase($(this).data('opeindex'), 1);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 40:
|
||||||
|
// Arrow down
|
||||||
|
basket_container.find('.ui-selected').each(function () {
|
||||||
|
addExistingPurchase($(this).data('opeindex'), -1);
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue