Add support for low stock css

This commit is contained in:
Ludovic Stephan 2017-03-17 17:30:22 -03:00
parent a7de396aa3
commit 565a054323
2 changed files with 9 additions and 1 deletions

View file

@ -304,6 +304,10 @@ input[type=number]::-webkit-outer-spin-button {
font-size:14px; font-size:14px;
} }
#articles_data .article[data_stock="low"] {
background:rgba(236,100,0,0.3);
}
#articles_data span { #articles_data span {
height:25px; height:25px;
line-height:25px; line-height:25px;

View file

@ -1100,6 +1100,10 @@ class ArticleFormatter extends Formatter {
return Article.props; return Article.props;
} }
static get attrs() {
return ['data_stock'];
}
static prop_price(s) { static prop_price(s) {
return amountToUKF(s.price, true); return amountToUKF(s.price, true);
} }
@ -1112,7 +1116,7 @@ class ArticleFormatter extends Formatter {
} }
static attr_data_stock(a) { static attr_data_stock(a) {
if (a.stock >= 5) { return this._data_stock.ok; } if (a.stock > 5) { return this._data_stock.ok; }
else if (a.stock >= -5) { return this._data_stock.low; } else if (a.stock >= -5) { return this._data_stock.low; }
else /* a.stock < -5 */ { return this._data_stock.neg; } else /* a.stock < -5 */ { return this._data_stock.neg; }
} }