mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Update BOM table display
This commit is contained in:
parent
0bd0e57f16
commit
9f407df15a
@ -827,7 +827,7 @@ class BomList(generics.ListCreateAPIView):
|
||||
if variants is not None:
|
||||
variants = str2bool(variants)
|
||||
|
||||
queryset = queryset.filter(allow_variants=variants)
|
||||
queryset = queryset.filter(allow_variants=variants)
|
||||
|
||||
# Filter by part?
|
||||
part = params.get('part', None)
|
||||
|
@ -352,6 +352,7 @@ class EditBomItemForm(HelperForm):
|
||||
'reference',
|
||||
'overage',
|
||||
'note',
|
||||
'allow_variants',
|
||||
'inherited',
|
||||
'optional',
|
||||
]
|
||||
|
@ -285,11 +285,18 @@ function loadBomTable(table, options) {
|
||||
title: '{% trans "Optional" %}',
|
||||
searchable: false,
|
||||
formatter: function(value) {
|
||||
if (value == '1') return '{% trans "true" %}';
|
||||
if (value == '0') return '{% trans "false" %}';
|
||||
return yesNoLabel(value);
|
||||
}
|
||||
});
|
||||
|
||||
cols.push({
|
||||
field: 'allow_variants',
|
||||
title: '{% trans "Allow Variants" %}',
|
||||
formatter: function(value) {
|
||||
return yesNoLabel(value);
|
||||
}
|
||||
})
|
||||
|
||||
cols.push({
|
||||
field: 'inherited',
|
||||
title: '{% trans "Inherited" %}',
|
||||
@ -297,7 +304,7 @@ function loadBomTable(table, options) {
|
||||
formatter: function(value, row, index, field) {
|
||||
// This BOM item *is* inheritable, but is defined for this BOM
|
||||
if (!row.inherited) {
|
||||
return "-";
|
||||
return yesNoLabel(false);
|
||||
} else if (row.part == options.parent_id) {
|
||||
return '{% trans "Inherited" %}';
|
||||
} else {
|
||||
|
@ -5,6 +5,14 @@
|
||||
* Requires api.js to be loaded first
|
||||
*/
|
||||
|
||||
function yesNoLabel(value) {
|
||||
if (value) {
|
||||
return `<span class='label label-green'>{% trans "YES" %}</span>`;
|
||||
} else {
|
||||
return `<span class='label label-yellow'>{% trans "NO" %}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
function toggleStar(options) {
|
||||
/* Toggle the 'starred' status of a part.
|
||||
* Performs AJAX queries and updates the display on the button.
|
||||
@ -662,16 +670,6 @@ function loadPartCategoryTable(table, options) {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function yesNoLabel(value) {
|
||||
if (value) {
|
||||
return `<span class='label label-green'>{% trans "YES" %}</span>`;
|
||||
} else {
|
||||
return `<span class='label label-yellow'>{% trans "NO" %}</span>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function loadPartTestTemplateTable(table, options) {
|
||||
/*
|
||||
* Load PartTestTemplate table.
|
||||
|
@ -49,6 +49,10 @@ function getAvailableTableFilters(tableKey) {
|
||||
inherited: {
|
||||
type: 'bool',
|
||||
title: '{% trans "Inherited" %}',
|
||||
},
|
||||
allow_variants: {
|
||||
type: 'bool',
|
||||
title: '{% trans "Allow Variant Stock" %}',
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user