From 461f2ae5dca004bbefb361dc9c85fbf7d961e997 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 29 Jan 2026 22:04:16 -0500 Subject: [PATCH] some updates when changing zipcode to certain types --- .../date-picker/date-picker.vue | 7 ++- src/layouts/schedule-page/schedule-page.vue | 48 +++++++++++-------- .../service-location/service-location.vue | 8 +++- src/store/index.js | 1 + 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index 1e36cd68..b785a171 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -590,8 +590,11 @@ export default { this.findInitialDate(config.preSelectedDate, pageIndexObj.initialDayIndex); } else { this.findFirstAvailableDateInView(); - while (!this.selectedDate) { - this.gotoNextPage(); + let attempts = 0; + while (!this.selectedDate && attempts < 5) { + // eslint-disable-next-line no-await-in-loop + await this.gotoNextPage(); + attempts += 1; } } diff --git a/src/layouts/schedule-page/schedule-page.vue b/src/layouts/schedule-page/schedule-page.vue index 832d7cc0..6da0f1d1 100644 --- a/src/layouts/schedule-page/schedule-page.vue +++ b/src/layouts/schedule-page/schedule-page.vue @@ -181,7 +181,9 @@ const getAvailableDates = async ( storeAction.payload.startDate, storeAction.payload.endDate, storeAction.payload.zipCodeOverride - ); + ).catch((error) => { + console.log('Error fetching mobile time slots:', error); + }); } timeSlotsResponsesData.estimatedServiceMinutesMinimum = @@ -463,11 +465,17 @@ export default { initialViewEndDate = endDateObject.endDateString; } + let mobileProviderNumberToUse = defaultProviderNumber; + if (this.selectedAppointmentType === AppointmentTypeStrings.MOBILE + || this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) { + mobileProviderNumberToUse = this.selectedServiceLocation.mobileProviderNumber; + } + const initialData = await getAvailableDates( initialViewStartDate, initialViewEndDate, this.selectedAppointmentType || AppointmentTypeStrings.IN_SHOP, - this.selectedProvider.providerNumber || defaultProviderNumber, + this.selectedProvider?.providerNumber || mobileProviderNumberToUse, this.selectedServiceLocation.zipCode ).then((response) => ({ todayDate: todayDateString, @@ -484,24 +492,26 @@ export default { || this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) { this.mobileDatesData = initialData; - const inShopData = await getAvailableDates( - initialViewStartDate, - initialViewEndDate, - AppointmentTypeStrings.IN_SHOP, - this.selectedProvider.providerNumber || defaultProviderNumber, - this.selectedServiceLocation.zipCode - ).then((response) => ({ - todayDate: todayDateString, - initialViewStartDate, - initialViewEndDate, - calendarViewDirection, - initialShopTimeSlotsResponse: response, - preSelectedDate, - initialDaysLoaded: endDateObject.newDaysLoaded || initialDays, - daysFromStart: endDateObject.daysFromStart || null - })); + if (this.selectedProvider?.providerNumber) { + const inShopData = await getAvailableDates( + initialViewStartDate, + initialViewEndDate, + AppointmentTypeStrings.IN_SHOP, + this.selectedProvider?.providerNumber || defaultProviderNumber, + this.selectedServiceLocation.zipCode + ).then((response) => ({ + todayDate: todayDateString, + initialViewStartDate, + initialViewEndDate, + calendarViewDirection, + initialShopTimeSlotsResponse: response, + preSelectedDate, + initialDaysLoaded: endDateObject.newDaysLoaded || initialDays, + daysFromStart: endDateObject.daysFromStart || null + })); - this.inShopDatesData = inShopData; + this.inShopDatesData = inShopData; + } } else { this.inShopDatesData = initialData; } diff --git a/src/layouts/schedule-page/service-location/service-location.vue b/src/layouts/schedule-page/service-location/service-location.vue index d2092211..1964d111 100644 --- a/src/layouts/schedule-page/service-location/service-location.vue +++ b/src/layouts/schedule-page/service-location/service-location.vue @@ -320,7 +320,10 @@ export default { refreshDatePicker: oldProvider?.providerNumber !== null }; - this.refreshAvailabilityRating(); + if (this.selectedAppointmentType === AppointmentTypeStrings.IN_SHOP && newProvider?.providerNumber != null) { + this.refreshAvailabilityRating(); + } + this.$emit('provider-changed', returnedProvider); } } @@ -412,6 +415,7 @@ export default { endDate.setDate(startDate.getDate() + 6); const formattedStartDate = startDate.toISOString().split('T')[0]; const formattedEndDate = endDate.toISOString().split('T')[0]; + getAvailabilityRating( formattedStartDate, formattedEndDate, @@ -419,6 +423,8 @@ export default { this.selectedProvider ? this.selectedProvider.providerNumber : null ).then((rating) => { this.availabilityRating = rating; + }).catch(() => { + this.availabilityRating = null; }); }, setCtuForMobile(val) { diff --git a/src/store/index.js b/src/store/index.js index e0434992..80cbcbf1 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -923,6 +923,7 @@ export const useMainStore = defineStore({ }, zipCode: zipCodeOverride ?? order.serviceLocation.zipCode }; + return globalMethods.callHttpClient({ method: endpoints.GetMobileTimeSlots.method, endpoint: endpoints.GetMobileTimeSlots.url,