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);
|
this.findInitialDate(config.preSelectedDate, pageIndexObj.initialDayIndex);
|
||||||
} else {
|
} else {
|
||||||
this.findFirstAvailableDateInView();
|
this.findFirstAvailableDateInView();
|
||||||
while (!this.selectedDate) {
|
let attempts = 0;
|
||||||
this.gotoNextPage();
|
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.startDate,
|
||||||
storeAction.payload.endDate,
|
storeAction.payload.endDate,
|
||||||
storeAction.payload.zipCodeOverride
|
storeAction.payload.zipCodeOverride
|
||||||
);
|
).catch((error) => {
|
||||||
|
console.log('Error fetching mobile time slots:', error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
timeSlotsResponsesData.estimatedServiceMinutesMinimum =
|
timeSlotsResponsesData.estimatedServiceMinutesMinimum =
|
||||||
|
|
@ -463,11 +465,17 @@ export default {
|
||||||
initialViewEndDate = endDateObject.endDateString;
|
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(
|
const initialData = await getAvailableDates(
|
||||||
initialViewStartDate,
|
initialViewStartDate,
|
||||||
initialViewEndDate,
|
initialViewEndDate,
|
||||||
this.selectedAppointmentType || AppointmentTypeStrings.IN_SHOP,
|
this.selectedAppointmentType || AppointmentTypeStrings.IN_SHOP,
|
||||||
this.selectedProvider.providerNumber || defaultProviderNumber,
|
this.selectedProvider?.providerNumber || mobileProviderNumberToUse,
|
||||||
this.selectedServiceLocation.zipCode
|
this.selectedServiceLocation.zipCode
|
||||||
).then((response) => ({
|
).then((response) => ({
|
||||||
todayDate: todayDateString,
|
todayDate: todayDateString,
|
||||||
|
|
@ -484,24 +492,26 @@ export default {
|
||||||
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
|
|| this.selectedAppointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP) {
|
||||||
this.mobileDatesData = initialData;
|
this.mobileDatesData = initialData;
|
||||||
|
|
||||||
const inShopData = await getAvailableDates(
|
if (this.selectedProvider?.providerNumber) {
|
||||||
initialViewStartDate,
|
const inShopData = await getAvailableDates(
|
||||||
initialViewEndDate,
|
initialViewStartDate,
|
||||||
AppointmentTypeStrings.IN_SHOP,
|
initialViewEndDate,
|
||||||
this.selectedProvider.providerNumber || defaultProviderNumber,
|
AppointmentTypeStrings.IN_SHOP,
|
||||||
this.selectedServiceLocation.zipCode
|
this.selectedProvider?.providerNumber || defaultProviderNumber,
|
||||||
).then((response) => ({
|
this.selectedServiceLocation.zipCode
|
||||||
todayDate: todayDateString,
|
).then((response) => ({
|
||||||
initialViewStartDate,
|
todayDate: todayDateString,
|
||||||
initialViewEndDate,
|
initialViewStartDate,
|
||||||
calendarViewDirection,
|
initialViewEndDate,
|
||||||
initialShopTimeSlotsResponse: response,
|
calendarViewDirection,
|
||||||
preSelectedDate,
|
initialShopTimeSlotsResponse: response,
|
||||||
initialDaysLoaded: endDateObject.newDaysLoaded || initialDays,
|
preSelectedDate,
|
||||||
daysFromStart: endDateObject.daysFromStart || null
|
initialDaysLoaded: endDateObject.newDaysLoaded || initialDays,
|
||||||
}));
|
daysFromStart: endDateObject.daysFromStart || null
|
||||||
|
}));
|
||||||
|
|
||||||
this.inShopDatesData = inShopData;
|
this.inShopDatesData = inShopData;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.inShopDatesData = initialData;
|
this.inShopDatesData = initialData;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,10 @@ export default {
|
||||||
refreshDatePicker: oldProvider?.providerNumber !== null
|
refreshDatePicker: oldProvider?.providerNumber !== null
|
||||||
};
|
};
|
||||||
|
|
||||||
this.refreshAvailabilityRating();
|
if (this.selectedAppointmentType === AppointmentTypeStrings.IN_SHOP && newProvider?.providerNumber != null) {
|
||||||
|
this.refreshAvailabilityRating();
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit('provider-changed', returnedProvider);
|
this.$emit('provider-changed', returnedProvider);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -412,6 +415,7 @@ export default {
|
||||||
endDate.setDate(startDate.getDate() + 6);
|
endDate.setDate(startDate.getDate() + 6);
|
||||||
const formattedStartDate = startDate.toISOString().split('T')[0];
|
const formattedStartDate = startDate.toISOString().split('T')[0];
|
||||||
const formattedEndDate = endDate.toISOString().split('T')[0];
|
const formattedEndDate = endDate.toISOString().split('T')[0];
|
||||||
|
|
||||||
getAvailabilityRating(
|
getAvailabilityRating(
|
||||||
formattedStartDate,
|
formattedStartDate,
|
||||||
formattedEndDate,
|
formattedEndDate,
|
||||||
|
|
@ -419,6 +423,8 @@ export default {
|
||||||
this.selectedProvider ? this.selectedProvider.providerNumber : null
|
this.selectedProvider ? this.selectedProvider.providerNumber : null
|
||||||
).then((rating) => {
|
).then((rating) => {
|
||||||
this.availabilityRating = rating;
|
this.availabilityRating = rating;
|
||||||
|
}).catch(() => {
|
||||||
|
this.availabilityRating = null;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
setCtuForMobile(val) {
|
setCtuForMobile(val) {
|
||||||
|
|
|
||||||
|
|
@ -923,6 +923,7 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
zipCode: zipCodeOverride ?? order.serviceLocation.zipCode
|
zipCode: zipCodeOverride ?? order.serviceLocation.zipCode
|
||||||
};
|
};
|
||||||
|
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetMobileTimeSlots.method,
|
method: endpoints.GetMobileTimeSlots.method,
|
||||||
endpoint: endpoints.GetMobileTimeSlots.url,
|
endpoint: endpoints.GetMobileTimeSlots.url,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue