mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Add Date input for table filter (#4067)
* Add Date input for table filter * Update filters.js * Update filters.js * Expiry date filter on stock item * JS whitespace * Timezone from JS * Move to timestamp timezoned * Revert to YYYY-MM-DD iso format * Remove setting/ getFilterSettings from addTableFilter
This commit is contained in:
@ -182,6 +182,8 @@ function getFilterOptionList(tableKey, filterKey) {
|
||||
value: '{% trans "false" %}',
|
||||
},
|
||||
};
|
||||
} else if (settings.type == 'date') {
|
||||
return 'date';
|
||||
} else if ('options' in settings) {
|
||||
return settings.options;
|
||||
}
|
||||
@ -233,6 +235,8 @@ function generateFilterInput(tableKey, filterKey) {
|
||||
// A 'null' options list means that a simple text-input dialog should be used
|
||||
if (options == null) {
|
||||
html = `<input class='form-control filter-input' id='${id}' name='value'></input>`;
|
||||
} else if (options == 'date') {
|
||||
html = `<input type='date' class='dateinput form-control filter-input' id='${id}' name='value'></input>`;
|
||||
} else {
|
||||
// Return a 'select' input with the available values
|
||||
html = `<select class='form-control filter-input' id='${id}' name='value'>`;
|
||||
|
@ -280,6 +280,14 @@ function getAvailableTableFilters(tableKey) {
|
||||
title: '{% trans "Has purchase price" %}',
|
||||
description: '{% trans "Show stock items which have a purchase price set" %}',
|
||||
},
|
||||
expiry_date_lte: {
|
||||
type: 'date',
|
||||
title: '{% trans "Expiry Date before" %}',
|
||||
},
|
||||
expiry_date_gte: {
|
||||
type: 'date',
|
||||
title: '{% trans "Expiry Date after" %}',
|
||||
},
|
||||
};
|
||||
|
||||
// Optional filters if stock expiry functionality is enabled
|
||||
|
Reference in New Issue
Block a user