mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Add serializer / table display
This commit is contained in:
@ -286,6 +286,14 @@ function loadPartTable(table, url, 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) {
|
||||
/*
|
||||
@ -332,16 +340,30 @@ function loadPartTestTemplateTable(table, options) {
|
||||
title: "{% trans "Test Name" %}",
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
field: 'description',
|
||||
title: "{% trans "Description" %}",
|
||||
},
|
||||
{
|
||||
field: 'required',
|
||||
title: "{% trans 'Required' %}",
|
||||
sortable: true,
|
||||
formatter: function(value) {
|
||||
if (value) {
|
||||
return `<span class='label label-green'>{% trans "YES" %}</span>`;
|
||||
} else {
|
||||
return `<span class='label label-yellow'>{% trans "NO" %}</span>`;
|
||||
}
|
||||
return yesNoLabel(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'requires_value',
|
||||
title: "{% trans "Requires Value" %}",
|
||||
formatter: function(value) {
|
||||
return yesNoLabel(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'requires_attachment',
|
||||
title: "{% trans "Requires Attachment" %}",
|
||||
formatter: function(value) {
|
||||
return yesNoLabel(value);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user