salix/modules/zone/front/descriptor/index.js

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: '<'
}
});