salix/modules/order/front/catalog-search-panel/index.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

import ngModule from '../module';
2018-12-27 11:54:16 +00:00
import SearchPanel from 'core/components/searchbar/search-panel';
2020-09-08 08:11:22 +00:00
class Controller extends SearchPanel {
constructor($element, $) {
super($element, $);
this.filter = {};
}
get filter() {
return this.$.filter;
}
set filter(value) {
if (!value)
value = {};
if (!value.tags)
value.tags = [{}];
this.$.filter = value;
}
getSourceTable(selection) {
if (!selection || selection.isFree === true)
return null;
if (selection.sourceTable) {
return ''
+ selection.sourceTable.charAt(0).toUpperCase()
+ selection.sourceTable.substring(1) + 's';
} else if (selection.sourceTable == null)
return `ItemTags/filterItemTags/${selection.id}`;
}
addTag() {
this.filter.tags.push({});
this.popover.relocate();
}
}
ngModule.vnComponent('vnOrderCatalogSearchPanel', {
template: require('./index.html'),
2020-09-08 08:11:22 +00:00
controller: Controller,
bindings: {
2020-09-08 08:11:22 +00:00
onSubmit: '&?',
popover: '<?'
}
});