diff --git a/InvenTree/InvenTree/static/script/inventree/order.js b/InvenTree/InvenTree/static/script/inventree/order.js index babdf34f83..4ef2fae019 100644 --- a/InvenTree/InvenTree/static/script/inventree/order.js +++ b/InvenTree/InvenTree/static/script/inventree/order.js @@ -104,8 +104,21 @@ function removePurchaseOrderLineItem(e) { function loadPurchaseOrderTable(table, options) { /* Create a purchase-order table */ + var params = options.params || {}; + + var filters = loadTableFilters("build"); + + for (var key in params) { + filters[key] = params[key]; + } + + setupFilterList("order", table); + table.inventreeTable({ url: options.url, + queryParams: filters, + groupBy: false, + original: params, formatNoMatches: function() { return "No purchase orders found"; }, columns: [ { @@ -144,7 +157,7 @@ function loadPurchaseOrderTable(table, options) { field: 'status', title: 'Status', formatter: function(value, row, index, field) { - return orderStatusLabel(row.status, row.status_text); + return orderStatusDisplay(row.status, row.status_text); } }, { @@ -155,37 +168,3 @@ function loadPurchaseOrderTable(table, options) { ], }); } - - -function orderStatusLabel(code, label) { - /* Render a purchase-order status label. */ - - var html = ""; - html += label; - html += ""; - - return html; -} \ No newline at end of file diff --git a/InvenTree/order/templates/order/order_status.html b/InvenTree/order/templates/order/order_status.html deleted file mode 100644 index c9e13cac24..0000000000 --- a/InvenTree/order/templates/order/order_status.html +++ /dev/null @@ -1,13 +0,0 @@ -{% if order.status == OrderStatus.PENDING %} - -{% elif order.status == OrderStatus.PLACED %} - -{% elif order.status == OrderStatus.COMPLETE %} - -{% elif order.status == OrderStatus.CANCELLED or order.status == OrderStatus.RETURNED %} - -{% else %} - -{% endif %} -{{ order.get_status_display }} - \ No newline at end of file diff --git a/InvenTree/order/templates/order/po_table.html b/InvenTree/order/templates/order/po_table.html deleted file mode 100644 index 712553e866..0000000000 --- a/InvenTree/order/templates/order/po_table.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - {% for order in orders %} - - - - - - - - {% endfor %} - -
CompanyOrder ReferenceDescriptionStatusItems
{% include "hover_image.html" with image=order.supplier.image hover=True %}{{ order.supplier.name }}{{ order }}{{ order.description }}{% include "order/order_status.html" %}{{ order.lines.count }}
\ 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 644e6418fa..d985b814df 100644 --- a/InvenTree/order/templates/order/purchase_orders.html +++ b/InvenTree/order/templates/order/purchase_orders.html @@ -13,8 +13,11 @@ InvenTree | Purchase Orders
-
+
+
+ +
diff --git a/InvenTree/templates/status_codes.html b/InvenTree/templates/status_codes.html index 0d92b6f467..36d5aa8b3e 100644 --- a/InvenTree/templates/status_codes.html +++ b/InvenTree/templates/status_codes.html @@ -1,3 +1,6 @@ +/* + * Status codes for the {{ label }} model. + */ var {{ label }}Codes = { {% for opt in options %}'{{ opt.key }}': { key: '{{ opt.key }}', @@ -6,6 +9,11 @@ var {{ label }}Codes = { },{% endfor %} }; +/* + * Render the status for a {{ label }} object. + * Uses the values specified in "status_codes.py" + * This function is generated by the "status_codes.html" template + */ function {{ label }}StatusDisplay(key) { key = String(key);