change stock warning CSS for basket

This commit is contained in:
Ludovic Stephan 2016-12-20 01:09:22 -02:00
parent 4db55efb67
commit 5784b4d20a
2 changed files with 15 additions and 7 deletions

View file

@ -392,8 +392,10 @@ input[type=number]::-webkit-outer-spin-button {
text-align:right;
}
#basket tr.low-stock {
background-color:rgba(236,100,0,0.3);
#basket tr .lowstock {
visibility:hidden;
width:20px;
padding-right:15px;
}
#basket tr.ui-selected, #basket tr.ui-selecting {

View file

@ -767,7 +767,7 @@ $(document).ready(function() {
// Basket
// -----
var item_basket_default_html = '<tr><td class="amount"></td><td class="number"></td><td class="name"></td></tr>';
var item_basket_default_html = '<tr><td class="amount"></td><td class="number"></td><td class="lowstock"><span class="glyphicon glyphicon-alert"></span></td><td class="name"></td></tr>';
var basket_container = $('#basket table');
var arrowKeys = /^(37|38|39|40)$/;
@ -800,11 +800,12 @@ $(document).ready(function() {
article_basket_html = $(item_basket_default_html);
article_basket_html
.attr('data-opeindex', index)
.find('.number').text(nb).end()
.find('.number').text('('+nb+'/'+article_data[4]+')').end()
.find('.name').text(article_data[0]).end()
.find('.amount').text(amountToUKF(amount_euro, account_data['is_cof']));
if (is_low_stock(id, nb))
article_basket_html.addClass('low-stock');
article_basket_html.find('.lowstock')
.css('visibility', 'visible');
basket_container.prepend(article_basket_html);
updateBasketRel();
}
@ -946,10 +947,15 @@ $(document).ready(function() {
amountUKF_after = amountToUKF(amountEuro_after, account_data['is_cof']);
var article_html = basket_container.find('[data-opeindex='+opeindex+']');
article_html.find('.amount').text(amountUKF_after).end()
.find('.number').text(nb_after).end() ;
.find('.number').text(nb_after+'/'+article_data[4]).end() ;
if (is_low_stock(id, nb_after))
article_html.addClass('low-stock');
article_html.find('.lowstock')
.css('visibility', 'visible');
else
article_html.find('.lowstock')
.css('visibility', 'hidden');
updateExistingFormset(opeindex, nb_after, amountEuro_after);
updateBasketRel();
}