diff --git a/src/locales/en.json b/src/locales/en.json index dac2b2d0..ce20c759 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -13,6 +13,7 @@ "Additional documents": "Additional documents", "Address 1": "Address 1", "Address 2": "Address 2", + "Any edits made on this page will be lost.": "Any edits made on this page will be lost.", "Apply": "Apply", "Approved": "Approved", "Authenticating": "Authenticating", @@ -169,6 +170,8 @@ "In Progress": "In Progress", "Key": "Key", "Language": "Language", + "LEAVE": "LEAVE", + "Leave page": "Leave page", "Linked picklist": "Linked picklist", "Last brokered": "Last brokered", "Loading": "Loading", @@ -372,6 +375,7 @@ "Status": "Status", "store name": "store name", "Store": "Store", + "STAY": "STAY", "The import orders has been uploaded successfully": "The import orders has been uploaded successfully", "The picked quantity cannot exceed the ordered quantity.": "The picked quantity cannot exceed the ordered quantity.", "The timezone you select is used to ensure automations you schedule are always accurate to the time you select.": "The timezone you select is used to ensure automations you schedule are always accurate to the time you select.", diff --git a/src/locales/es.json b/src/locales/es.json index 6af24614..d99a8f9a 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -13,6 +13,7 @@ "Additional documents": "Documentos adicionales", "Address 1": "Dirección 1", "Address 2": "Dirección 2", + "Any edits made on this page will be lost.": "Any edits made on this page will be lost.", "Apply": "Aplicar", "Approved": "Aprovado", "Authenticating": "Autenticando", @@ -167,6 +168,8 @@ "In Progress": "En Curso", "Key": "Clave", "Language": "Lenguaje", + "LEAVE": "LEAVE", + "Leave page": "Leave page", "Linked picklist": "Lista de selección vinculada", "Last brokered": "Última intermediación", "Loading": "Cargando", @@ -368,6 +371,7 @@ "STANDARD": "STANDARD", "State": "Estado", "Status": "Estatus", + "STAY": "STAY", "Store name": "Nombre de la tienda", "Store": "Tienda", "The import orders has been uploaded successfully": "Los pedidos de importación se han cargado exitosamente", diff --git a/src/views/RejectionReasons.vue b/src/views/RejectionReasons.vue index e93ef190..f621470a 100644 --- a/src/views/RejectionReasons.vue +++ b/src/views/RejectionReasons.vue @@ -67,6 +67,7 @@ import { IonSearchbar, IonTitle, IonToolbar, + alertController, modalController, popoverController } from '@ionic/vue'; @@ -116,6 +117,34 @@ export default defineComponent({ await Promise.all([this.store.dispatch('util/fetchRejectReasons'), this.store.dispatch('util/fetchRejectReasonEnumTypes')]) this.filteredReasons = this.rejectReasons ? JSON.parse(JSON.stringify(this.rejectReasons)) : [] }, + async beforeRouteLeave() { + if(!this.toast) return + + let canLeave = false; + const alert = await alertController.create({ + header: translate("Leave page"), + message: translate("Any edits made on this page will be lost."), + buttons: [ + { + text: translate("STAY"), + handler: () => { + canLeave = false; + }, + }, + { + text: translate("LEAVE"), + handler: () => { + canLeave = true; + this.toast.dismiss() + }, + }, + ], + }); + + alert.present() + await alert.onDidDismiss() + return canLeave + }, methods: { async openCreateRejectionReasonModal() { const createRejectionReasonModal = await modalController.create({