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;
|
||||
|
||||
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;
|
||||
} 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(
|
||||
PREMIUM_TIME_SLOT_ID_FLAG
|
||||
)
|
||||
? this.mobilePremiumCmsWidgetName
|
||||
: this.mobileCmsWidgetName;
|
||||
} else {
|
||||
if (!this.selectedRouteCode) {
|
||||
return null;
|
||||
} else {
|
||||
appointmentTypeCmsWidgetName =
|
||||
this.getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||
this.selectedRouteCode,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return this.getCmsContent(
|
||||
|
|
@ -223,12 +222,6 @@ export default {
|
|||
cmsWidgetFieldMappings.SUPPLEMENTAL_INFORMATION
|
||||
);
|
||||
},
|
||||
footerCloseButtonText() {
|
||||
return this.getCmsContent(
|
||||
this.cmsWidgetName,
|
||||
cmsWidgetFieldMappings.MODAL_CLOSE_BUTTON
|
||||
);
|
||||
},
|
||||
dropOffOrPickATimeQuestionLabelText() {
|
||||
return this.getCmsContent(this.dropOffOrPickATimeQuestionCmsWidgetName, "QuestionText");
|
||||
},
|
||||
|
|
@ -260,38 +253,40 @@ export default {
|
|||
cmsWidgetFieldMappings.TIME_SLOT_BUTTON
|
||||
);
|
||||
},
|
||||
dropoffDisclaimerText() {
|
||||
return this.getCmsContent(this.dropoffCmsWidgetName, cmsWidgetFieldMappings.DISCLAIMER);
|
||||
},
|
||||
sameDayDropOffDisclaimerText() {
|
||||
return this.getCmsContent(
|
||||
this.sameDayDropOffCmsWidgetName,
|
||||
cmsWidgetFieldMappings.DISCLAIMER
|
||||
);
|
||||
},
|
||||
overnightDropOffDisclaimerText() {
|
||||
return this.getCmsContent(
|
||||
this.overnightDropOffCmsWidgetName,
|
||||
cmsWidgetFieldMappings.DISCLAIMER
|
||||
);
|
||||
},
|
||||
disclaimerTextBlockCopy() {
|
||||
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
|
||||
if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||
if (this.isSameDay) {
|
||||
return this.sameDayDropOffDisclaimerText;
|
||||
} else {
|
||||
return this.dropoffDisclaimerText;
|
||||
}
|
||||
} else if (this.selectedRouteCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||
return this.overnightDropOffDisclaimerText;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// None of this is used, but apparently could be re-activated if we go back to
|
||||
// complete parity with Heritage. If that plan is dropped, delete this
|
||||
// dropoffDisclaimerText() {
|
||||
// return this.getCmsContent(this.dropoffCmsWidgetName, cmsWidgetFieldMappings.DISCLAIMER);
|
||||
// },
|
||||
// sameDayDropOffDisclaimerText() {
|
||||
// return this.getCmsContent(
|
||||
// this.sameDayDropOffCmsWidgetName,
|
||||
// cmsWidgetFieldMappings.DISCLAIMER
|
||||
// );
|
||||
// },
|
||||
// overnightDropOffDisclaimerText() {
|
||||
// return this.getCmsContent(
|
||||
// this.overnightDropOffCmsWidgetName,
|
||||
// cmsWidgetFieldMappings.DISCLAIMER
|
||||
// );
|
||||
// },
|
||||
// disclaimerTextBlockCopy() {
|
||||
// if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
|
||||
// if (this.selectedRouteCode?.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) {
|
||||
// if (this.isSameDay) {
|
||||
// return this.sameDayDropOffDisclaimerText;
|
||||
// } else {
|
||||
// return this.dropoffDisclaimerText;
|
||||
// }
|
||||
// } else if (this.selectedRouteCode?.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) {
|
||||
// return this.overnightDropOffDisclaimerText;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
// },
|
||||
dropOffDurationText() {
|
||||
return this.getCmsContent(this.dropoffCmsWidgetName, cmsWidgetFieldMappings.DURATION);
|
||||
},
|
||||
|
|
@ -344,20 +339,6 @@ export default {
|
|||
const todaysDate = new Date().toISOString().split("T")[0];
|
||||
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() {
|
||||
if (!this.timeSlotsForSelectedDate) {
|
||||
return null;
|
||||
|
|
@ -391,6 +372,7 @@ export default {
|
|||
buttonLabel: buttonLabelValue,
|
||||
};
|
||||
});
|
||||
// Only add the pick a time button if inShop timeslots are available
|
||||
if (
|
||||
this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots)
|
||||
.length !== 0
|
||||
|
|
@ -458,7 +440,6 @@ export default {
|
|||
"update:modelValue",
|
||||
this.getSelectedTimeSlotInfoObject(this.selectedRouteCode)
|
||||
);
|
||||
this.$emit("TimeSlotSelected");
|
||||
},
|
||||
getRelevantDropOffCmsWidgetNameForSelectedTimeSlot(
|
||||
selectedRouteCode,
|
||||
|
|
@ -521,7 +502,7 @@ export default {
|
|||
};
|
||||
},
|
||||
setSelectedRouteCodeFromParent() {
|
||||
if (!this.modelValue?.timeSlot) {
|
||||
if (!this.modelValue?.timeSlot?.routeCode) {
|
||||
return;
|
||||
}
|
||||
const routeCodeFromParent = this.modelValue.timeSlot.routeCode;
|
||||
|
|
@ -648,7 +629,6 @@ export default {
|
|||
},
|
||||
},
|
||||
components: {
|
||||
// Removed modal
|
||||
textBlock,
|
||||
buttonQuestion,
|
||||
checkboxQuestion,
|
||||
|
|
|
|||
Loading…
Reference in a new issue