diff --git a/kfet/static/kfet/css/kpsul.css b/kfet/static/kfet/css/kpsul.css index b15f6de8..9fd53604 100644 --- a/kfet/static/kfet/css/kpsul.css +++ b/kfet/static/kfet/css/kpsul.css @@ -319,6 +319,11 @@ input[type=number]::-webkit-outer-spin-button { padding-left:20px; } +#articles_data .article:hover { + background:rgba(200,16,46,0.3); + cursor:pointer; +} + /* Second part - Left - bottom */ .kpsul_middle_left_bottom { diff --git a/kfet/templates/kfet/kpsul.html b/kfet/templates/kfet/kpsul.html index d4a1b1b8..2278a6f7 100644 --- a/kfet/templates/kfet/kpsul.html +++ b/kfet/templates/kfet/kpsul.html @@ -685,6 +685,12 @@ $(document).ready(function() { return false; } + // A utiliser après la sélection d'un article + function goToArticleNb() { + articleNb.val('1'); + articleNb.focus().select(); + } + articleSelect.on('keydown', function(e) { var text = articleSelect.val(); // Comportement normal pour ces touches @@ -699,13 +705,28 @@ $(document).ready(function() { } return true; } - if (updateMatchedArticles(text+e.key)) { - articleNb.val('1'); - articleNb.focus().select(); - } + if (updateMatchedArticles(text+e.key)) + goToArticleNb(); return false; }); + function getArticleId($article) { + return $article.attr('id').split('-')[2]; + } + + function getArticleName($article) { + return $article.find('.name').text(); + } + + // Sélection des articles à la souris/tactile + articles_container.on('click', '.article', function() { + console.log('1'); + articleId.val(getArticleId($(this))); + articleSelect.val(getArticleName($(this))); + displayMatchedArticles(articlesList); + goToArticleNb(); + }); + function is_nb_ok(nb) { return /^[0-9]+$/.test(nb) && nb > 0 && nb <= 24; }