add stock to article selection

This commit is contained in:
Ludovic Stephan 2016-12-13 22:31:52 -02:00
parent 71fee9bf8a
commit b7ebf4ee1c
2 changed files with 27 additions and 6 deletions

View file

@ -8,7 +8,7 @@ input[type=number]::-webkit-outer-spin-button {
margin: 0;
}
#account, #checkout, input, #history, #basket, #basket_rel, #articles_data {
#account, #checkout, #article_selection, #history, #basket, #basket_rel, #articles_data {
background:#fff;
}
@ -252,7 +252,7 @@ input[type=number]::-webkit-outer-spin-button {
width:100%;
}
#article_selection input {
#article_selection input, #article_selection span {
height:100%;
float:left;
border:0;
@ -263,12 +263,12 @@ input[type=number]::-webkit-outer-spin-button {
font-weight:bold;
}
#article_selection input+input {
#article_selection input+input #article_selection input+span {
border-right:0;
}
#article_autocomplete {
width:90%;
width:80%;
padding-left:10px;
}
@ -277,14 +277,24 @@ input[type=number]::-webkit-outer-spin-button {
text-align:center;
}
#article_stock {
width:10%;
line-height:38px;
text-align:center;
}
@media (min-width:1200px) {
#article_autocomplete {
width:92%
width:84%
}
#article_number {
width:8%;
}
#article_stock {
width:8%;
}
}
/* Article data */
@ -319,6 +329,10 @@ input[type=number]::-webkit-outer-spin-button {
padding-left:20px;
}
#articles_data .article.low-stock {
background:rgba(236,100,0,0.3);
}
#articles_data .article:hover {
background:rgba(200,16,46,0.3);
cursor:pointer;
@ -379,7 +393,7 @@ input[type=number]::-webkit-outer-spin-button {
}
#basket tr.low-stock {
background-color:rgba(236,100,0,0.4);
background-color:rgba(236,100,0,0.3);
}
#basket tr.ui-selected, #basket tr.ui-selecting {

View file

@ -122,6 +122,7 @@
<div id="article_selection">
<input type="text" id="article_autocomplete" autocomplete="off">
<input type="number" id="article_number" step="1" min="1">
<span type="stock" id="article_stock"></span>
<input type="hidden" id="article_id" value="">
</div>
<div id="articles_data">
@ -563,6 +564,9 @@ $(document).ready(function() {
for (var elem in article) {
article_html.find('.'+elem).text(article[elem])
}
if (-5 <= article['stock'] && article['stock'] <= 5) {
article_html.addClass('low-stock');
}
article_html.find('.price').text(amountToUKF(article['price'], false)+' UKF');
var category_html = articles_container
.find('#data-category-'+article['category_id']);
@ -617,6 +621,7 @@ $(document).ready(function() {
var articleSelect = $('#article_autocomplete');
var articleId = $('#article_id');
var articleNb = $('#article_number');
var articleStock = $('#article_stock');
// 8:Backspace|9:Tab|13:Enter|38-40:Arrows|46:DEL|112-117:F1-6|119-123:F8-F12
var normalKeys = /^(8|9|13|37|38|39|40|46|112|113|114|115|116|117|119|120|121|122|123)$/;
var articlesList = [];
@ -674,6 +679,7 @@ $(document).ready(function() {
if (commit) {
articleId.val(articlesMatch[0][1]);
articleSelect.val(articlesMatch[0][0]);
articleStock.text('/'+articlesMatch[0][4]);
displayMatchedArticles(articlesList);
return true;
}
@ -954,6 +960,7 @@ $(document).ready(function() {
articleId.val(0);
articleSelect.val('');
articleNb.val('');
articleStock.text('');
displayMatchedArticles(articlesList);
}