Merge pull request #2626 from Safelite/feature/Digital/CASH-814
CASH-814 | Refactor and cleanup
This commit is contained in:
commit
63b9767c58
1 changed files with 49 additions and 69 deletions
|
|
@ -196,26 +196,25 @@ export default {
|
||||||
let appointmentTypeCmsWidgetName;
|
let appointmentTypeCmsWidgetName;
|
||||||
|
|
||||||
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF) {
|
if (this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF) {
|
||||||
// This is planned to be used again for drop-off
|
|
||||||
// Leaving this here with that in mind, move logic from the final else in here
|
|
||||||
// and only apply it when a dropoff slot is selected
|
|
||||||
return null;
|
return null;
|
||||||
} else if (this.appointmentType === AppointmentTypeStrings.MOBILE) {
|
// This is planned to be used again for drop-off
|
||||||
|
// Wrote this to be ready for that eventuality, is untested and no HTML work done yet
|
||||||
|
|
||||||
|
// if (this.selectedRouteCode == null || !this.isDropOffRouteCode(this.selectedRouteCode)) {
|
||||||
|
// return null;
|
||||||
|
// } else {
|
||||||
|
// appointmentTypeCmsWidgetName =
|
||||||
|
// this.getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||||
|
// this.selectedRouteCode,
|
||||||
|
// true
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
appointmentTypeCmsWidgetName = this.selectedRouteCode?.includes(
|
appointmentTypeCmsWidgetName = this.selectedRouteCode?.includes(
|
||||||
PREMIUM_TIME_SLOT_ID_FLAG
|
PREMIUM_TIME_SLOT_ID_FLAG
|
||||||
)
|
)
|
||||||
? this.mobilePremiumCmsWidgetName
|
? this.mobilePremiumCmsWidgetName
|
||||||
: this.mobileCmsWidgetName;
|
: this.mobileCmsWidgetName;
|
||||||
} else {
|
|
||||||
if (!this.selectedRouteCode) {
|
|
||||||
return null;
|
|
||||||
} else {
|
|
||||||
appointmentTypeCmsWidgetName =
|
|
||||||
this.getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
|
||||||
this.selectedRouteCode,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getCmsContent(
|
return this.getCmsContent(
|
||||||
|
|
@ -223,12 +222,6 @@ export default {
|
||||||
cmsWidgetFieldMappings.SUPPLEMENTAL_INFORMATION
|
cmsWidgetFieldMappings.SUPPLEMENTAL_INFORMATION
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
footerCloseButtonText() {
|
|
||||||
return this.getCmsContent(
|
|
||||||
this.cmsWidgetName,
|
|
||||||
cmsWidgetFieldMappings.MODAL_CLOSE_BUTTON
|
|
||||||
);
|
|
||||||
},
|
|
||||||
dropOffOrPickATimeQuestionLabelText() {
|
dropOffOrPickATimeQuestionLabelText() {
|
||||||
return this.getCmsContent(this.dropOffOrPickATimeQuestionCmsWidgetName, "QuestionText");
|
return this.getCmsContent(this.dropOffOrPickATimeQuestionCmsWidgetName, "QuestionText");
|
||||||
},
|
},
|
||||||
|
|
@ -260,38 +253,40 @@ export default {
|
||||||
cmsWidgetFieldMappings.TIME_SLOT_BUTTON
|
cmsWidgetFieldMappings.TIME_SLOT_BUTTON
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
dropoffDisclaimerText() {
|
// None of this is used, but apparently could be re-activated if we go back to
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, cmsWidgetFieldMappings.DISCLAIMER);
|
// complete parity with Heritage. If that plan is dropped, delete this
|
||||||
},
|
// dropoffDisclaimerText() {
|
||||||
sameDayDropOffDisclaimerText() {
|
// return this.getCmsContent(this.dropoffCmsWidgetName, cmsWidgetFieldMappings.DISCLAIMER);
|
||||||
return this.getCmsContent(
|
// },
|
||||||
this.sameDayDropOffCmsWidgetName,
|
// sameDayDropOffDisclaimerText() {
|
||||||
cmsWidgetFieldMappings.DISCLAIMER
|
// return this.getCmsContent(
|
||||||
);
|
// this.sameDayDropOffCmsWidgetName,
|
||||||
},
|
// cmsWidgetFieldMappings.DISCLAIMER
|
||||||
overnightDropOffDisclaimerText() {
|
// );
|
||||||
return this.getCmsContent(
|
// },
|
||||||
this.overnightDropOffCmsWidgetName,
|
// overnightDropOffDisclaimerText() {
|
||||||
cmsWidgetFieldMappings.DISCLAIMER
|
// return this.getCmsContent(
|
||||||
);
|
// this.overnightDropOffCmsWidgetName,
|
||||||
},
|
// cmsWidgetFieldMappings.DISCLAIMER
|
||||||
disclaimerTextBlockCopy() {
|
// );
|
||||||
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
|
// },
|
||||||
if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
// disclaimerTextBlockCopy() {
|
||||||
if (this.isSameDay) {
|
// if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
|
||||||
return this.sameDayDropOffDisclaimerText;
|
// if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||||
} else {
|
// if (this.isSameDay) {
|
||||||
return this.dropoffDisclaimerText;
|
// return this.sameDayDropOffDisclaimerText;
|
||||||
}
|
// } else {
|
||||||
} else if (this.selectedRouteCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
// return this.dropoffDisclaimerText;
|
||||||
return this.overnightDropOffDisclaimerText;
|
// }
|
||||||
} else {
|
// } else if (this.selectedRouteCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||||
return null;
|
// return this.overnightDropOffDisclaimerText;
|
||||||
}
|
// } else {
|
||||||
} else {
|
// return null;
|
||||||
return null;
|
// }
|
||||||
}
|
// } else {
|
||||||
},
|
// return null;
|
||||||
|
// }
|
||||||
|
// },
|
||||||
dropOffDurationText() {
|
dropOffDurationText() {
|
||||||
return this.getCmsContent(this.dropoffCmsWidgetName, cmsWidgetFieldMappings.DURATION);
|
return this.getCmsContent(this.dropoffCmsWidgetName, cmsWidgetFieldMappings.DURATION);
|
||||||
},
|
},
|
||||||
|
|
@ -344,20 +339,6 @@ export default {
|
||||||
const todaysDate = new Date().toISOString().split("T")[0];
|
const todaysDate = new Date().toISOString().split("T")[0];
|
||||||
return this.selectedDate === todaysDate;
|
return this.selectedDate === todaysDate;
|
||||||
},
|
},
|
||||||
dateSelectedReadableDate() {
|
|
||||||
if (!this.timeSlotsForSelectedDate) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This conversion ensures we don't get get GMT induced date changes
|
|
||||||
const dateObject = convertDateStringToDate(this.timeSlotsForSelectedDate.date);
|
|
||||||
// Ex: Tuesday, April 22
|
|
||||||
return dateObject.toLocaleDateString("en-us", {
|
|
||||||
weekday: "long",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
availableTimeSlots() {
|
availableTimeSlots() {
|
||||||
if (!this.timeSlotsForSelectedDate) {
|
if (!this.timeSlotsForSelectedDate) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -391,6 +372,7 @@ export default {
|
||||||
buttonLabel: buttonLabelValue,
|
buttonLabel: buttonLabelValue,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
// Only add the pick a time button if inShop timeslots are available
|
||||||
if (
|
if (
|
||||||
this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots)
|
this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots)
|
||||||
.length !== 0
|
.length !== 0
|
||||||
|
|
@ -458,7 +440,6 @@ export default {
|
||||||
"update:modelValue",
|
"update:modelValue",
|
||||||
this.getSelectedTimeSlotInfoObject(this.selectedRouteCode)
|
this.getSelectedTimeSlotInfoObject(this.selectedRouteCode)
|
||||||
);
|
);
|
||||||
this.$emit("TimeSlotSelected");
|
|
||||||
},
|
},
|
||||||
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||||
selectedRouteCode,
|
selectedRouteCode,
|
||||||
|
|
@ -521,7 +502,7 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
setSelectedRouteCodeFromParent() {
|
setSelectedRouteCodeFromParent() {
|
||||||
if (!this.modelValue?.timeSlot) {
|
if (!this.modelValue?.timeSlot?.routeCode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const routeCodeFromParent = this.modelValue.timeSlot.routeCode;
|
const routeCodeFromParent = this.modelValue.timeSlot.routeCode;
|
||||||
|
|
@ -648,7 +629,6 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
// Removed modal
|
|
||||||
textBlock,
|
textBlock,
|
||||||
buttonQuestion,
|
buttonQuestion,
|
||||||
checkboxQuestion,
|
checkboxQuestion,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue