Use client-side rendering for list of purchase orders

This commit is contained in:
Oliver Walters 2019-12-09 21:33:27 +11:00
parent 25e5a64cee
commit a257f94ac0
2 changed files with 38 additions and 2 deletions

View File

@ -98,4 +98,39 @@ function removePurchaseOrderLineItem(e) {
launchModalForm(url, {
reload: true,
});
}
function orderStatusLabel(code, label) {
/* Render a purchase-order status label. */
var html = "<span class='label";
switch (code) {
case 10: // pending
html += " label-info";
break;
case 20: // placed
html += " label-primary";
break;
case 30: // complete
html += " label-success";
break;
case 40: // cancelled
case 50: // lost
html += " label-warning";
break;
case 60: // returned
html += " label-danger";
break;
default:
break;
}
html += "'>";
html += label;
html += "</span>";
console.log(html);
return html;
}

View File

@ -18,8 +18,6 @@ InvenTree | Purchase Orders
</div>
</div>
{% include "order/po_table.html" with toolbar='#table-buttons' %}
<table class='table table-striped table-condensed po-table' id='purchase-order-table'>
</table>
@ -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,