2018-12-04 12:18:27 +00:00
|
|
|
import ngModule from '../module';
|
|
|
|
|
|
|
|
class Controller {
|
2018-12-04 13:38:56 +00:00
|
|
|
constructor($scope, $state, $http) {
|
|
|
|
this.$scope = $scope;
|
|
|
|
this.$state = $state;
|
|
|
|
this.$http = $http;
|
2018-12-04 12:18:27 +00:00
|
|
|
this.moreOptions = [
|
2018-12-04 13:38:56 +00:00
|
|
|
{callback: this.deleteZone, name: 'Delete'}
|
2018-12-04 12:18:27 +00:00
|
|
|
];
|
|
|
|
}
|
2018-12-04 13:38:56 +00:00
|
|
|
|
|
|
|
onMoreChange(callback) {
|
|
|
|
callback.call(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
deleteZone() {
|
|
|
|
this.$scope.deleteZone.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
returnDialog(response) {
|
|
|
|
if (response === 'ACCEPT') {
|
|
|
|
this.$http.delete(`/agency/api/Zones/${this.zone.id}`).then(() => {
|
|
|
|
this.$state.go('zone.index');
|
|
|
|
});
|
|
|
|
}
|
2019-01-25 14:08:11 +00:00
|
|
|
console.log('res', response);
|
2018-12-04 13:38:56 +00:00
|
|
|
}
|
2018-12-04 12:18:27 +00:00
|
|
|
}
|
|
|
|
|
2018-12-04 13:38:56 +00:00
|
|
|
Controller.$inject = ['$scope', '$state', '$http'];
|
|
|
|
|
2018-12-04 12:18:27 +00:00
|
|
|
ngModule.component('vnZoneDescriptor', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
zone: '<'
|
|
|
|
}
|
|
|
|
});
|