From a257f94ac0ea839afe44f2b58cc255bb1f55d235 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 9 Dec 2019 21:33:27 +1100 Subject: [PATCH] Use client-side rendering for list of purchase orders --- .../static/script/inventree/order.js | 35 +++++++++++++++++++ .../templates/order/purchase_orders.html | 5 +-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/InvenTree/InvenTree/static/script/inventree/order.js b/InvenTree/InvenTree/static/script/inventree/order.js index 818596f7c9..04bbee513f 100644 --- a/InvenTree/InvenTree/static/script/inventree/order.js +++ b/InvenTree/InvenTree/static/script/inventree/order.js @@ -98,4 +98,39 @@ function removePurchaseOrderLineItem(e) { launchModalForm(url, { reload: true, }); +} + +function orderStatusLabel(code, label) { + /* Render a purchase-order status label. */ + + var html = ""; + html += label; + html += ""; + + console.log(html); + + return html; } \ No newline at end of file diff --git a/InvenTree/order/templates/order/purchase_orders.html b/InvenTree/order/templates/order/purchase_orders.html index a85398c0ad..1fc15d623c 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -18,8 +18,6 @@ InvenTree | Purchase Orders -{% include "order/po_table.html" with toolbar='#table-buttons' %} -
@@ -78,6 +76,9 @@ $("#purchase-order-table").inventreeTable({ sortable: true, field: 'status_text', title: 'Status', + formatter: function(value, row, index, field) { + return orderStatusLabel(row.status, row.status_text); + } }, { sortable: true,