mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Filter BOM table by "trackable" status
This commit is contained in:
parent
1a4eb3f870
commit
24ab48ef4c
@ -47,6 +47,9 @@
|
||||
{% 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>
|
||||
{% endif %}
|
||||
<div class='filter-list' id='filter-list-bom'>
|
||||
<!-- Empty div (will be filled out with avilable BOM filters) -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class='table table-striped table-condensed' data-toolbar="#button-toolbar" id='bom-table'>
|
||||
|
@ -102,8 +102,31 @@ function loadBomTable(table, options) {
|
||||
*
|
||||
* BOM data are retrieved from the server via AJAX query
|
||||
*/
|
||||
|
||||
var params = {
|
||||
part: options.parent_id,
|
||||
ordering: 'name',
|
||||
}
|
||||
|
||||
// Construct the table columns
|
||||
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 = [];
|
||||
|
||||
@ -128,7 +151,7 @@ function loadBomTable(table, options) {
|
||||
var html = imageHoverIcon(row.sub_part_detail.thumbnail) + renderLink(row.sub_part_detail.full_name, url);
|
||||
|
||||
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
|
||||
@ -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
|
||||
// This function may be called recursively for multi-level BOMs
|
||||
function requestSubItems(bom_pk, part_pk) {
|
||||
@ -337,7 +345,8 @@ function loadBomTable(table, options) {
|
||||
},
|
||||
formatNoMatches: function() { return "{% trans "No BOM items found" %}"; },
|
||||
clickToSelect: true,
|
||||
queryParams: params,
|
||||
queryParams: filters,
|
||||
original: params,
|
||||
columns: cols,
|
||||
url: options.bom_url,
|
||||
onPostBody: function() {
|
||||
|
@ -11,6 +11,16 @@ function getAvailableTableFilters(tableKey) {
|
||||
|
||||
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")
|
||||
if (tableKey == "customerstock") {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user