From 8c55831321fd3d23d4241ffbca117924aabca00f Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 13 Apr 2020 19:38:40 +1000 Subject: [PATCH] Fix supplier-part-table for Part view (cherry picked from commit 2839f94773cefca3ec3b2ec4c175126bfa5fd3ab) --- InvenTree/part/templates/part/supplier.html | 62 ++++----------------- 1 file changed, 11 insertions(+), 51 deletions(-) diff --git a/InvenTree/part/templates/part/supplier.html b/InvenTree/part/templates/part/supplier.html index 38596ba03c..e20baae3e9 100644 --- a/InvenTree/part/templates/part/supplier.html +++ b/InvenTree/part/templates/part/supplier.html @@ -66,58 +66,18 @@ }); }); - $("#supplier-table").inventreeTable({ - formatNoMatches: function() { return "No supplier parts available for {{ part.full_name }}"; }, - queryParams: function(p) { - return { - part: {{ part.id }} - } - }, - columns: [ - { - checkbox: true, + loadSupplierPartTable( + "#supplier-table", + "{% url 'api-supplier-part-list' %}", + { + params: { + part: {{ part.id }}, + part_detail: true, + supplier_detail: true, + manufacturer_detail: true, }, - { - sortable: true, - field: 'supplier_name', - title: 'Supplier', - formatter: function(value, row, index, field) { - return imageHoverIcon(row.supplier_logo) + renderLink(value, '/company/' + row.supplier + '/'); - } - }, - { - sortable: true, - field: 'SKU', - title: 'SKU', - formatter: function(value, row, index, field) { - return renderLink(value, row.url); - } - }, - { - sortable: true, - field: 'manufacturer', - title: 'Manufacturer', - }, - { - sortable: true, - field: 'MPN', - title: 'MPN', - }, - { - sortable: true, - field: 'pricing', - title: 'Price', - formatter: function(value, row, index, field) { - if (value) { - return value; - } else { - return "No pricing available"; - } - }, - } - ], - url: "{% url 'api-part-supplier-list' %}" - }); + } + ); linkButtonsToSelection($("#supplier-table"), ['#supplier-part-options'])