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

Company table now in separate javascript file

This commit is contained in:
Oliver Walters
2020-04-13 12:23:15 +10:00
parent f427ee4754
commit 95354f09da
4 changed files with 88 additions and 56 deletions

View File

@ -33,61 +33,9 @@ InvenTree | {% trans "Supplier List" %}
});
});
$("#company-table").inventreeTable({
formatNoMatches: function() { return "No company information found"; },
columns: [
{
field: 'pk',
title: '{% trans "ID" %}',
visible: false,
},
{
field: 'name',
title: '{% trans "Supplier" %}',
sortable: true,
formatter: function(value, row, index, field) {
var html = imageHoverIcon(row.image) + renderLink(value, row.url);
if (row.is_customer) {
html += `<span title='Customer' class='fas fa-user label-right'></span>`;
}
if (row.is_manufacturer) {
html += `<span title='Manufacturer' class='fas fa-industry label-right'></span>`;
}
if (row.is_supplier) {
html += `<span title='Supplier' class='fas fa-building label-right'></span>`;
}
return html;
}
},
{
field: 'description',
title: '{% trans "Description" %}',
sortable: true,
},
{
field: 'website',
title: '{% trans "Website" %}',
formatter: function(value, row, index, field) {
if (value) {
return renderLink(value, value);
}
return '';
}
},
{
field: 'part_count',
title: '{% trans "Parts" %}',
sortable: true,
formatter: function(value, row, index, field) {
return renderLink(value, row.url + 'parts/');
}
},
],
url: "{% url 'api-company-list' %}"
});
loadCompanyTable("#company-table", "{% url 'api-company-list' %}",
{
}
);
{% endblock %}