mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-03 22:08:49 +00:00
Pass dates displayed in front-end tables through the date formatter
This commit is contained in:
parent
c720c75b79
commit
040f1805e0
@ -165,6 +165,9 @@ function loadAttachmentTable(url, options) {
|
|||||||
{
|
{
|
||||||
field: 'upload_date',
|
field: 'upload_date',
|
||||||
title: '{% trans "Upload Date" %}',
|
title: '{% trans "Upload Date" %}',
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'actions',
|
field: 'actions',
|
||||||
|
@ -1961,6 +1961,9 @@ function loadBuildTable(table, options) {
|
|||||||
field: 'creation_date',
|
field: 'creation_date',
|
||||||
title: '{% trans "Created" %}',
|
title: '{% trans "Created" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'issued_by',
|
field: 'issued_by',
|
||||||
@ -1990,11 +1993,17 @@ function loadBuildTable(table, options) {
|
|||||||
field: 'target_date',
|
field: 'target_date',
|
||||||
title: '{% trans "Target Date" %}',
|
title: '{% trans "Target Date" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'completion_date',
|
field: 'completion_date',
|
||||||
title: '{% trans "Completion Date" %}',
|
title: '{% trans "Completion Date" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
@ -848,11 +848,17 @@ function loadPurchaseOrderTable(table, options) {
|
|||||||
field: 'creation_date',
|
field: 'creation_date',
|
||||||
title: '{% trans "Date" %}',
|
title: '{% trans "Date" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'target_date',
|
field: 'target_date',
|
||||||
title: '{% trans "Target Date" %}',
|
title: '{% trans "Target Date" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
field: 'line_items',
|
field: 'line_items',
|
||||||
@ -1269,16 +1275,25 @@ function loadSalesOrderTable(table, options) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'creation_date',
|
field: 'creation_date',
|
||||||
title: '{% trans "Creation Date" %}',
|
title: '{% trans "Creation Date" %}',
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'target_date',
|
field: 'target_date',
|
||||||
title: '{% trans "Target Date" %}',
|
title: '{% trans "Target Date" %}',
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'shipment_date',
|
field: 'shipment_date',
|
||||||
title: '{% trans "Shipment Date" %}',
|
title: '{% trans "Shipment Date" %}',
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
@ -1430,9 +1445,9 @@ function loadSalesOrderShipmentTable(table, options={}) {
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
if (value) {
|
if (value) {
|
||||||
return value;
|
return renderDate(value);
|
||||||
} else {
|
} else {
|
||||||
return '{% trans "Not shipped" %}';
|
return '<em>{% trans "Not shipped" %}</em>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1820,6 +1820,9 @@ function loadStockTable(table, options) {
|
|||||||
col = {
|
col = {
|
||||||
field: 'stocktake_date',
|
field: 'stocktake_date',
|
||||||
title: '{% trans "Stocktake" %}',
|
title: '{% trans "Stocktake" %}',
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!options.params.ordering) {
|
if (!options.params.ordering) {
|
||||||
@ -1833,6 +1836,9 @@ function loadStockTable(table, options) {
|
|||||||
title: '{% trans "Expiry Date" %}',
|
title: '{% trans "Expiry Date" %}',
|
||||||
visible: global_settings.STOCK_ENABLE_EXPIRY,
|
visible: global_settings.STOCK_ENABLE_EXPIRY,
|
||||||
switchable: global_settings.STOCK_ENABLE_EXPIRY,
|
switchable: global_settings.STOCK_ENABLE_EXPIRY,
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!options.params.ordering) {
|
if (!options.params.ordering) {
|
||||||
@ -1844,6 +1850,9 @@ function loadStockTable(table, options) {
|
|||||||
col = {
|
col = {
|
||||||
field: 'updated',
|
field: 'updated',
|
||||||
title: '{% trans "Last Updated" %}',
|
title: '{% trans "Last Updated" %}',
|
||||||
|
formatter: function(value) {
|
||||||
|
return renderDate(value);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!options.params.ordering) {
|
if (!options.params.ordering) {
|
||||||
@ -2649,14 +2658,7 @@ function loadStockTrackingTable(table, options) {
|
|||||||
title: '{% trans "Date" %}',
|
title: '{% trans "Date" %}',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
formatter: function(value) {
|
formatter: function(value) {
|
||||||
var m = moment(value);
|
return renderDate(value);
|
||||||
|
|
||||||
if (m.isValid()) {
|
|
||||||
var html = m.format('dddd MMMM Do YYYY'); // + '<br>' + m.format('h:mm a');
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<i>{% trans "Invalid date" %}</i>';
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user