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

45 lines
1.0 KiB
JavaScript
Raw Normal View History

2018-12-04 12:18:27 +00:00
import ngModule from '../module';
2018-09-24 12:51:27 +00:00
class Controller {
2019-09-19 13:51:39 +00:00
constructor($, $http, $stateParams) {
this.$ = $;
2019-01-21 10:45:53 +00:00
this.$http = $http;
2019-09-19 15:49:46 +00:00
this.$stateParams = $stateParams;
2019-01-21 10:45:53 +00:00
}
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
}
}
2019-01-21 10:45:53 +00:00
Controller.$inject = ['$scope', '$http', '$stateParams'];
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'
}
});