diff --git a/InvenTree/templates/js/translated/table_filters.js b/InvenTree/templates/js/translated/table_filters.js index 9e173a7b37..cb8d9047d7 100644 --- a/InvenTree/templates/js/translated/table_filters.js +++ b/InvenTree/templates/js/translated/table_filters.js @@ -2,6 +2,8 @@ {% load status_codes %} {% load inventree_extras %} +import { global_settings } from '{% url "settings.js" %}'; + {% include "status_codes.html" with label='stock' options=StockStatus.list %} {% include "status_codes.html" with label='stockHistory' options=StockHistoryCode.list %} {% include "status_codes.html" with label='build' options=BuildStatus.list %} @@ -9,7 +11,7 @@ {% include "status_codes.html" with label='salesOrder' options=SalesOrderStatus.list %} -function getAvailableTableFilters(tableKey) { +export function getAvailableTableFilters(tableKey) { tableKey = tableKey.toLowerCase(); diff --git a/InvenTree/templates/status_codes.html b/InvenTree/templates/status_codes.html index e7bc2e951c..cfca5ea77b 100644 --- a/InvenTree/templates/status_codes.html +++ b/InvenTree/templates/status_codes.html @@ -1,12 +1,13 @@ /* * Status codes for the {{ label }} model. */ -var {{ label }}Codes = { +export const {{ label }}Codes = { {% for opt in options %}'{{ opt.key }}': { key: '{{ opt.key }}', value: '{{ opt.value }}',{% if opt.color %} label: 'label-{{ opt.color }}',{% endif %} - },{% endfor %} + }, + {% endfor %} }; /* @@ -14,7 +15,7 @@ var {{ label }}Codes = { * Uses the values specified in "status_codes.py" * This function is generated by the "status_codes.html" template */ -function {{ label }}StatusDisplay(key, options={}) { +export function {{ label }}StatusDisplay(key, options={}) { key = String(key);