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',
'status',
'status_text',
'target_date',
'notes',
]

View File

@ -141,9 +141,9 @@ function loadPurchaseOrderTable(table, options) {
switchable: false,
},
{
sortable: true,
field: 'reference',
title: '{% trans "Purchase Order" %}',
sortable: true,
switchable: false,
formatter: function(value, row, index, field) {
@ -153,13 +153,19 @@ function loadPurchaseOrderTable(table, options) {
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',
title: '{% trans "Supplier" %}',
sortable: true,
formatter: function(value, row, index, field) {
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,
field: 'description',
title: '{% trans "Description" %}',
sortable: true,
},
{
sortable: true,
field: 'status',
title: '{% trans "Status" %}',
sortable: true,
formatter: function(value, row, index, field) {
return purchaseOrderStatusDisplay(row.status, row.status_text);
}
},
{
sortable: true,
field: 'creation_date',
title: '{% trans "Date" %}',
sortable: true,
},
{
field: 'target_date',
title: '{% trans "Target Date" %}',
sortable: true,
},
{
field: 'line_items',
title: '{% trans "Items" %}'
title: '{% trans "Items" %}',
sortable: true,
},
],
});

View File

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