mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Build table now also shows availability of substitute stock
This commit is contained in:
parent
acc6cb8729
commit
f3075d2151
@ -808,13 +808,12 @@ function loadBomTable(table, options={}) {
|
|||||||
|
|
||||||
// Calculate total "available" (unallocated) quantity
|
// Calculate total "available" (unallocated) quantity
|
||||||
var total = row.available_stock + row.available_substitute_stock;
|
var total = row.available_stock + row.available_substitute_stock;
|
||||||
// var text = row.available_substitute_stock + row.available_stock;
|
|
||||||
|
var text = `${total}`;
|
||||||
|
|
||||||
if (total <= 0) {
|
if (total <= 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 {
|
||||||
text = `${total}`;
|
|
||||||
|
|
||||||
if (row.available_substitute_stock > 0) {
|
if (row.available_substitute_stock > 0) {
|
||||||
text += `<span title='{% trans "Includes substitute stock" %}' class='fas fa-info-circle float-right icon-blue'></span>`;
|
text += `<span title='{% trans "Includes substitute stock" %}' class='fas fa-info-circle float-right icon-blue'></span>`;
|
||||||
}
|
}
|
||||||
|
@ -1421,9 +1421,24 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'sub_part_detail.stock',
|
field: 'available_stock',
|
||||||
title: '{% trans "Available" %}',
|
title: '{% trans "Available" %}',
|
||||||
sortable: true,
|
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',
|
field: 'allocated',
|
||||||
|
Loading…
Reference in New Issue
Block a user