mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
parent
deffcc2814
commit
693d24b4b6
@ -1086,11 +1086,7 @@ function loadBuildOutputTable(build_info, options={}) {
|
|||||||
params.is_building = true;
|
params.is_building = true;
|
||||||
params.build = build_info.pk;
|
params.build = build_info.pk;
|
||||||
|
|
||||||
var filters = {};
|
var filters = Object.assign({}, params);
|
||||||
|
|
||||||
for (var key in params) {
|
|
||||||
filters[key] = params[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
setupFilterList('builditems', $(table), options.filterTarget || '#filter-list-incompletebuilditems', {
|
setupFilterList('builditems', $(table), options.filterTarget || '#filter-list-incompletebuilditems', {
|
||||||
labels: {
|
labels: {
|
||||||
|
@ -74,8 +74,7 @@ function loadTableFilters(tableKey, query={}) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Override configurable filters with hard-coded query
|
// Override configurable filters with hard-coded query
|
||||||
Object.assign(filters, query);
|
filters = Object.assign(filters, query);
|
||||||
|
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,9 +487,9 @@ function setupFilterList(tableKey, table, target, options={}) {
|
|||||||
`);
|
`);
|
||||||
|
|
||||||
for (var key in filters) {
|
for (var key in filters) {
|
||||||
var value = getFilterOptionValue(tableKey, key, filters[key]);
|
let value = getFilterOptionValue(tableKey, key, filters[key]);
|
||||||
var title = getFilterTitle(tableKey, key);
|
let title = getFilterTitle(tableKey, key);
|
||||||
var description = getFilterDescription(tableKey, key);
|
let description = getFilterDescription(tableKey, key);
|
||||||
|
|
||||||
var filter_tag = `
|
var filter_tag = `
|
||||||
<div title='${description}' class='filter-tag'>
|
<div title='${description}' class='filter-tag'>
|
||||||
|
@ -1895,11 +1895,7 @@ function loadRelatedPartsTable(table, part_id, options={}) {
|
|||||||
|
|
||||||
options.params.part = part_id;
|
options.params.part = part_id;
|
||||||
|
|
||||||
var filters = {};
|
var filters = Object.assign({}, options.params);
|
||||||
|
|
||||||
for (var key in options.params) {
|
|
||||||
filters[key] = options.params[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
setupFilterList('related', $(table), options.filterTarget);
|
setupFilterList('related', $(table), options.filterTarget);
|
||||||
|
|
||||||
@ -2242,8 +2238,6 @@ function loadPartTable(table, url, options={}) {
|
|||||||
// Ensure category detail is included
|
// Ensure category detail is included
|
||||||
options.params['category_detail'] = true;
|
options.params['category_detail'] = true;
|
||||||
|
|
||||||
var params = options.params || {};
|
|
||||||
|
|
||||||
let filters = {};
|
let filters = {};
|
||||||
|
|
||||||
if (!options.disableFilters) {
|
if (!options.disableFilters) {
|
||||||
@ -2268,6 +2262,9 @@ function loadPartTable(table, url, options={}) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update fields with passed parameters
|
||||||
|
filters = Object.assign(filters, options.params);
|
||||||
|
|
||||||
var columns = [
|
var columns = [
|
||||||
{
|
{
|
||||||
field: 'pk',
|
field: 'pk',
|
||||||
@ -2435,7 +2432,7 @@ function loadPartTable(table, url, options={}) {
|
|||||||
name: table_name,
|
name: table_name,
|
||||||
queryParams: filters,
|
queryParams: filters,
|
||||||
groupBy: false,
|
groupBy: false,
|
||||||
original: params,
|
original: options.params,
|
||||||
sidePagination: 'server',
|
sidePagination: 'server',
|
||||||
pagination: 'true',
|
pagination: 'true',
|
||||||
formatNoMatches: function() {
|
formatNoMatches: function() {
|
||||||
@ -2781,10 +2778,7 @@ function loadPartTestTemplateTable(table, options) {
|
|||||||
|
|
||||||
setupFilterList('parttests', table, filterListElement);
|
setupFilterList('parttests', table, filterListElement);
|
||||||
|
|
||||||
// Override the default values, or add new ones
|
filters = Object.assign(filters, params);
|
||||||
for (var key in params) {
|
|
||||||
filters[key] = params[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
table.inventreeTable({
|
table.inventreeTable({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
@ -1886,10 +1886,7 @@ function loadStockTable(table, options) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override the default values, or add new ones
|
filters = Object.assign(filters, params);
|
||||||
for (var key in params) {
|
|
||||||
filters[key] = params[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
var col = null;
|
var col = null;
|
||||||
|
|
||||||
@ -2450,9 +2447,7 @@ function loadStockLocationTable(table, options) {
|
|||||||
plural_name: '{% trans "stock locations" %}',
|
plural_name: '{% trans "stock locations" %}',
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var key in params) {
|
filters = Object.assign(filters, params);
|
||||||
filters[key] = params[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to request sub-location items
|
// Function to request sub-location items
|
||||||
function requestSubItems(parent_pk) {
|
function requestSubItems(parent_pk) {
|
||||||
|
@ -471,7 +471,7 @@ function getBuildTableFilters() {
|
|||||||
async: false,
|
async: false,
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
for (var key in response) {
|
for (var key in response) {
|
||||||
var owner = response[key];
|
let owner = response[key];
|
||||||
ownersList[owner.pk] = {
|
ownersList[owner.pk] = {
|
||||||
key: owner.pk,
|
key: owner.pk,
|
||||||
value: `${owner.name} (${owner.label})`,
|
value: `${owner.name} (${owner.label})`,
|
||||||
|
@ -252,17 +252,11 @@ function reloadTableFilters(table, filters, options={}) {
|
|||||||
options = table.bootstrapTable('getOptions');
|
options = table.bootstrapTable('getOptions');
|
||||||
|
|
||||||
// Construct a new list of filters to use for the query
|
// Construct a new list of filters to use for the query
|
||||||
var params = {};
|
let params = Object.assign({}, filters);
|
||||||
|
|
||||||
for (var k in filters) {
|
|
||||||
params[k] = filters[k];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Original query params will override
|
// Original query params will override
|
||||||
if (options.original != null) {
|
if (options.original) {
|
||||||
for (var key in options.original) {
|
params = Object.assign(params, options.original);
|
||||||
params[key] = options.original[key];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the total set of query params
|
// Store the total set of query params
|
||||||
@ -318,9 +312,7 @@ function convertQueryParameters(params, filters) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var key in filters) {
|
params = Object.assign(params, filters);
|
||||||
params[key] = filters[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add "order" back in (if it was originally specified by InvenTree)
|
// Add "order" back in (if it was originally specified by InvenTree)
|
||||||
// Annoyingly, "order" shadows some field names in InvenTree...
|
// Annoyingly, "order" shadows some field names in InvenTree...
|
||||||
|
Loading…
Reference in New Issue
Block a user