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

46 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-01-21 10:45:53 +00:00
constructor($scope, $http, $stateParams) {
this.$stateParams = $stateParams;
2018-09-24 12:51:27 +00:00
this.$scope = $scope;
2019-01-21 10:45:53 +00:00
this.$http = $http;
this.searchValue = '';
this.filter = {};
}
onSearch() {
this.$scope.$applyAsync(() => {
2019-01-21 10:45:53 +00:00
this.$scope.treeview.refresh();
});
}
exprBuilder(param, value) {
switch (param) {
case 'search':
return {name: {like: `%${value}%`}};
}
}
onSelection(item) {
const path = '/agency/api/ZoneIncludeds/toggleIsIncluded';
const params = {geoFk: item.id, zoneFk: this.zone.id};
this.$http.post(path, params).then(() => {
this.$scope.treeview.repaintNode(item);
});
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'
}
});