2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Many more refactoring

This commit is contained in:
Oliver Walters
2020-04-11 14:14:45 +10:00
parent 5d2441776e
commit 64f8034a4c
5 changed files with 142 additions and 85 deletions

View File

@ -18,9 +18,10 @@
</ul>
</div>
{% endif %}
<div class='filters' id='#filter-list-stock'>
<!-- An empty div in which the filter list will be constructed -->
</div>
<div class='filters'>
<button class='btn btn-default' id='filter-add'>Add filter</button>
<button class='btn btn-default' id='filter-clear'>Clear filters</button>
<ul class='filter-list' id='stock-filter-list'>
<!-- This is an empty list which will be populated with the stock table filters -->
</ul>

View File

@ -1,10 +1,10 @@
{% load i18n %}
{% load inventree_extras %}
<script type='text/javascript'>
{% load_status_codes %}
<script type='text/javascript'>
function getAvailableTableFilters(tableKey) {
tableKey = tableKey.toLowerCase();
@ -12,23 +12,23 @@ function getAvailableTableFilters(tableKey) {
// Filters for the "Stock" table
if (tableKey == 'stock') {
return {
'cascade': {
'type': 'bool',
'description': '{% trans "Include stock in sublocations" %}',
'title': '{% trans "Include sublocations" %}',
cascade: {
type: 'bool',
description: '{% trans "Include stock in sublocations" %}',
title: '{% trans "Include sublocations" %}',
},
'active': {
'type': 'bool',
'title': '{% trans "Active parts" %}',
'description': '{% trans "Show stock for active parts" %}',
active: {
type: 'bool',
title: '{% trans "Active parts" %}',
description: '{% trans "Show stock for active parts" %}',
},
'status': {
'options': {
options: {
{% for opt in stock_status_codes %}'{{ opt.value }}': '{{ opt.key }}',
{% endfor %}
},
'title': '{% trans "Stock status" %}',
'description': '{% trans "Stock status" %}',
title: '{% trans "Stock status" %}',
description: '{% trans "Stock status" %}',
},
};
}
@ -36,6 +36,13 @@ function getAvailableTableFilters(tableKey) {
// Filters for the "Build" table
if (tableKey == 'build') {
return {
status: {
title: '{% trans "Build status" %}',
options: {
{% for opt in build_status_codes %}'{{ opt.value }}': '{{ opt.key }}',
{% endfor %}
},
},
};
}
@ -43,11 +50,17 @@ function getAvailableTableFilters(tableKey) {
// Filters for the "Order" table
if (tableKey == "order") {
return {
status: {
title: '{% trans "Order status" %}',
options: {
{% for opt in order_status_codes %}'{{ opt.value }}': '{{ opt.key }}',
{% endfor %}
},
},
};
}
// Filters fro the "Parts" table
// Filters for the "Parts" table
if (tableKey == "parts") {
return {
};