Display overdue status in purchase order table

- Allow table to be filtered by "overdue" status
This commit is contained in:
Oliver Walters 2021-01-14 17:37:10 +11:00
parent 4d73aab090
commit a8e6d0a89f
3 changed files with 23 additions and 7 deletions

View File

@ -86,6 +86,7 @@ class POSerializer(InvenTreeModelSerializer):
'supplier_reference', 'supplier_reference',
'status', 'status',
'status_text', 'status_text',
'target_date',
'notes', 'notes',
] ]

View File

@ -141,9 +141,9 @@ function loadPurchaseOrderTable(table, options) {
switchable: false, switchable: false,
}, },
{ {
sortable: true,
field: 'reference', field: 'reference',
title: '{% trans "Purchase Order" %}', title: '{% trans "Purchase Order" %}',
sortable: true,
switchable: false, switchable: false,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
@ -153,13 +153,19 @@ function loadPurchaseOrderTable(table, options) {
value = `${prefix}${value}`; value = `${prefix}${value}`;
} }
return renderLink(value, `/order/purchase-order/${row.pk}/`); var html = renderLink(value, `/order/purchase-order/${row.pk}/`);
if (row.overdue) {
html += makeIconBadge('fa-calendar-times icon-red', '{% trans "Order is overdue" %}');
}
return html;
} }
}, },
{ {
sortable: true,
field: 'supplier_detail', field: 'supplier_detail',
title: '{% trans "Supplier" %}', title: '{% trans "Supplier" %}',
sortable: true,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`); return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`);
} }
@ -170,27 +176,32 @@ function loadPurchaseOrderTable(table, options) {
sortable: true, sortable: true,
}, },
{ {
sortable: true,
field: 'description', field: 'description',
title: '{% trans "Description" %}', title: '{% trans "Description" %}',
sortable: true,
}, },
{ {
sortable: true,
field: 'status', field: 'status',
title: '{% trans "Status" %}', title: '{% trans "Status" %}',
sortable: true,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
return purchaseOrderStatusDisplay(row.status, row.status_text); return purchaseOrderStatusDisplay(row.status, row.status_text);
} }
}, },
{ {
sortable: true,
field: 'creation_date', field: 'creation_date',
title: '{% trans "Date" %}', title: '{% trans "Date" %}',
sortable: true,
}, },
{ {
field: 'target_date',
title: '{% trans "Target Date" %}',
sortable: true, sortable: true,
},
{
field: 'line_items', field: 'line_items',
title: '{% trans "Items" %}' title: '{% trans "Items" %}',
sortable: true,
}, },
], ],
}); });

View File

@ -214,6 +214,10 @@ function getAvailableTableFilters(tableKey) {
type: 'bool', type: 'bool',
title: '{% trans "Outstanding" %}', title: '{% trans "Outstanding" %}',
}, },
overdue: {
type: 'bool',
title: '{% trans "Overdue" %}',
},
}; };
} }