fixes for table_filters.js

This commit is contained in:
Oliver Walters 2021-08-28 22:18:20 +10:00
parent 0620e656a0
commit 140a2092c8
2 changed files with 7 additions and 4 deletions

View File

@ -2,6 +2,8 @@
{% load status_codes %} {% load status_codes %}
{% load inventree_extras %} {% 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='stock' options=StockStatus.list %}
{% include "status_codes.html" with label='stockHistory' options=StockHistoryCode.list %} {% include "status_codes.html" with label='stockHistory' options=StockHistoryCode.list %}
{% include "status_codes.html" with label='build' options=BuildStatus.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 %} {% include "status_codes.html" with label='salesOrder' options=SalesOrderStatus.list %}
function getAvailableTableFilters(tableKey) { export function getAvailableTableFilters(tableKey) {
tableKey = tableKey.toLowerCase(); tableKey = tableKey.toLowerCase();

View File

@ -1,12 +1,13 @@
/* /*
* Status codes for the {{ label }} model. * Status codes for the {{ label }} model.
*/ */
var {{ label }}Codes = { export const {{ label }}Codes = {
{% for opt in options %}'{{ opt.key }}': { {% for opt in options %}'{{ opt.key }}': {
key: '{{ opt.key }}', key: '{{ opt.key }}',
value: '{{ opt.value }}',{% if opt.color %} value: '{{ opt.value }}',{% if opt.color %}
label: 'label-{{ opt.color }}',{% endif %} label: 'label-{{ opt.color }}',{% endif %}
},{% endfor %} },
{% endfor %}
}; };
/* /*
@ -14,7 +15,7 @@ var {{ label }}Codes = {
* Uses the values specified in "status_codes.py" * Uses the values specified in "status_codes.py"
* This function is generated by the "status_codes.html" template * This function is generated by the "status_codes.html" template
*/ */
function {{ label }}StatusDisplay(key, options={}) { export function {{ label }}StatusDisplay(key, options={}) {
key = String(key); key = String(key);