Improved visual layout

This commit is contained in:
Oliver Walters 2020-03-30 15:04:56 +11:00
parent 5aec3df7c9
commit 0dc6d9d37e
2 changed files with 8 additions and 7 deletions

View File

@ -112,6 +112,10 @@
font-size: 100%; font-size: 100%;
} }
.label-right {
float: right;
}
/* Bootstrap table overrides */ /* Bootstrap table overrides */
.stock-sub-group td { .stock-sub-group td {

View File

@ -182,7 +182,6 @@ function loadPartTable(table, url, options={}) {
searchable: false, searchable: false,
sortable: true, sortable: true,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
var html = "";
var link = "stock"; var link = "stock";
if (value) { if (value) {
@ -190,22 +189,20 @@ function loadPartTable(table, url, options={}) {
// Is stock "low" (below the 'minimum_stock' quantity)? // Is stock "low" (below the 'minimum_stock' quantity)?
if (row.minimum_stock && row.minimum_stock > value) { if (row.minimum_stock && row.minimum_stock > value) {
value = "<span class='label label-warning'>Low stock : " + row.in_stock + "</span>"; value += "<span class='label label-right label-warning'>Low stock</span>";
} }
html = value;
} else if (row.on_order) { } else if (row.on_order) {
// There is no stock available, but stock is 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 = "0<span class='label label-right 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 // There is no stock available, but stock is being built
value = "<span class='label label-info'>Building : " + row.building + "</span>"; value = "0<span class='label label-right label-info'>Building : " + row.building + "</span>";
link = "builds"; link = "builds";
} else { } else {
// There is no stock available // There is no stock available
value ="<span class='label label-danger'>No Stock</span>"; value = "0<span class='label label-right label-danger'>No Stock</span>";
} }
return renderLink(value, '/part/' + row.pk + "/" + link + "/"); return renderLink(value, '/part/' + row.pk + "/" + link + "/");