Update for supplier part list table rendering

This commit is contained in:
Oliver Walters 2020-04-12 00:46:29 +10:00
parent f1f27f08cb
commit 04cee99791

View File

@ -30,21 +30,21 @@
$("#part-create").click(function () { $("#part-create").click(function () {
launchModalForm( launchModalForm(
"{% url 'supplier-part-create' %}", "{% url 'supplier-part-create' %}",
{ {
data: { data: {
supplier: {{ company.id }} supplier: {{ company.id }}
}, },
reload: true, reload: true,
secondary: [ secondary: [
{ {
field: 'part', field: 'part',
label: 'New Part', label: 'New Part',
title: 'Create New Part', title: 'Create New Part',
url: "{% url 'part-create' %}" url: "{% url 'part-create' %}"
}, },
] ]
}); });
}); });
$("#part-table").inventreeTable({ $("#part-table").inventreeTable({
@ -64,7 +64,22 @@
field: 'part_detail.full_name', field: 'part_detail.full_name',
title: '{% trans "Part" %}', title: '{% trans "Part" %}',
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
return imageHoverIcon(row.part_detail.thumbnail) + renderLink(value, '/part/' + row.part + '/suppliers/');
var html = imageHoverIcon(row.part_detail.thumbnail) + renderLink(value, '/part/' + row.part + '/suppliers/');
if (row.part_detail.is_template) {
html += `<span class='fas fa-clone label-right' title='Template part'></span>`;
}
if (row.part_detail.assembly) {
html += `<span class='fas fa-tools label-right' title='Assembled part'></span>`;
}
if (!row.part_detail.active) {
html += `<span class='label label-warning label-right'>INACTIVE</span>`;
}
return html;
} }
}, },
{ {