mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Show or hide items based on output BOM
This commit is contained in:
parent
6e52ca2178
commit
81638d06cf
@ -264,7 +264,7 @@ function makeBuildOutputButtons(output_id, build_info, options={}) {
|
|||||||
var html = `<div class='btn-group float-right' role='group'>`;
|
var html = `<div class='btn-group float-right' role='group'>`;
|
||||||
|
|
||||||
// Tracked parts? Must be individually allocated
|
// Tracked parts? Must be individually allocated
|
||||||
if (build_info.tracked_parts) {
|
if (options.has_bom_items) {
|
||||||
|
|
||||||
// Add a button to allocate stock against this build output
|
// Add a button to allocate stock against this build output
|
||||||
html += makeIconButton(
|
html += makeIconButton(
|
||||||
@ -1085,9 +1085,9 @@ function loadBuildOutputTable(build_info, options={}) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
search: false,
|
search: false,
|
||||||
sidePagination: 'client',
|
sidePagination: 'client',
|
||||||
detailView: true,
|
detailView: bom_items.length > 0,
|
||||||
detailFilter: function(index, row) {
|
detailFilter: function(index, row) {
|
||||||
return true;
|
return bom_items.length > 0;
|
||||||
},
|
},
|
||||||
detailFormatter: function(index, row, element) {
|
detailFormatter: function(index, row, element) {
|
||||||
constructBuildOutputSubTable(index, row, element);
|
constructBuildOutputSubTable(index, row, element);
|
||||||
@ -1159,11 +1159,15 @@ function loadBuildOutputTable(build_info, options={}) {
|
|||||||
{
|
{
|
||||||
field: 'allocated',
|
field: 'allocated',
|
||||||
title: '{% trans "Allocated Stock" %}',
|
title: '{% trans "Allocated Stock" %}',
|
||||||
visible: true,
|
visible: bom_items.length > 0,
|
||||||
switchable: false,
|
switchable: false,
|
||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
|
|
||||||
|
if (bom_items.length == 0) {
|
||||||
|
return `<div id='output-progress-${row.pk}'><em><small>{% trans "No tracked BOM items for this build" %}</small></em></div>`;
|
||||||
|
}
|
||||||
|
|
||||||
var progressBar = makeProgressBar(
|
var progressBar = makeProgressBar(
|
||||||
countAllocatedLines(row),
|
countAllocatedLines(row),
|
||||||
bom_items.length,
|
bom_items.length,
|
||||||
@ -1188,7 +1192,7 @@ function loadBuildOutputTable(build_info, options={}) {
|
|||||||
switchable: true,
|
switchable: true,
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
if (part_tests == null || part_tests.length == 0) {
|
if (part_tests == null || part_tests.length == 0) {
|
||||||
return `<em>{% trans "No tests found " %}</em>`;
|
return `<em><small>{% trans "No required tests for this build" %}</small></em>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
var n_passed = countPassedTests(row);
|
var n_passed = countPassedTests(row);
|
||||||
@ -1218,6 +1222,9 @@ function loadBuildOutputTable(build_info, options={}) {
|
|||||||
return makeBuildOutputButtons(
|
return makeBuildOutputButtons(
|
||||||
row.pk,
|
row.pk,
|
||||||
build_info,
|
build_info,
|
||||||
|
{
|
||||||
|
has_bom_items: bom_items.length > 0,
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user