2018-12-04 12:18:27 +00:00
|
|
|
import ngModule from '../module';
|
2020-03-18 11:55:22 +00:00
|
|
|
import Component from 'core/lib/component';
|
2018-12-04 12:18:27 +00:00
|
|
|
|
2020-03-18 11:55:22 +00:00
|
|
|
class Controller extends Component {
|
|
|
|
$onInit() {
|
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() {
|
2020-03-18 11:55:22 +00:00
|
|
|
this.$.deleteZone.show();
|
2018-12-04 13:38:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
returnDialog(response) {
|
2019-10-30 15:57:14 +00:00
|
|
|
if (response === 'accept') {
|
2019-10-24 22:53:53 +00:00
|
|
|
this.$http.delete(`Zones/${this.zone.id}`).then(() => {
|
2018-12-04 13:38:56 +00:00
|
|
|
this.$state.go('zone.index');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2018-12-04 12:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ngModule.component('vnZoneDescriptor', {
|
|
|
|
template: require('./index.html'),
|
|
|
|
controller: Controller,
|
|
|
|
bindings: {
|
|
|
|
zone: '<'
|
|
|
|
}
|
|
|
|
});
|