some updates when changing zipcode to certain types
This commit is contained in:
parent
00936fd696
commit
461f2ae5dc
4 changed files with 42 additions and 22 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -923,6 +923,7 @@ export const useMainStore = defineStore({
|
|||
},
|
||||
zipCode: zipCodeOverride ?? order.serviceLocation.zipCode
|
||||
};
|
||||
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.GetMobileTimeSlots.method,
|
||||
endpoint: endpoints.GetMobileTimeSlots.url,
|
||||
|
|
|
|||
Loading…
Reference in a new issue