mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 20:46:47 +00:00
Filter BOM table by "trackable" status
This commit is contained in:
parent
1a4eb3f870
commit
24ab48ef4c
@ -47,6 +47,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<button title='{% trans "Export Bill of Materials" %}' class='btn btn-default action-button' id='download-bom' type='button'><span class='fas fa-file-download'></span></button>
|
<button title='{% trans "Export Bill of Materials" %}' class='btn btn-default action-button' id='download-bom' type='button'><span class='fas fa-file-download'></span></button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<div class='filter-list' id='filter-list-bom'>
|
||||||
|
<!-- Empty div (will be filled out with avilable BOM filters) -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='bom-table'>
|
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='bom-table'>
|
||||||
|
@ -103,7 +103,30 @@ function loadBomTable(table, options) {
|
|||||||
* BOM data are retrieved from the server via AJAX query
|
* BOM data are retrieved from the server via AJAX query
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Construct the table columns
|
var params = {
|
||||||
|
part: options.parent_id,
|
||||||
|
ordering: 'name',
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.part_detail) {
|
||||||
|
params.part_detail = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.sub_part_detail) {
|
||||||
|
params.sub_part_detail = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var filters = {};
|
||||||
|
|
||||||
|
if (!options.disableFilters) {
|
||||||
|
filters = loadTableFilters("bom");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var key in params) {
|
||||||
|
filters[key] = params[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
setupFilterList("bom", $(table));
|
||||||
|
|
||||||
var cols = [];
|
var cols = [];
|
||||||
|
|
||||||
@ -128,7 +151,7 @@ function loadBomTable(table, options) {
|
|||||||
var html = imageHoverIcon(row.sub_part_detail.thumbnail) + renderLink(row.sub_part_detail.full_name, url);
|
var html = imageHoverIcon(row.sub_part_detail.thumbnail) + renderLink(row.sub_part_detail.full_name, url);
|
||||||
|
|
||||||
if (row.sub_part_detail.trackable) {
|
if (row.sub_part_detail.trackable) {
|
||||||
html += `<span title='{% trans "Trackable part" %}' class='fas fa-route label-right'></span>`;
|
html += `<span title='{% trans "Trackable part" %}' class='fas fa-directions label-right'></span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display an extra icon if this part is an assembly
|
// Display an extra icon if this part is an assembly
|
||||||
@ -270,21 +293,6 @@ function loadBomTable(table, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure the table (bootstrap-table)
|
|
||||||
|
|
||||||
var params = {
|
|
||||||
part: options.parent_id,
|
|
||||||
ordering: 'name',
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.part_detail) {
|
|
||||||
params.part_detail = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.sub_part_detail) {
|
|
||||||
params.sub_part_detail = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to request BOM data for sub-items
|
// Function to request BOM data for sub-items
|
||||||
// This function may be called recursively for multi-level BOMs
|
// This function may be called recursively for multi-level BOMs
|
||||||
function requestSubItems(bom_pk, part_pk) {
|
function requestSubItems(bom_pk, part_pk) {
|
||||||
@ -337,7 +345,8 @@ function loadBomTable(table, options) {
|
|||||||
},
|
},
|
||||||
formatNoMatches: function() { return "{% trans "No BOM items found" %}"; },
|
formatNoMatches: function() { return "{% trans "No BOM items found" %}"; },
|
||||||
clickToSelect: true,
|
clickToSelect: true,
|
||||||
queryParams: params,
|
queryParams: filters,
|
||||||
|
original: params,
|
||||||
columns: cols,
|
columns: cols,
|
||||||
url: options.bom_url,
|
url: options.bom_url,
|
||||||
onPostBody: function() {
|
onPostBody: function() {
|
||||||
|
@ -11,6 +11,16 @@ function getAvailableTableFilters(tableKey) {
|
|||||||
|
|
||||||
tableKey = tableKey.toLowerCase();
|
tableKey = tableKey.toLowerCase();
|
||||||
|
|
||||||
|
// Filters for Bill of Materials table
|
||||||
|
if (tableKey == "bom") {
|
||||||
|
return {
|
||||||
|
trackable: {
|
||||||
|
type: 'bool',
|
||||||
|
title: '{% trans "Trackable Part" %}'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Filters for the "customer stock" table (really a subset of "stock")
|
// Filters for the "customer stock" table (really a subset of "stock")
|
||||||
if (tableKey == "customerstock") {
|
if (tableKey == "customerstock") {
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user