({
- routeCode: null,
- date: null,
- startTime: null,
- endTime: null,
- jobMaxMinutes: null,
- jobMinMinutes: null,
+ timeSlot: {
+ routeCode: null,
+ date: null,
+ startTime: null,
+ endTime: null,
+ jobMaxMinutes: null,
+ jobMinMinutes: null,
+ },
+ isPremiumAppointment: null,
}),
},
cmsWidgetName: String,
@@ -102,7 +105,7 @@ export default {
sameDayDropOffCmsWidgetName: String,
overnightDropOffCmsWidgetName: String,
appointmentType: String,
- dateAndTimeSlotData: Object,
+ timeSlotsForSelectedDate: Object,
premiumAppointmentFee: Object,
estimatedServiceMinutesMinimum: Number,
estimatedServiceMinutesMaximum: Number,
@@ -113,7 +116,7 @@ export default {
data() {
return {
isModalOpened: false,
- selectedValue: null,
+ selectedRouteCode: this.getSelectedRouteCode(),
timeSlotModalListButton: timeSlotModalListButton,
};
},
@@ -150,36 +153,31 @@ export default {
modalName() {
return "timeSlots";
},
- selectedTimeSlotId: {
- get: function () {
- return this.modelValue?.routeCode;
- },
- set: function (newValue) {
- // Button Question only supports Number, or String data types so we must convert to the full object before emitting
- this.selectedValue = this.getSelectedTimeSlotObject(newValue);
- },
+ modal() {
+ return this.$refs[this.modalName];
},
supplementalInformationBlock() {
let appointmentTypeCmsWidgetName;
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
return null;
} else if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
- appointmentTypeCmsWidgetName = this.selectedTimeSlotId?.includes(
+ appointmentTypeCmsWidgetName = this.selectedRouteCode?.includes(
PREMIUM_TIME_SLOT_ID_FLAG
)
? this.mobilePremiumCmsWidgetName
: this.mobileCmsWidgetName;
} else {
- if (!this.selectedTimeSlotId) {
+ if (!this.selectedRouteCode) {
return null;
} else {
appointmentTypeCmsWidgetName =
this.getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
- this.selectedTimeSlotId,
+ this.selectedRouteCode,
true
);
}
}
+
return this.getCmsContent(
appointmentTypeCmsWidgetName,
cmsWidgetFieldMappings.SUPPLEMENTAL_INFORMATION
@@ -232,13 +230,13 @@ export default {
},
disclaimerTextBlockCopy() {
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
- if (this.selectedTimeSlotId?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
+ if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
if (this.isSameDay) {
return this.sameDayDropOffDisclaimerText;
} else {
return this.dropoffDisclaimerText;
}
- } else if (this.selectedTimeSlotId?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
+ } else if (this.selectedRouteCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
return this.overnightDropOffDisclaimerText;
} else {
return null;
@@ -281,9 +279,9 @@ export default {
} else if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
return this.inshopDurationText;
} else {
- if (this.selectedTimeSlotId?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
+ if (this.selectedRouteCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
return this.overnightDropoffDurationText;
- } else if (this.selectedTimeSlotId?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
+ } else if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
if (this.isSameDay) {
return this.sameDayDropoffDurationText;
} else {
@@ -295,21 +293,21 @@ export default {
}
},
isSameDay() {
- if (!this.dateAndTimeSlotData) {
+ if (!this.timeSlotsForSelectedDate) {
return false;
}
- const selectedDate = this.dateAndTimeSlotData.date;
+ const selectedDate = this.timeSlotsForSelectedDate.date;
const todaysDate = new Date().toISOString().split("T")[0];
return selectedDate === todaysDate;
},
dateSelectedReadableDate() {
- if (!this.dateAndTimeSlotData) {
+ if (!this.timeSlotsForSelectedDate) {
return null;
}
// This conversion ensures we don't get get GMT induced date changes
- const dateObject = convertDateStringToDate(this.dateAndTimeSlotData.date);
+ const dateObject = convertDateStringToDate(this.timeSlotsForSelectedDate.date);
// Ex: Tuesday, April 22
return dateObject.toLocaleDateString("en-us", {
weekday: "long",
@@ -318,21 +316,20 @@ export default {
});
},
availableTimeSlots() {
- if (!this.dateAndTimeSlotData) {
+ if (!this.timeSlotsForSelectedDate) {
return null;
}
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
- return this.getAvailableTimeSlotsForDropOff(this.dateAndTimeSlotData.timeSlots);
+ return this.getAvailableTimeSlotsForDropOff(
+ this.timeSlotsForSelectedDate.timeSlots
+ );
} else if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
- return this.getAvailableTimeSlotsForMobile(this.dateAndTimeSlotData.timeSlots);
+ return this.getAvailableTimeSlotsForMobile(this.timeSlotsForSelectedDate.timeSlots);
} else {
- return this.getAvailableTimeSlotsForInshop(this.dateAndTimeSlotData.timeSlots);
+ return this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots);
}
},
- modal() {
- return this.$refs[this.modalName];
- },
},
methods: {
openModal() {
@@ -348,16 +345,19 @@ export default {
this.$emit("time-slot-modal-closed");
},
async setSelectedTimeSlot() {
- this.$emit("update:modelValue", this.selectedValue);
+ this.$emit(
+ "update:modelValue",
+ this.getSelectedTimeSlotInfoObject(this.selectedRouteCode)
+ );
this.closeModal();
},
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
- selectedTimeSlotId,
+ selectedRouteCode,
isSameDayRelevant = false
) {
- if (selectedTimeSlotId.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
+ if (selectedRouteCode.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
return this.overnightDropOffCmsWidgetName;
- } else if (selectedTimeSlotId.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
+ } else if (selectedRouteCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
return this.isSameDay && isSameDayRelevant
? this.sameDayDropOffCmsWidgetName
: this.dropoffCmsWidgetName;
@@ -416,8 +416,9 @@ export default {
getPremiumAppointmentTimeSlot(timeSlotData) {
const formattedPrice =
"+$" + this.getTotalLineItemPrice(this.premiumAppointmentFee).toFixed(2);
+
return {
- // Unique value is required for each
and the premium appoinment shares a timeSlot ID
+ // Unique value is required for each
and the premium appoinment shares an id
value: this.addPremiumFlagToInput(timeSlotData.id),
buttonLabel: this.premiumAppointmentButtonText,
buttonLabelSubCopy: formattedPrice,
@@ -426,41 +427,68 @@ export default {
},
};
},
- autoSelectTimeSlotIfOnlyOneIsAvailable(newAvailableTimeSlotsValue) {
- const numberOfOptions = newAvailableTimeSlotsValue?.length;
+ getSelectedRouteCode() {
+ let selectedRouteCode;
+ if (!this.modelValue?.timeSlot) {
+ selectedRouteCode = null;
+ }
+
+ if (this.modelValue?.isPremiumAppointment) {
+ selectedRouteCode = this.addPremiumFlagToInput(
+ this.modelValue?.timeSlot?.routeCode
+ );
+ } else {
+ selectedRouteCode = this.modelValue?.timeSlot?.routeCode;
+ }
+
+ return selectedRouteCode;
+ },
+ autoSelectTimeSlotIfOnlyOneIsAvailable() {
+ const numberOfOptions = this.availableTimeSlots?.length;
if (numberOfOptions === 1) {
- this.selectedTimeSlotId = newAvailableTimeSlotsValue[0].value;
+ this.selectedRouteCode = this.availableTimeSlots[0].value;
}
},
- addPremiumFlagToInput(timeSlotId) {
- return (timeSlotId += PREMIUM_TIME_SLOT_ID_FLAG);
+ addPremiumFlagToInput(routeCode) {
+ return (routeCode += PREMIUM_TIME_SLOT_ID_FLAG);
},
- removePremiumFlagFromInput(timeSlotId) {
- return timeSlotId.substring(0, timeSlotId.length - PREMIUM_TIME_SLOT_ID_FLAG.length);
+ removePremiumFlagFromInput(routeCode) {
+ return routeCode.replace(PREMIUM_TIME_SLOT_ID_FLAG, "");
},
- getSelectedTimeSlotObject(timeSlotId) {
- const timeSlot = this.dateAndTimeSlotData?.timeSlots?.find(
- (timeSlot) => timeSlot.id == timeSlotId
+ getSelectedTimeSlotInfoObject(routeCode) {
+ const routeCodeIncludesPremium = routeCode?.includes(PREMIUM_TIME_SLOT_ID_FLAG);
+ if (routeCodeIncludesPremium) {
+ routeCode = this.removePremiumFlagFromInput(routeCode);
+ }
+
+ const timeSlot = this.timeSlotsForSelectedDate?.timeSlots?.find(
+ (timeSlot) => timeSlot.id == routeCode
);
if (timeSlot) {
return {
- date: this.dateAndTimeSlotData.date,
- routeCode: timeSlot.id,
- startTime: timeSlot.startTime,
- endTime: timeSlot.endTime,
- jobMaxMinutes: this.estimatedServiceMinutesMaximum.toString(),
- jobMinMinutes: this.estimatedServiceMinutesMinimum.toString(),
+ timeSlot: {
+ date: this.timeSlotsForSelectedDate.date,
+ routeCode: timeSlot.id,
+ startTime: timeSlot.startTime,
+ endTime: timeSlot.endTime,
+ jobMaxMinutes: this.estimatedServiceMinutesMaximum.toString(),
+ jobMinMinutes: this.estimatedServiceMinutesMinimum.toString(),
+ },
+ isPremiumAppointment: routeCodeIncludesPremium ? true : false,
};
}
return {
- date: null,
- startTime: null,
- endTime: null,
- routeCode: null,
- jobMaxMinutes: null,
- jobMinMinutes: null,
+ timeSlot: {
+ date: null,
+ startTime: null,
+ endTime: null,
+ routeCode: null,
+ jobMaxMinutes: null,
+ jobMinMinutes: null,
+ },
+ isPremiumAppointment: null,
};
},
},
@@ -473,12 +501,10 @@ export default {
},
selectedDate: {
handler() {
- this.selectedTimeSlotId = null;
+ this.selectedRouteCode = null;
+ this.autoSelectTimeSlotIfOnlyOneIsAvailable();
},
},
- availableTimeSlots(newValue) {
- this.autoSelectTimeSlotIfOnlyOneIsAvailable(newValue);
- },
},
components: {
modal,
diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue
index 6873ce294..0fef11cb1 100644
--- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue
+++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue
@@ -5,7 +5,7 @@
diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue
index 73537f75c..9fca2f77e 100644
--- a/src/layouts/service-location/service-location.vue
+++ b/src/layouts/service-location/service-location.vue
@@ -430,6 +430,7 @@ export default {
.question-text {
& > span {
text-align: center;
+ color: $black;
}
}
diff --git a/src/layouts/vehicle/vehicle-question/vehicle-question.vue b/src/layouts/vehicle/vehicle-question/vehicle-question.vue
index 79b58bfaa..171f5da3f 100644
--- a/src/layouts/vehicle/vehicle-question/vehicle-question.vue
+++ b/src/layouts/vehicle/vehicle-question/vehicle-question.vue
@@ -1,5 +1,9 @@
-
+