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 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) {
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 {
var extra = '';
if ((substitute_stock > 0) && (variant_stock > 0)) {
@ -1471,12 +1481,6 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
text += `<span title='${extra}' class='fas fa-info-circle float-right icon-blue'></span>`;
}
}
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);
},