diff --git a/InvenTree/InvenTree/static/script/inventree/order.js b/InvenTree/InvenTree/static/script/inventree/order.js index d583ebcdc4..b48c0f4e64 100644 --- a/InvenTree/InvenTree/static/script/inventree/order.js +++ b/InvenTree/InvenTree/static/script/inventree/order.js @@ -144,11 +144,74 @@ function loadPurchaseOrderTable(table, options) { return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`); } }, + { + sortable: true, + field: 'description', + title: 'Description', + }, + { + sortable: true, + field: 'status', + title: 'Status', + formatter: function(value, row, index, field) { + return orderStatusDisplay(row.status, row.status_text); + } + }, { sortable: true, field: 'creation_date', title: 'Date', }, + { + sortable: true, + field: 'line_items', + title: 'Items' + }, + ], + }); +} + +function loadSalesOrderTable(table, options) { + + options.params = options.params || {}; + options.params['customer_detail'] = true; + + var filters = loadTableFilters("table"); + + for (var key in options.params) { + filters[key] = options.params[key]; + } + + setupFilterList("order", $(table)); + + $(table).inventreeTable({ + url: options.url, + queryParams: filters, + groupBy: false, + original: options.params, + formatNoMatches: function() { return "No sales orders found"; }, + columns: [ + { + field: 'pk', + title: 'ID', + visible: false, + }, + { + sortable: true, + field: 'reference', + title: 'Sales Order', + formatter: function(value, row, index, field) { + return renderLink(value, `/order/sales-order/${row.pk}/`); + }, + }, + { + sortable: true, + field: 'customer_detail', + title: 'Customer', + formatter: function(value, row, index, field) { + return imageHoverIcon(row.customer_detail.image) + renderLink(row.customer_detail.name, `/company/${row.customer}/sales-orders/`); + } + }, { sortable: true, field: 'description', @@ -162,6 +225,11 @@ function loadPurchaseOrderTable(table, options) { return orderStatusDisplay(row.status, row.status_text); } }, + { + sortable: true, + field: 'creation_date', + title: 'Date', + }, { sortable: true, field: 'line_items', diff --git a/InvenTree/company/templates/company/purchase_orders.html b/InvenTree/company/templates/company/purchase_orders.html index 3f940a93e7..eac4066f2d 100644 --- a/InvenTree/company/templates/company/purchase_orders.html +++ b/InvenTree/company/templates/company/purchase_orders.html @@ -11,7 +11,7 @@