mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Further work on templated filter options
This commit is contained in:
parent
c1b59eeaab
commit
5d2441776e
@ -233,7 +233,8 @@ function getFilterDescription(tableKey, filterKey) {
|
||||
*/
|
||||
function getFilterOptionValue(tableKey, filterKey, valueKey) {
|
||||
|
||||
var filter = getFilterOption(tableKey, filterKey);
|
||||
var filter = getFilterSettings(tableKey, filterKey);
|
||||
|
||||
|
||||
var value = String(valueKey);
|
||||
|
||||
|
@ -55,7 +55,10 @@ function updateStockFilterList(filterListElement, table) {
|
||||
var filters = loadTableFilters("stock");
|
||||
|
||||
for (var key in filters) {
|
||||
$(filterListElement).append(`<li>${key} = ${filters[key]}<span filter-tag-stock='${key}' class='close'>x</span></li>` );
|
||||
|
||||
var value = getFilterOptionValue("stock", key, filters[key]);
|
||||
|
||||
$(filterListElement).append(`<li>${key} = ${value}<span filter-tag-stock='${key}' class='close'>x</span></li>` );
|
||||
}
|
||||
|
||||
// Whenever the callback is called, pass the original parameters through
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
function getAvailableTableFilters(tableKey) {
|
||||
|
||||
tableKey = tableKey.toLowerCase();
|
||||
|
||||
// Filters for the "Stock" table
|
||||
if (tableKey == 'stock') {
|
||||
return {
|
||||
@ -25,15 +27,32 @@ function getAvailableTableFilters(tableKey) {
|
||||
{% for opt in stock_status_codes %}'{{ opt.value }}': '{{ opt.key }}',
|
||||
{% endfor %}
|
||||
},
|
||||
'title': 'Stock status',
|
||||
'description': 'Stock status',
|
||||
},
|
||||
'test': {
|
||||
title: 'A test parameter',
|
||||
'title': '{% trans "Stock status" %}',
|
||||
'description': '{% trans "Stock status" %}',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
// Filters for the "Build" table
|
||||
if (tableKey == 'build') {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// Filters for the "Order" table
|
||||
if (tableKey == "order") {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// Filters fro the "Parts" table
|
||||
if (tableKey == "parts") {
|
||||
return {
|
||||
};
|
||||
}
|
||||
|
||||
// Finally, no matching key
|
||||
return {};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user