Text formatting

This commit is contained in:
Oliver 2022-04-27 09:07:10 +10:00
parent 08ab99adc6
commit 2a24fc43e7

View File

@ -1453,10 +1453,20 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
var required = requiredQuantity(row); var required = requiredQuantity(row);
var text = `${available_stock}`; var text = '';
if (available_stock > 0) {
text += `${available_stock}`;
}
if (available_stock < required) {
text += `<span class='fas fa-times-circle icon-red float-right' title='{% trans "Insufficient stock available" %}'></span>`;
} else {
text += `<span class='fas fa-check-circle icon-green float-right' title='{% trans "Sufficient stock available" %}'></span>`;
}
if (available_stock <= 0) { if (available_stock <= 0) {
text = `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`; text += `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`;
} else { } else {
var extra = ''; var extra = '';
if ((substitute_stock > 0) && (variant_stock > 0)) { if ((substitute_stock > 0) && (variant_stock > 0)) {
@ -1472,12 +1482,6 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
} }
} }
if (available_stock < required) {
text += `<span class='fas fa-times-circle icon-red float-right' title='{% trans "Insufficient stock available" %}'></span>`;
} else {
text += `<span class='fas fa-check-circle icon-green float-right' title='{% trans "Sufficient stock available" %}'></span>`;
}
return renderLink(text, url); return renderLink(text, url);
}, },
sorter: function(valA, valB, rowA, rowB) { sorter: function(valA, valB, rowA, rowB) {