mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Refactor build page template
- Only load build outputs table as required
This commit is contained in:
parent
b63352ce20
commit
cb7c4396fb
@ -401,33 +401,21 @@ function reloadTable() {
|
||||
$('#allocation-table-untracked').bootstrapTable('refresh');
|
||||
}
|
||||
|
||||
// Get the list of BOM items required for this build
|
||||
inventreeGet(
|
||||
'{% url "api-bom-list" %}',
|
||||
{
|
||||
part: {{ build.part.pk }},
|
||||
sub_part_detail: true,
|
||||
},
|
||||
{
|
||||
success: function(response) {
|
||||
onPanelLoad('outputs', function() {
|
||||
{% if build.active %}
|
||||
|
||||
var build_info = {
|
||||
pk: {{ build.pk }},
|
||||
part: {{ build.part.pk }},
|
||||
quantity: {{ build.quantity }},
|
||||
bom_items: response,
|
||||
{% if build.take_from %}
|
||||
source_location: {{ build.take_from.pk }},
|
||||
{% endif %}
|
||||
{% if build.has_tracked_bom_items %}
|
||||
tracked_parts: true,
|
||||
{% else %}
|
||||
tracked_parts: false,
|
||||
{% endif %}
|
||||
};
|
||||
|
||||
{% if build.active %}
|
||||
loadBuildOutputTable(build_info);
|
||||
|
||||
linkButtonsToSelection(
|
||||
'#build-output-table',
|
||||
[
|
||||
@ -491,8 +479,20 @@ inventreeGet(
|
||||
});
|
||||
|
||||
{% endif %}
|
||||
});
|
||||
|
||||
{% if build.active and build.has_untracked_bom_items %}
|
||||
|
||||
var build_info = {
|
||||
pk: {{ build.pk }},
|
||||
part: {{ build.part.pk }},
|
||||
quantity: {{ build.quantity }},
|
||||
{% if build.take_from %}
|
||||
source_location: {{ build.take_from.pk }},
|
||||
{% endif %}
|
||||
tracked_parts: false,
|
||||
};
|
||||
|
||||
// Load allocation table for un-tracked parts
|
||||
loadBuildOutputAllocationTable(
|
||||
build_info,
|
||||
@ -502,9 +502,6 @@ inventreeGet(
|
||||
}
|
||||
);
|
||||
{% endif %}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$('#btn-create-output').click(function() {
|
||||
|
||||
|
@ -741,18 +741,6 @@ function loadBuildOutputTable(build_info, options={}) {
|
||||
params.is_building = true;
|
||||
params.build = build_info.pk;
|
||||
|
||||
// Construct a list of "tracked" BOM items
|
||||
var tracked_bom_items = [];
|
||||
|
||||
var has_tracked_items = false;
|
||||
|
||||
build_info.bom_items.forEach(function(bom_item) {
|
||||
if (bom_item.sub_part_detail.trackable) {
|
||||
tracked_bom_items.push(bom_item);
|
||||
has_tracked_items = true;
|
||||
};
|
||||
});
|
||||
|
||||
var filters = {};
|
||||
|
||||
for (var key in params) {
|
||||
@ -1031,7 +1019,7 @@ function loadBuildOutputTable(build_info, options={}) {
|
||||
sortable: true,
|
||||
search: false,
|
||||
sidePagination: 'client',
|
||||
detailView: has_tracked_items,
|
||||
detailView: true,
|
||||
detailFilter: function(index, row) {
|
||||
return true;
|
||||
},
|
||||
@ -1105,7 +1093,7 @@ function loadBuildOutputTable(build_info, options={}) {
|
||||
{
|
||||
field: 'allocated',
|
||||
title: '{% trans "Allocated Stock" %}',
|
||||
visible: has_tracked_items,
|
||||
visible: true,
|
||||
switchable: false,
|
||||
formatter: function(value, row) {
|
||||
return `<div id='output-progress-${row.pk}'><span class='fas fa-spin fa-spinner'></span></div>`;
|
||||
|
Loading…
Reference in New Issue
Block a user