Skip to content

Commit

Permalink
Merge pull request #467 from amansinghbais/466-alert-before-leaving-page
Browse files Browse the repository at this point in the history
Implemented: alert before leaving the rejection reasons page after reordering the rejection reasons (#466)
  • Loading branch information
ymaheshwari1 authored Mar 20, 2024
2 parents f2fa0f7 + 406135b commit 2dcbc23
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.",
Expand Down
4 changes: 4 additions & 0 deletions src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
29 changes: 29 additions & 0 deletions src/views/RejectionReasons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
IonSearchbar,
IonTitle,
IonToolbar,
alertController,
modalController,
popoverController
} from '@ionic/vue';
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit 2dcbc23

Please sign in to comment.