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() {
|
2019-02-13 06:57:08 +00:00
|
|
|
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'
|
|
|
|
}
|
|
|
|
});
|