2018-06-07 21:47:19 +00:00
|
|
|
import ngModule from '../module';
|
2018-12-27 11:54:16 +00:00
|
|
|
import SearchPanel from 'core/components/searchbar/search-panel';
|
2018-06-07 21:47:19 +00:00
|
|
|
|
|
|
|
class Controller extends SearchPanel {
|
|
|
|
set filter(value) {
|
2019-01-16 14:29:01 +00:00
|
|
|
if (!value)
|
|
|
|
value = {};
|
|
|
|
if (!value.tags)
|
|
|
|
value.tags = [{}];
|
2018-06-07 21:47:19 +00:00
|
|
|
|
|
|
|
this.$.filter = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
get filter() {
|
|
|
|
return this.$.filter;
|
|
|
|
}
|
|
|
|
|
|
|
|
getSourceTable(selection) {
|
|
|
|
if (!selection || selection.isFree === true)
|
|
|
|
return null;
|
|
|
|
|
2019-01-15 13:53:38 +00:00
|
|
|
if (selection.sourceTable) {
|
2018-06-07 21:47:19 +00:00
|
|
|
return '/api/'
|
|
|
|
+ selection.sourceTable.charAt(0).toUpperCase()
|
|
|
|
+ selection.sourceTable.substring(1) + 's';
|
2019-01-15 13:53:38 +00:00
|
|
|
} else if (selection.sourceTable == null)
|
2018-06-07 21:47:19 +00:00
|
|
|
return `/api/ItemTags/filterItemTags/${selection.id}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnItemSearchPanel', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller
|
|
|
|
});
|