Filter part table by 'is_component' status

This commit is contained in:
Oliver Walters 2020-04-11 23:02:18 +10:00
parent 0f90e8f522
commit f5a8b110b5
3 changed files with 11 additions and 0 deletions

View File

@ -146,6 +146,12 @@ function loadPartTable(table, url, options={}) {
if (row.assembly) { if (row.assembly) {
display = display + `<span class='fas fa-tools label-right' title='Assembled part'></span>`; display = display + `<span class='fas fa-tools label-right' title='Assembled part'></span>`;
} }
/*
if (row.component) {
display = display + `<span class='fas fa-cogs label-right' title='Component part'></span>`;
}
*/
if (!row.active) { if (!row.active) {
display = display + `<span class='fas fa-times label-right' title='Inactive part'></span>`; display = display + `<span class='fas fa-times label-right' title='Inactive part'></span>`;

View File

@ -156,6 +156,7 @@ class PartList(generics.ListCreateAPIView):
- is_template: Is the part a template part? - is_template: Is the part a template part?
- variant_of: Filter by variant_of Part reference - variant_of: Filter by variant_of Part reference
- assembly: Filter by assembly field - assembly: Filter by assembly field
- component: Filter by component field
""" """
serializer_class = part_serializers.PartSerializer serializer_class = part_serializers.PartSerializer

View File

@ -85,6 +85,10 @@ function getAvailableTableFilters(tableKey) {
type: 'bool', type: 'bool',
title: '{% trans "Assembly" %}', title: '{% trans "Assembly" %}',
}, },
component: {
type: 'bool',
title: '{% trans "Component" %}',
},
}; };
} }