fixed order item category filter #1079
This commit is contained in:
parent
333d853335
commit
d87e2dbbf0
|
@ -26,6 +26,11 @@ class Controller {
|
|||
return this._order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets filter values from state params
|
||||
*
|
||||
* @param {Object} value - Order data
|
||||
*/
|
||||
set order(value) {
|
||||
if (!value.id || this._order) return;
|
||||
|
||||
|
@ -57,20 +62,18 @@ class Controller {
|
|||
this.itemTypes = [];
|
||||
this.type = null;
|
||||
|
||||
if (!value || (this.category && this.category.id == value.id)) {
|
||||
if (!value || (this.category && this.category.id == value.id))
|
||||
this._category = null;
|
||||
this.updateStateParams();
|
||||
else
|
||||
this._category = value;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
this._category = value;
|
||||
this.updateStateParams();
|
||||
|
||||
const query = `/item/api/ItemCategories/${value.id}/itemTypes`;
|
||||
this.$http.get(query).then(res => {
|
||||
this.itemTypes = res.data;
|
||||
});
|
||||
if (this.tags.length > 0)
|
||||
this.applyFilters();
|
||||
|
||||
if (value)
|
||||
this.updateItemTypes();
|
||||
}
|
||||
|
||||
get type() {
|
||||
|
@ -91,6 +94,16 @@ class Controller {
|
|||
this.applyFilters();
|
||||
}
|
||||
|
||||
/**
|
||||
* Refreshes item type dropdown data
|
||||
*/
|
||||
updateItemTypes() {
|
||||
const query = `/item/api/ItemCategories/${this.category.id}/itemTypes`;
|
||||
this.$http.get(query).then(res => {
|
||||
this.itemTypes = res.data;
|
||||
});
|
||||
}
|
||||
|
||||
onSearch(event) {
|
||||
if (event.key !== 'Enter') return;
|
||||
this.tags.push({
|
||||
|
@ -153,6 +166,9 @@ class Controller {
|
|||
this.$panel = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates url state params from filter values
|
||||
*/
|
||||
updateStateParams() {
|
||||
const params = {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue