diff --git a/InvenTree/InvenTree/static/script/inventree/filters.js b/InvenTree/InvenTree/static/script/inventree/filters.js index cadc1021f5..bf22aa4fd7 100644 --- a/InvenTree/InvenTree/static/script/inventree/filters.js +++ b/InvenTree/InvenTree/static/script/inventree/filters.js @@ -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); diff --git a/InvenTree/InvenTree/static/script/inventree/stock.js b/InvenTree/InvenTree/static/script/inventree/stock.js index 0c039098e3..56e9954f8a 100644 --- a/InvenTree/InvenTree/static/script/inventree/stock.js +++ b/InvenTree/InvenTree/static/script/inventree/stock.js @@ -55,7 +55,10 @@ function updateStockFilterList(filterListElement, table) { var filters = loadTableFilters("stock"); for (var key in filters) { - $(filterListElement).append(`
  • ${key} = ${filters[key]}x
  • ` ); + + var value = getFilterOptionValue("stock", key, filters[key]); + + $(filterListElement).append(`
  • ${key} = ${value}x
  • ` ); } // Whenever the callback is called, pass the original parameters through diff --git a/InvenTree/templates/table_filters.html b/InvenTree/templates/table_filters.html index d908dfa38c..5ab0aefec8 100644 --- a/InvenTree/templates/table_filters.html +++ b/InvenTree/templates/table_filters.html @@ -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 {}; }