Build table now also shows availability of substitute stock

This commit is contained in:
Oliver Walters 2022-04-07 18:48:23 +10:00
parent acc6cb8729
commit f3075d2151
2 changed files with 18 additions and 4 deletions

View File

@ -808,13 +808,12 @@ function loadBomTable(table, options={}) {
// Calculate total "available" (unallocated) quantity
var total = row.available_stock + row.available_substitute_stock;
// var text = row.available_substitute_stock + row.available_stock;
var text = `${total}`;
if (total <= 0) {
text = `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`;
} else {
text = `${total}`;
if (row.available_substitute_stock > 0) {
text += `<span title='{% trans "Includes substitute stock" %}' class='fas fa-info-circle float-right icon-blue'></span>`;
}

View File

@ -1421,9 +1421,24 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
sortable: true,
},
{
field: 'sub_part_detail.stock',
field: 'available_stock',
title: '{% trans "Available" %}',
sortable: true,
formatter: function(value, row) {
var total = row.available_stock + row.available_substitute_stock;
var text = `${total}`;
if (total <= 0) {
text = `<span class='badge rounded-pill bg-danger'>{% trans "No Stock Available" %}</span>`;
} else {
if (row.available_substitute_stock > 0) {
text += `<span title='{% trans "Includes substitute stock" %}' class='fas fa-info-circle float-right icon-blue'></span>`;
}
}
return text;
}
},
{
field: 'allocated',