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

47 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}%`}};
}
}
2019-02-18 07:37:26 +00:00
onSelection(item, isIncluded) {
item.isIncluded = isIncluded;
2019-01-21 10:45:53 +00:00
const path = '/agency/api/ZoneIncludeds/toggleIsIncluded';
2019-02-18 07:37:26 +00:00
const params = {zoneFk: this.zone.id, item};
2019-01-21 10:45:53 +00:00
this.$http.post(path, params).then(() => {
2019-02-18 07:37:26 +00:00
2019-01-21 10:45:53 +00:00
});
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'
}
});