CASH-1159

Remember last in-shop selection if simply toggling between mobile and in-shop
This commit is contained in:
Scott Kiener 2025-07-28 10:43:54 -04:00
parent 16e4be49d8
commit 09843ae2cb

View file

@ -426,6 +426,7 @@ export default {
shopProviderData: null,
navigatingForward: false,
shopListButton: shopListButton,
lastSelectedInshopOrDropoffProvider: null,
};
},
async beforeRouteEnter(to, from, next) {
@ -1652,9 +1653,22 @@ export default {
handleAppointmentTypeChange(newAppointmentType) {
this.updateFooterButtonText();
if (newAppointmentType === AppointmentTypeStrings.MOBILE) {
// Remember last shop selected if previous selection was inshop/dropoff
if (
(this.appointmentType == AppointmentTypeStrings.IN_SHOP ||
AppointmentTypeStrings.DROP_OFF ||
AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF) &&
this.selectedProvider
) {
this.lastSelectedInshopOrDropoffProvider = this.selectedProvider;
}
this.appointmentType = AppointmentTypeStrings.MOBILE;
this.updateSelectedProvider();
} else if (newAppointmentType) {
if (this.appointmentType != AppointmentTypeStrings.MOBILE) {
// Clear last shop selected if appointment type was changed in any manner other than from Mobile
this.lastSelectedInshopOrDropoffProvider = null;
}
if (this.selectedTimeSlotInfo?.timeSlot?.routeCode) {
// update appointmentType based on routeCode to determine if it should be dropoff or inshop
this.appointmentType = this.getInShopOrDropOffApptType(
@ -1665,7 +1679,7 @@ export default {
}
// make sure a selectedProvider exists
this.updateSelectedProvider();
this.updateSelectedProvider(this.lastSelectedInshopOrDropoffProvider);
} else {
this.appointmentType = null;
}