From a20e8e2aaf332f637da3b1e443f3b361097a8850 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 5 Oct 2023 10:53:34 -0400 Subject: [PATCH] add timeSlotModalQuestion to schedule --- src/layouts/schedule-page/schedule-page.vue | 45 +++++++++++++++------ src/store/index.js | 27 +++++++++++-- src/store/store.spec.js | 6 ++- 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/src/layouts/schedule-page/schedule-page.vue b/src/layouts/schedule-page/schedule-page.vue index 624acf75..e898b7dc 100644 --- a/src/layouts/schedule-page/schedule-page.vue +++ b/src/layouts/schedule-page/schedule-page.vue @@ -29,7 +29,25 @@ class="text-link-small" :customSelectableDatesCallback="getAvailableDatesMethod" validationRules="date-required" - @date-clicked="openInshopTimeSlotsModal" /> + @dateClicked="openInshopTimeSlotsModal" /> + item.partType === PREMIUM_FEE_PART_TYPE); if (removeEarlyBirdIndex >= 0) { supportingItems.splice(removeEarlyBirdIndex, 1); - this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING, - supportingItems, - false - ); + this.mainStore.saveSupportingItemsSuppressingStateResetting(supportingItems); } } }, @@ -429,7 +446,9 @@ export default { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, forwardButtonAction() { - // validate and save here + this.updateSupportingItems(); + this.mainStore.saveSchedule(this.selectedTimeSlotInfo.timeSlot); + this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route); } } diff --git a/src/store/index.js b/src/store/index.js index 79a600e0..ee056617 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -138,7 +138,8 @@ const getDefaultState = () => ({ startTime: null, endTime: null, routeCode: null, - jobMaxMinutes: null + jobMaxMinutes: null, + jobMinMinutes: null }, referralNumber: null, referralDate: null, @@ -999,7 +1000,8 @@ export const useMainStore = defineStore({ startTime: schedule.startTime, endTime: schedule.endTime, routeCode: schedule.routeCode, - jobMaxMinutes: schedule.jobMaxMinutes + jobMaxMinutes: schedule.jobMaxMinutes, + jobMinMinutes: schedule.jobMinMinutes }, referralDate: this.order.referralDate, referralNumber: this.order.referralNumber?.toString(), @@ -1193,7 +1195,7 @@ export const useMainStore = defineStore({ this.order.schedule.endTime = null; this.order.schedule.routeCode = null; this.order.schedule.jobMaxMinutes = null; - // this.order.schedule.jobMinMinutes = null; + this.order.schedule.jobMinMinutes = null; // premium appointment fee used on schedule page also needs reset when schedule is reset const { supportingItems } = this.order.lineItems; @@ -1398,6 +1400,10 @@ export const useMainStore = defineStore({ this.order.lineItems.glassParts = glassParts; }, saveSupportingItems(supportingItems) { + // TODO: RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES + this.order.lineItems.supportingItems = supportingItems; + }, + saveSupportingItemsSuppressingStateResetting(supportingItems) { this.order.lineItems.supportingItems = supportingItems; }, saveVaps(vaps) { @@ -1477,6 +1483,21 @@ export const useMainStore = defineStore({ }); }, + // Schedule Actions + saveSchedule(scheduleInfo) { + this.updateSchedule(scheduleInfo); + }, + updateSchedule(scheduleInfo) { + if (scheduleInfo) { + this.order.schedule.date = scheduleInfo.date; + this.order.schedule.startTime = scheduleInfo.startTime; + this.order.schedule.endTime = scheduleInfo.endTime; + this.order.schedule.routeCode = scheduleInfo.routeCode; + this.order.schedule.jobMaxMinutes = scheduleInfo.jobMaxMinutes; + this.order.schedule.jobMinMinutes = scheduleInfo.jobMinMinutes; + } + }, + // Analytics Actions logExperimentExposure({ userId, sessionKey, pageName, experiment }) { return globalMethods.callHttpClient({ diff --git a/src/store/store.spec.js b/src/store/store.spec.js index aea99622..3aec63ef 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -799,7 +799,8 @@ describe('Store', () => { startTime: getRandomString(6, 6), endTime: getRandomString(6, 6), routeCode: getRandomString(6, 6), - jobMaxMinutes: getRandomString(6, 6) + jobMaxMinutes: getRandomString(6, 6), + jobMinMinutes: getRandomString(6, 6) }; store.order.schedule = schedule; globalMethods.callHttpClient = jest.fn().mockReturnValue(Promise.resolve({})); @@ -815,7 +816,8 @@ describe('Store', () => { startTime: schedule.startTime, endTime: schedule.endTime, routeCode: schedule.routeCode, - jobMaxMinutes: schedule.jobMaxMinutes + jobMaxMinutes: schedule.jobMaxMinutes, + jobMinMinutes: schedule.jobMinMinutes }) }) }));