{% load i18n %} {% load status_codes %} {% include "status_codes.html" with label='stock' options=StockStatus.list %} {% include "status_codes.html" with label='build' options=BuildStatus.list %} {% include "status_codes.html" with label='purchaseOrder' options=PurchaseOrderStatus.list %} {% include "status_codes.html" with label='salesOrder' options=SalesOrderStatus.list %} function getAvailableTableFilters(tableKey) { tableKey = tableKey.toLowerCase(); // Filters for the "Stock" table if (tableKey == 'stock') { return { cascade: { type: 'bool', title: '{% trans "Include sublocations" %}', description: '{% trans "Include stock in sublocations" %}', }, active: { type: 'bool', title: '{% trans "Active parts" %}', description: '{% trans "Show stock for active parts" %}', }, status: { options: stockCodes, title: '{% trans "Stock status" %}', description: '{% trans "Stock status" %}', }, allocated: { type: 'bool', title: '{% trans "Is allocated" %}', description: '{% trans "Item has been alloacted" %}', }, }; } // Filters for the 'stock test' table if (tableKey == 'stocktests') { return { result: { type: 'bool', title: "{% trans 'Test result' %}", }, }; } // Filters for the 'part test template' table if (tableKey == 'parttests') { return { required: { type: 'bool', title: "{% trans "Required" %}", } }; } // Filters for the "Build" table if (tableKey == 'build') { return { status: { title: '{% trans "Build status" %}', options: buildCodes, }, }; } // Filters for the "Order" table if (tableKey == "purchaseorder") { return { status: { title: '{% trans "Order status" %}', options: purchaseOrderCodes, }, }; } if (tableKey == "salesorder") { return { status: { title: '{% trans "Order status" %}', options: salesOrderCodes, }, }; } // Filters for the "Parts" table if (tableKey == "parts") { return { cascade: { type: 'bool', title: '{% trans "Include subcategories" %}', description: '{% trans "Include parts in subcategories" %}', }, active: { type: 'bool', title: '{% trans "Active" %}', description: '{% trans "Show active parts" %}', }, is_template: { type: 'bool', title: '{% trans "Template" %}', }, has_stock: { type: 'bool', title: '{% trans "Stock available" %}' }, low_stock: { type: 'bool', title: '{% trans "Low stock" %}', }, assembly: { type: 'bool', title: '{% trans "Assembly" %}', }, component: { type: 'bool', title: '{% trans "Component" %}', }, starred: { type: 'bool', title: '{% trans "Starred" %}', }, salable: { type: 'bool', title: '{% trans "Salable" %}', }, trackable: { type: 'bool', title: '{% trans "Trackable" %}', }, purchaseable: { type: 'bool', title: '{% trans "Purchasable" %}', }, }; } // Finally, no matching key return {}; }