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

39 lines
836 B
JavaScript
Raw Normal View History

2018-12-04 12:18:27 +00:00
import ngModule from '../module';
class Controller {
constructor($scope, $state, $http) {
this.$scope = $scope;
this.$state = $state;
this.$http = $http;
2018-12-04 12:18:27 +00:00
this.moreOptions = [
{callback: this.deleteZone, name: 'Delete'}
2018-12-04 12:18:27 +00:00
];
}
onMoreChange(callback) {
callback.call(this);
}
deleteZone() {
this.$scope.deleteZone.show();
}
returnDialog(response) {
2019-10-30 15:57:14 +00:00
if (response === 'accept') {
this.$http.delete(`Zones/${this.zone.id}`).then(() => {
this.$state.go('zone.index');
});
}
}
2018-12-04 12:18:27 +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: '<'
}
});