33 lines
852 B
JavaScript
33 lines
852 B
JavaScript
|
import ngModule from '../module';
|
||
|
import SearchPanel from 'core/src/components/searchbar/search-panel';
|
||
|
|
||
|
class Controller extends SearchPanel {
|
||
|
set filter(value) {
|
||
|
if (!value.tags)
|
||
|
value.tags = [{}];
|
||
|
|
||
|
this.$.filter = value;
|
||
|
}
|
||
|
|
||
|
get filter() {
|
||
|
return this.$.filter;
|
||
|
}
|
||
|
|
||
|
getSourceTable(selection) {
|
||
|
if (!selection || selection.isFree === true)
|
||
|
return null;
|
||
|
|
||
|
if (selection.sourceTable)
|
||
|
return '/api/'
|
||
|
+ selection.sourceTable.charAt(0).toUpperCase()
|
||
|
+ selection.sourceTable.substring(1) + 's';
|
||
|
else if (selection.sourceTable == null)
|
||
|
return `/api/ItemTags/filterItemTags/${selection.id}`;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
ngModule.component('vnItemSearchPanel', {
|
||
|
template: require('./index.html'),
|
||
|
controller: Controller
|
||
|
});
|