mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Update progress bar based on sum of allocated quantities
This commit is contained in:
parent
b0891c921c
commit
912a3c4b99
@ -33,6 +33,14 @@ InvenTree | Allocate Parts
|
|||||||
buildTable.inventreeTable({
|
buildTable.inventreeTable({
|
||||||
uniqueId: 'sub_part',
|
uniqueId: 'sub_part',
|
||||||
url: "{% url 'api-bom-list' %}",
|
url: "{% url 'api-bom-list' %}",
|
||||||
|
detailViewByClick: true,
|
||||||
|
detailView: true,
|
||||||
|
detailFilter: function(index, row) {
|
||||||
|
return row.allocations != null;
|
||||||
|
},
|
||||||
|
detailFormatter: function(index, row, element) {
|
||||||
|
return "Hello world";
|
||||||
|
},
|
||||||
formatNoMatches: function() { return "{% trans 'No BOM items found' %}"; },
|
formatNoMatches: function() { return "{% trans 'No BOM items found' %}"; },
|
||||||
onLoadSuccess: function(tableData) {
|
onLoadSuccess: function(tableData) {
|
||||||
// Once the BOM data are loaded, request allocation data for the build
|
// Once the BOM data are loaded, request allocation data for the build
|
||||||
@ -114,9 +122,16 @@ InvenTree | Allocate Parts
|
|||||||
field: 'allocated',
|
field: 'allocated',
|
||||||
title: '{% trans "Allocated" %}',
|
title: '{% trans "Allocated" %}',
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
var progress = value || 0;
|
|
||||||
|
|
||||||
return makeProgressBar(progress, row.quantity * {{ build.quantity }});
|
var allocated = 0;
|
||||||
|
|
||||||
|
if (row.allocations != null) {
|
||||||
|
row.allocations.forEach(function(allocation) {
|
||||||
|
allocated += allocation.quantity;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return makeProgressBar(allocated, row.quantity * {{ build.quantity }});
|
||||||
},
|
},
|
||||||
sorter: function(valA, valB, rowA, rowB) {
|
sorter: function(valA, valB, rowA, rowB) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user