@@ -39,7 +45,12 @@
+
+
\ No newline at end of file
diff --git a/modules/zone/front/descriptor/index.js b/modules/zone/front/descriptor/index.js
index a68a450ea..4b51c8011 100644
--- a/modules/zone/front/descriptor/index.js
+++ b/modules/zone/front/descriptor/index.js
@@ -10,9 +10,33 @@ class Controller extends Descriptor {
this.entity = value;
}
- onDeleteAccept() {
- return this.$http.delete(`Zones/${this.id}`)
- .then(() => this.$state.go('zone.index'));
+ onDelete() {
+ const $t = this.$translate.instant;
+ const today = new Date();
+ today.setHours(0, 0, 0, 0);
+ const filter = {where: {zoneFk: this.id, shipped: {gte: today}}};
+ this.$http.get(`Tickets`, {filter}).then(res => {
+ const ticketsAmount = res.data.length;
+ if (ticketsAmount) {
+ const params = {ticketsAmount};
+ console.log('ticketsAmount', res.data);
+ const question = $t('This zone contains tickets', params, null, null, 'sanitizeParameters');
+ this.$.deleteZone.question = question;
+ this.$.deleteZone.show();
+ } else
+ this.deleteZone();
+ });
+ }
+
+ deleteZone() {
+ return this.$http.post(`Zones/${this.id}/deleteZone`).then(() => {
+ this.$state.go('zone.index');
+ this.vnApp.showSuccess(this.$t('Zone deleted'));
+ });
+ }
+ onCloneAccept() {
+ return this.$http.post(`Zones/${this.id}/clone`).
+ then(res => this.$state.go('zone.card.basicData', {id: res.data.id}));
}
}
diff --git a/modules/zone/front/descriptor/locale/es.yml b/modules/zone/front/descriptor/locale/es.yml
new file mode 100644
index 000000000..67bcbb5b7
--- /dev/null
+++ b/modules/zone/front/descriptor/locale/es.yml
@@ -0,0 +1,4 @@
+This zone contains tickets: Esta zona contiene {{ticketsAmount}} tickets. ¿Seguro que quieres eliminar esta zona?
+Do you want to clone this zone?: ¿Quieres clonar esta zona?
+All it's properties will be copied: Todas sus propiedades serán copiadas
+Zone deleted: Zona eliminada
\ No newline at end of file