CSR-1449 | Add overnight drop-off functionality
Also made same-day functional
This commit is contained in:
parent
4b0575a05b
commit
19c4d60e23
3 changed files with 82 additions and 14 deletions
|
|
@ -8,4 +8,9 @@ const PREMIUM_TIME_SLOT_ID_FLAG = "-premium";
|
||||||
|
|
||||||
const PREMIUM_FEE_PART_TYPE = "EARLY BIRD";
|
const PREMIUM_FEE_PART_TYPE = "EARLY BIRD";
|
||||||
|
|
||||||
export { AppointmentTypeStrings, PREMIUM_TIME_SLOT_ID_FLAG, PREMIUM_FEE_PART_TYPE };
|
const RouteCodeFlags = {
|
||||||
|
ALL_DAY_DROP_OFF: "ALL DAY DROP OFF",
|
||||||
|
OVERNIGHT_DROP_OFF: "OVERNIGHT DROP OFF",
|
||||||
|
}
|
||||||
|
|
||||||
|
export { AppointmentTypeStrings, PREMIUM_TIME_SLOT_ID_FLAG, PREMIUM_FEE_PART_TYPE, RouteCodeFlags };
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
mobileCmsWidgetName="MobileTimeSlotModal"
|
mobileCmsWidgetName="MobileTimeSlotModal"
|
||||||
dropoffCmsWidgetName="DropOffTimeSlotModal"
|
dropoffCmsWidgetName="DropOffTimeSlotModal"
|
||||||
sameDayDropOffCmsWidgetName="SameDayDropOffTimeSlotModal"
|
sameDayDropOffCmsWidgetName="SameDayDropOffTimeSlotModal"
|
||||||
|
overnightDropOffCmsWidgetName="OvernightDropOffTimeSlotModal"
|
||||||
v-model="selectedTimeSlotData"
|
v-model="selectedTimeSlotData"
|
||||||
@time-slot-modal-closed="timeSlotModalClosed"
|
@time-slot-modal-closed="timeSlotModalClosed"
|
||||||
:appointmentType="appointmentType"
|
:appointmentType="appointmentType"
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@
|
||||||
v-if="supplementalInformationBlock"
|
v-if="supplementalInformationBlock"
|
||||||
v-html="supplementalInformationBlock"></div>
|
v-html="supplementalInformationBlock"></div>
|
||||||
<textBlock
|
<textBlock
|
||||||
v-show="shouldShowDropoffDisclaimerText"
|
v-show="disclaimerTextBlockCopy"
|
||||||
:customText="dropoffDisclaimerText"
|
:customText="disclaimerTextBlockCopy"
|
||||||
justifyText="left"
|
justifyText="left"
|
||||||
typeStyle="caption"
|
typeStyle="caption"
|
||||||
class="mb-2" />
|
class="mb-2" />
|
||||||
|
|
@ -53,6 +53,7 @@ import {
|
||||||
AppointmentTypeStrings,
|
AppointmentTypeStrings,
|
||||||
PREMIUM_TIME_SLOT_ID_FLAG,
|
PREMIUM_TIME_SLOT_ID_FLAG,
|
||||||
PREMIUM_FEE_PART_TYPE,
|
PREMIUM_FEE_PART_TYPE,
|
||||||
|
RouteCodeFlags,
|
||||||
} from "@/constants/schedule-constants";
|
} from "@/constants/schedule-constants";
|
||||||
|
|
||||||
// Validation for the modal button
|
// Validation for the modal button
|
||||||
|
|
@ -69,6 +70,7 @@ export default {
|
||||||
mobilePremiumCmsWidgetName: String,
|
mobilePremiumCmsWidgetName: String,
|
||||||
dropoffCmsWidgetName: String,
|
dropoffCmsWidgetName: String,
|
||||||
sameDayDropOffCmsWidgetName: String,
|
sameDayDropOffCmsWidgetName: String,
|
||||||
|
overnightDropOffCmsWidgetName: String,
|
||||||
appointmentType: String,
|
appointmentType: String,
|
||||||
dateAndTimeSlotData: Object,
|
dateAndTimeSlotData: Object,
|
||||||
premiumAppointmentFee: Object,
|
premiumAppointmentFee: Object,
|
||||||
|
|
@ -116,9 +118,12 @@ export default {
|
||||||
? this.mobilePremiumCmsWidgetName
|
? this.mobilePremiumCmsWidgetName
|
||||||
: this.mobileCmsWidgetName;
|
: this.mobileCmsWidgetName;
|
||||||
} else {
|
} else {
|
||||||
appointmentTypeCmsWidgetName = this.isSameDay
|
if (!this.selectedTimeSlotId) {
|
||||||
? this.sameDayDropOffCmsWidgetName
|
return null;
|
||||||
: this.dropoffCmsWidgetName;
|
}
|
||||||
|
else {
|
||||||
|
appointmentTypeCmsWidgetName = this.getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(this.selectedTimeSlotId, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this.getCmsContent(appointmentTypeCmsWidgetName, "BodyText");
|
return this.getCmsContent(appointmentTypeCmsWidgetName, "BodyText");
|
||||||
},
|
},
|
||||||
|
|
@ -131,12 +136,36 @@ export default {
|
||||||
dropoffButtonText() {
|
dropoffButtonText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, "HeaderText");
|
return this.getCmsContent(this.dropoffCmsWidgetName, "HeaderText");
|
||||||
},
|
},
|
||||||
|
overnightDropoffButtonText() {
|
||||||
|
return this.getCmsContent(this.overnightDropOffCmsWidgetName, "HeaderText");
|
||||||
|
},
|
||||||
dropoffDisclaimerText() {
|
dropoffDisclaimerText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, "FooterText");
|
return this.getCmsContent(this.dropoffCmsWidgetName, "FooterText");
|
||||||
},
|
},
|
||||||
|
overnightDropOffDisclaimerText() {
|
||||||
|
return this.getCmsContent(this.overnightDropOffCmsWidgetName, "FooterText");
|
||||||
|
},
|
||||||
|
disclaimerTextBlockCopy() {
|
||||||
|
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
|
||||||
|
if (this.isSameDay) {
|
||||||
|
return null;
|
||||||
|
} else if (this.selectedTimeSlotId?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||||
|
return this.dropoffDisclaimerText;
|
||||||
|
} else if (this.selectedTimeSlotId?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||||
|
return this.overnightDropOffDisclaimerText;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
},
|
||||||
dropOffDurationText() {
|
dropOffDurationText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, "SubheaderText");
|
return this.getCmsContent(this.dropoffCmsWidgetName, "SubheaderText");
|
||||||
},
|
},
|
||||||
|
overnightDropoffDurationText() {
|
||||||
|
return this.getCmsContent(this.overnightDropOffCmsWidgetName, "SubheaderText");
|
||||||
|
},
|
||||||
inshopDurationText() {
|
inshopDurationText() {
|
||||||
const inshopDurationTextWithoutTime = this.getCmsContent(
|
const inshopDurationTextWithoutTime = this.getCmsContent(
|
||||||
this.cmsWidgetName,
|
this.cmsWidgetName,
|
||||||
|
|
@ -154,15 +183,31 @@ export default {
|
||||||
} else if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
|
} else if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) {
|
||||||
return this.inshopDurationText;
|
return this.inshopDurationText;
|
||||||
} else {
|
} else {
|
||||||
return this.dropOffDurationText;
|
if (this.selectedTimeSlotId?.includes(
|
||||||
|
RouteCodeFlags.OVERNIGHT_DROP_OFF
|
||||||
|
)) {
|
||||||
|
return this.overnightDropoffDurationText;
|
||||||
|
} else if (this.selectedTimeSlotId?.includes(
|
||||||
|
RouteCodeFlags.ALL_DAY_DROP_OFF
|
||||||
|
)) {
|
||||||
|
return this.dropOffDurationText;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
shouldShowDropoffDisclaimerText() {
|
shouldShowDropoffDisclaimerText() {
|
||||||
return this.appointmentType === AppointmentTypeStrings.DROP_OFF && !this.isSameDay;
|
return this.appointmentType === AppointmentTypeStrings.DROP_OFF && !this.isSameDay;
|
||||||
},
|
},
|
||||||
isSameDay() {
|
isSameDay() {
|
||||||
return false;
|
if (!this.dateAndTimeSlotData) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const selectedDate = this.dateAndTimeSlotData.date;
|
||||||
|
const todaysDate = (new Date()).toISOString().split("T")[0];
|
||||||
|
return selectedDate === todaysDate;
|
||||||
},
|
},
|
||||||
|
|
||||||
dateSelectedReadableDate() {
|
dateSelectedReadableDate() {
|
||||||
if (!this.dateAndTimeSlotData) {
|
if (!this.dateAndTimeSlotData) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -233,6 +278,19 @@ export default {
|
||||||
}
|
}
|
||||||
return displayTextForDurationLength;
|
return displayTextForDurationLength;
|
||||||
},
|
},
|
||||||
|
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(selectedTimeSlotId, isSameDayRelevant = false) {
|
||||||
|
if (selectedTimeSlotId.includes(
|
||||||
|
RouteCodeFlags.OVERNIGHT_DROP_OFF
|
||||||
|
)) {
|
||||||
|
return this.overnightDropOffCmsWidgetName;
|
||||||
|
} else if (selectedTimeSlotId.includes(
|
||||||
|
RouteCodeFlags.ALL_DAY_DROP_OFF
|
||||||
|
)) {
|
||||||
|
return this.isSameDay && isSameDayRelevant
|
||||||
|
? this.sameDayDropOffCmsWidgetName
|
||||||
|
: this.dropoffCmsWidgetName;
|
||||||
|
}
|
||||||
|
},
|
||||||
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForInshop(timeSlotsForSelectedDate) {
|
||||||
return timeSlotsForSelectedDate.map((timeSlot) => {
|
return timeSlotsForSelectedDate.map((timeSlot) => {
|
||||||
const readableTime = this.getDisplayTextForMilitaryTime(timeSlot.startTime);
|
const readableTime = this.getDisplayTextForMilitaryTime(timeSlot.startTime);
|
||||||
|
|
@ -243,12 +301,16 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAvailableTimeSlotsForDropOff(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForDropOff(timeSlotsForSelectedDate) {
|
||||||
return [
|
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => {
|
||||||
{
|
const buttonLabelValue = timeSlot.id.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF) ?
|
||||||
value: timeSlotsForSelectedDate[0].id,
|
this.overnightDropoffButtonText :
|
||||||
buttonLabel: this.dropoffButtonText,
|
this.dropoffButtonText;
|
||||||
},
|
return {
|
||||||
];
|
value: timeSlot.id,
|
||||||
|
buttonLabel: buttonLabelValue,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
return availableTimeSlots;
|
||||||
},
|
},
|
||||||
getAvailableTimeSlotsForMobile(timeSlotsForSelectedDate) {
|
getAvailableTimeSlotsForMobile(timeSlotsForSelectedDate) {
|
||||||
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => {
|
const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue