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

38 lines
932 B
JavaScript

import ngModule from '../module';
import Section from 'core/lib/section';
class Controller extends Section {
onSearch(params) {
this.$.model.applyFilter(null, params);
this.$.$applyAsync(() => this.$.treeview.refresh());
}
exprBuilder(param, value) {
switch (param) {
case 'search':
return {name: {like: `%${value}%`}};
}
}
onSelection(item, isIncluded) {
let node = Object.assign({}, item);
node.isIncluded = isIncluded;
node.childs = []; // Data too large
const path = '/agency/api/ZoneIncludeds/toggleIsIncluded';
const params = {zoneFk: this.zone.id, item: node};
this.$http.post(path, params);
}
}
ngModule.component('vnZoneLocation', {
template: require('./index.html'),
controller: Controller,
bindings: {
zone: '<'
},
require: {
card: '^vnZoneCard'
}
});