mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
separate display for "no stock" and "low stock" in list view
This commit is contained in:
parent
e8e0ab8416
commit
06f28898a0
@ -186,21 +186,26 @@ function loadPartTable(table, url, options={}) {
|
|||||||
var link = "stock";
|
var link = "stock";
|
||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
|
// There IS stock available for this part
|
||||||
|
|
||||||
if (row.units) {
|
// Is stock "low" (below the 'minimum_stock' quantity)?
|
||||||
value += ' <i><small>' + row.units + '</small></i>';
|
if (row.minimum_stock && row.minimum_stock > value) {
|
||||||
|
value = "<span class='label label-warning'>Low stock : " + row.in_stock + "</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
html = value;
|
html = value;
|
||||||
|
|
||||||
} else if (row.on_order) {
|
} else if (row.on_order) {
|
||||||
|
// There is no stock available, but stock is on order
|
||||||
value = "<span class='label label-primary'>On Order : " + row.on_order + "</span>";
|
value = "<span class='label label-primary'>On Order : " + row.on_order + "</span>";
|
||||||
link = "orders";
|
link = "orders";
|
||||||
} else if (row.building) {
|
} else if (row.building) {
|
||||||
|
// There is no stock available, but stock is being built
|
||||||
value = "<span class='label label-info'>Building : " + row.building + "</span>";
|
value = "<span class='label label-info'>Building : " + row.building + "</span>";
|
||||||
link = "builds";
|
link = "builds";
|
||||||
} else {
|
} else {
|
||||||
value ="<span class='label label-warning'>No Stock</span>";
|
// There is no stock available
|
||||||
|
value ="<span class='label label-danger'>No Stock</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderLink(value, '/part/' + row.pk + "/" + link + "/");
|
return renderLink(value, '/part/' + row.pk + "/" + link + "/");
|
||||||
|
Loading…
Reference in New Issue
Block a user