From e08e73bbc5248782546683a818a9123deccba02f Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Thu, 4 Jan 2024 13:21:12 +0530 Subject: [PATCH 1/2] CSR-1898 remove modal background shifted to Schedule page and rename ForwardClicked event to TimeSlotSelected --- src/layouts/schedule/schedule.vue | 9 ++++++++- .../time-slot-modal-question.spec.js | 2 +- .../time-slot-modal-question.vue | 4 ++-- src/router/index.js | 6 +----- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index d57f08505..e2acb9d15 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -49,7 +49,7 @@ " @time-slot-modal-closed="timeSlotModalClosed" validationRules="time-slot-selection-required" - @ForwardClicked="forwardButtonAction" /> + @TimeSlotSelected="forwardButtonAction" /> { //Assert expect(wrapper.emitted()["update:modelValue"]).toEqual(expectedEmit); - expect(wrapper.emitted()).toHaveProperty("ForwardClicked"); + expect(wrapper.emitted()).toHaveProperty("TimeSlotSelected"); }); }); diff --git a/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue index ea66c90e7..148a70767 100644 --- a/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue +++ b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue @@ -82,7 +82,7 @@ defineRule("time-slot-required", required(errorMessages.OPTION_REQUIRED)); export default { name: "time-slot-modal-question", - emits: ["update:modelValue", "ForwardClicked"], + emits: ["update:modelValue", "TimeSlotSelected"], props: { modelValue: { type: Object, @@ -351,7 +351,7 @@ export default { "update:modelValue", this.getSelectedTimeSlotInfoObject(this.selectedRouteCode) ); - this.$emit("ForwardClicked"); + this.$emit("TimeSlotSelected"); }, getRelevantDropOffCmsWidgetNameForSelectedTimeSlot( selectedRouteCode, diff --git a/src/router/index.js b/src/router/index.js index 13378f141..04c934769 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -169,11 +169,7 @@ router.beforeEach(async (to, from, next) => { if (fromQueryPage === undefined) { showFmgLoadingModal(true); } - // remove modal backdrop if one exists - let modalBackground = document.querySelector(".modal-backdrop"); - if (modalBackground) { - modalBackground.remove(); - } + const toQueryPage = to.query?.fmgPage; const notToPIAReturn = toQueryPage != fmgPageValues.PAYMENT_PIA_RETURN; const isInIframe = window !== window.top; From 094451ef5d4c8d00a6c6cece3095a371209d8289 Mon Sep 17 00:00:00 2001 From: hiteshkumar87 Date: Thu, 4 Jan 2024 15:11:25 +0530 Subject: [PATCH 2/2] code optimize code optimize --- src/digital-components/modal/modal.vue | 2 +- src/layouts/schedule/schedule.vue | 7 ------- .../time-slot-modal-question/time-slot-modal-question.vue | 3 +++ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/digital-components/modal/modal.vue b/src/digital-components/modal/modal.vue index 2226c3bf3..6e6664ca1 100644 --- a/src/digital-components/modal/modal.vue +++ b/src/digital-components/modal/modal.vue @@ -89,7 +89,7 @@ export default { document.getElementById(this.modalId)?.focus(); }, resetButtonStyle() { - this.$refs.modalButtonMain.resetButtonStyle(); + this.$refs.modalButtonMain?.resetButtonStyle(); }, onModalOpened() { this.onModalOpenedCallback?.(); diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index e2acb9d15..c2fee87ee 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -498,13 +498,6 @@ export default { this.updateFooterButtonText(newValue); }, }, - unmounted() { - // remove modal backdrop if one exists - let modalBackground = document.querySelector(".modal-backdrop"); - if (modalBackground) { - modalBackground.remove(); - } - }, components: { funnelHeader, navbar, diff --git a/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue index 148a70767..d04621894 100644 --- a/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue +++ b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue @@ -494,6 +494,9 @@ export default { }; }, }, + unmounted() { + if (this.isModalOpened) this.closeModal(); + }, watch: { modelValue: { handler(newValue) {