CASH-2378: updates to mobile first modal (renaming, change in helper method)

This commit is contained in:
Adam Caouette 2026-03-04 08:05:52 -05:00
parent b3fb548813
commit e5aa47673b

View file

@ -5,7 +5,7 @@
<mobileFirstModal <mobileFirstModal
modalWidgetName="MobileFirstModalWidget" modalWidgetName="MobileFirstModalWidget"
ref="mobileFirstModal" ref="mobileFirstModal"
@confirm-appointment="updateTimeSlotandNavigateForward" /> @confirm-appointment="updateMobileFirstTimeSlotandNavigateForward" />
<recalAckModal <recalAckModal
modalWidgetName="RecalAckModalWidget" modalWidgetName="RecalAckModalWidget"
agreementWidgetName="RecalAgreementQuestionWidget" agreementWidgetName="RecalAgreementQuestionWidget"
@ -488,10 +488,6 @@ export default {
shopListButton: shopListButton, shopListButton: shopListButton,
lastSelectedInshopOrDropoffProvider: null, lastSelectedInshopOrDropoffProvider: null,
selectedMobileFirstAppointment: false, selectedMobileFirstAppointment: false,
isShowMobileFirstAppt: experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SHOW_MOBILE_FIRST_APPT,
"true"
),
calendarLoadingStatus: "none", calendarLoadingStatus: "none",
}; };
}, },
@ -988,6 +984,12 @@ export default {
return this.selectableDatesInshop?.days?.length > 0; return this.selectableDatesInshop?.days?.length > 0;
} }
}, },
isShowMobileFirstAppt() {
return experimentMixin.methods.hasSettingEqualTo(
experimentSettings.SHOW_MOBILE_FIRST_APPT,
"true"
);
},
}, },
methods: { methods: {
splitCopyOnCMSPlaceHolder, splitCopyOnCMSPlaceHolder,
@ -1934,10 +1936,10 @@ export default {
const order = this.$store.getters.order; const order = this.$store.getters.order;
const isRepair = order.damage.isRepair; const isRepair = order.damage.isRepair;
let preSelectedMobileAppointment = null; let promotedMobileAppointment = null;
const todaysDate = getTodayDate(); const todaysDate = getTodayDate();
let firstMobileAMAppt = await this.getFirstAvailableMobileApptByTOD("AM"); let firstMobileAMAppt = await this.getFirstAvailableApptByTOD("AM", "mobile");
let firstMobilePMAppt = await this.getFirstAvailableMobileApptByTOD("PM"); let firstMobilePMAppt = await this.getFirstAvailableApptByTOD("PM", "mobile");
if (!firstMobileAMAppt && !firstMobilePMAppt) { if (!firstMobileAMAppt && !firstMobilePMAppt) {
return; return;
} }
@ -2032,7 +2034,7 @@ export default {
if (this.isShowMobileFirstAppt) { if (this.isShowMobileFirstAppt) {
if (pmMobileDays == 0) { if (pmMobileDays == 0) {
// Selects the first available time slot // Selects the first available time slot
preSelectedMobileAppointment = promotedMobileAppointment =
numberOfDaysToFirstMobileAMDate <= numberOfDaysToFirstMobilePMDate numberOfDaysToFirstMobileAMDate <= numberOfDaysToFirstMobilePMDate
? firstMobileAMAppt ? firstMobileAMAppt
: firstMobilePMAppt; : firstMobilePMAppt;
@ -2041,20 +2043,20 @@ export default {
numberOfDaysToFirstMobilePMDate <= pmMobileDays numberOfDaysToFirstMobilePMDate <= pmMobileDays
) { ) {
// Selects the first available PM time slot // Selects the first available PM time slot
preSelectedMobileAppointment = firstMobilePMAppt; promotedMobileAppointment = firstMobilePMAppt;
} else if ( } else if (
firstMobilePMDate && firstMobilePMDate &&
numberOfDaysToFirstMobilePMDate >= noPMMobileDays numberOfDaysToFirstMobilePMDate >= noPMMobileDays
) { ) {
// Selects the first available AM time slot. If none, selects the first available PM time slot // Selects the first available AM time slot. If none, selects the first available PM time slot
preSelectedMobileAppointment = firstMobileAMAppt promotedMobileAppointment = firstMobileAMAppt
? firstMobileAMAppt ? firstMobileAMAppt
: firstMobilePMAppt; : firstMobilePMAppt;
} }
if (preSelectedMobileAppointment) { if (promotedMobileAppointment) {
this.$refs.mobileFirstModal.setSelectedAppointment( this.$refs.mobileFirstModal.setSelectedAppointment(
preSelectedMobileAppointment promotedMobileAppointment
); );
this.$refs.mobileFirstModal.openModal(); this.$refs.mobileFirstModal.openModal();
} }
@ -2062,11 +2064,19 @@ export default {
} }
} }
}, },
async getFirstAvailableMobileApptByTOD(timeOfDay) { async getFirstAvailableApptByTOD(timeOfDay, appointmentType) {
if (!this.selectableDatesMobile?.days?.length) { let selectableDays;
if (appointmentType?.toLowerCase() == "mobile") {
selectableDays = this.selectableDatesMobile?.days;
} else if (appointmentType?.toLowerCase() == "inshop") {
selectableDays = this.selectableDatesInshop?.days;
} else {
return;
}
if (!selectableDays?.length) {
return null; return null;
} else { } else {
for (const dateObj of this.selectableDatesMobile.days) { for (const dateObj of selectableDays) {
let matchingTimeSlot = { let matchingTimeSlot = {
estimatedServiceMinutes: { estimatedServiceMinutes: {
minimum: this.estimatedServiceMinutesMinimum, minimum: this.estimatedServiceMinutesMinimum,
@ -2081,6 +2091,16 @@ export default {
(matchingTimeSlot.timeSlot = slot) && (matchingTimeSlot.timeSlot = slot) &&
(matchingTimeSlot.date = dateObj.date) (matchingTimeSlot.date = dateObj.date)
); );
if (
appointmentType?.toLowerCase() == "inshop" &&
this.selectedShopAnswer?.address1 &&
this.selectedShopAnswer?.address2
) {
matchingTimeSlot.addressCopy =
this.selectedShopAnswer?.address1 +
", " +
this.selectedShopAnswer?.address2;
}
if (isMatchingApptDay && matchingTimeSlot) { if (isMatchingApptDay && matchingTimeSlot) {
return matchingTimeSlot; return matchingTimeSlot;
} }
@ -2088,7 +2108,7 @@ export default {
return null; return null;
} }
}, },
updateTimeSlotandNavigateForward(timeSlotObj) { updateMobileFirstTimeSlotandNavigateForward(timeSlotObj) {
this.selectedMobileFirstAppointment = true; this.selectedMobileFirstAppointment = true;
this.appointmentType = AppointmentTypeStrings.MOBILE; this.appointmentType = AppointmentTypeStrings.MOBILE;
this.selectedDate = timeSlotObj.date; this.selectedDate = timeSlotObj.date;