39 lines
836 B
JavaScript
39 lines
836 B
JavaScript
import ngModule from '../module';
|
|
|
|
class Controller {
|
|
constructor($scope, $state, $http) {
|
|
this.$scope = $scope;
|
|
this.$state = $state;
|
|
this.$http = $http;
|
|
this.moreOptions = [
|
|
{callback: this.deleteZone, name: 'Delete'}
|
|
];
|
|
}
|
|
|
|
onMoreChange(callback) {
|
|
callback.call(this);
|
|
}
|
|
|
|
deleteZone() {
|
|
this.$scope.deleteZone.show();
|
|
}
|
|
|
|
returnDialog(response) {
|
|
if (response === 'ACCEPT') {
|
|
this.$http.delete(`Zones/${this.zone.id}`).then(() => {
|
|
this.$state.go('zone.index');
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
Controller.$inject = ['$scope', '$state', '$http'];
|
|
|
|
ngModule.component('vnZoneDescriptor', {
|
|
template: require('./index.html'),
|
|
controller: Controller,
|
|
bindings: {
|
|
zone: '<'
|
|
}
|
|
});
|