salix/modules/agency/front/location/index.js

38 lines
932 B
JavaScript
Raw Normal View History

2018-12-04 12:18:27 +00:00
import ngModule from '../module';
import Section from 'core/lib/section';
2018-09-24 12:51:27 +00:00
class Controller extends Section {
2019-09-19 13:51:39 +00:00
onSearch(params) {
this.$.model.applyFilter(null, params);
this.$.$applyAsync(() => this.$.treeview.refresh());
2019-01-21 10:45:53 +00:00
}
exprBuilder(param, value) {
switch (param) {
case 'search':
return {name: {like: `%${value}%`}};
}
}
2019-02-18 07:37:26 +00:00
onSelection(item, isIncluded) {
2019-02-25 09:03:50 +00:00
let node = Object.assign({}, item);
node.isIncluded = isIncluded;
node.childs = []; // Data too large
2019-02-18 07:37:26 +00:00
2019-02-25 09:03:50 +00:00
const path = '/agency/api/ZoneIncludeds/toggleIsIncluded';
const params = {zoneFk: this.zone.id, item: node};
this.$http.post(path, params);
2018-09-24 12:51:27 +00:00
}
}
2018-12-04 12:18:27 +00:00
ngModule.component('vnZoneLocation', {
2018-09-24 12:51:27 +00:00
template: require('./index.html'),
controller: Controller,
bindings: {
zone: '<'
},
require: {
card: '^vnZoneCard'
}
});