54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
import ngModule from '../module';
|
|
import SearchPanel from 'core/components/searchbar/search-panel';
|
|
|
|
class Controller extends SearchPanel {
|
|
constructor($element, $) {
|
|
super($element, $);
|
|
|
|
this.filter = {};
|
|
}
|
|
|
|
get filter() {
|
|
return this.$.filter;
|
|
}
|
|
|
|
set filter(value) {
|
|
if (!value)
|
|
value = {};
|
|
if (!value.values)
|
|
value.values = [{}];
|
|
|
|
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}`;
|
|
}
|
|
|
|
addValue() {
|
|
this.filter.values.push({});
|
|
setTimeout(() => this.popover.relocate());
|
|
}
|
|
|
|
changeTag() {
|
|
|
|
}
|
|
}
|
|
|
|
ngModule.vnComponent('vnOrderCatalogSearchPanel', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
onSubmit: '&?',
|
|
popover: '<?'
|
|
}
|
|
});
|