Add variable for article line

This commit is contained in:
Ludovic Stephan 2017-03-31 23:46:10 -03:00
parent 92fd94d1f9
commit 9c9ad21d73

View file

@ -1340,15 +1340,14 @@ $(document).ready(function() {
} }
} }
for (var i=0; i<data['articles'].length; i++) { for (var i=0; i<data['articles'].length; i++) {
article = data['articles'][i]; var article = data['articles'][i];
var article_line = articles_container.find('#data-article-'+article.id);
if (article.stock <= 5 && article.stock >= -5) { if (article.stock <= 5 && article.stock >= -5) {
articles_container.find('#data-article-'+article['id']) article_line.addClass('low-stock');
.addClass('low-stock');
} else { } else {
articles_container.find('#data-article-'+article['id']) article_line.removeClass('low-stock');
.removeClass('low-stock');
} }
articles_container.find('#data-article-'+article['id']+' .stock') article_line.find('.stock')
.text(article['stock']); .text(article['stock']);
var i = 0; var i = 0;