Merge pull request #1185 from Safelite/defect/CSR-1476

CSR-1476 | Recognize early bird from loadSession
This commit is contained in:
scottkiener 2023-06-27 09:38:45 -04:00 committed by GitHub
commit c53fc70bb9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View file

@ -107,7 +107,7 @@ export default {
selectedDate: this.getSelectedDate(),
selectedTimeSlotData: {
id: this.getSelectedRouteCode(),
isPremiumAppointment: null,
isPremiumAppointment: this.isMobilePremiumFeeOnOrderInVuex(),
},
selectableDatesData: [],
mobilePremiumAppointmentFee: null,
@ -268,6 +268,12 @@ export default {
getSelectedRouteCode() {
return store.getters.order.schedule.routeCode;
},
isMobilePremiumFeeOnOrderInVuex() {
const supportingItemsFromVuex = store.getters.lineItems.supportingItems;
return !!supportingItemsFromVuex.filter(
(lineItem) => lineItem.partType === PREMIUM_FEE_PART_TYPE
).length;
},
timeSlotModalClosed() {
// Clear the selectedDate if no timeSlot has been selected
if (!this.selectedTimeSlotData.id) {

View file

@ -80,7 +80,7 @@ export default {
},
data() {
return {
selectedTimeSlotId: this.modelValue.id,
selectedTimeSlotId: this.getModifiedSelectedTimeSlotId(),
timeSlotModalListButton: timeSlotModalListButton,
};
},
@ -94,12 +94,8 @@ export default {
},
watch: {
modelValue() {
this.selectedTimeSlotId = this.getModifiedSelectedTimeSlotId();
// Run component validation that is used at parent level
if (this.modelValue.isPremiumAppointment) {
this.selectedTimeSlotId = this.addPremiumFlagToInput(this.modelValue.id);
} else {
this.selectedTimeSlotId = this.modelValue.id;
}
this.handleChange(this.modelValue.id);
},
availableTimeSlots(newValue) {
@ -256,6 +252,13 @@ export default {
onModalClosed() {
this.$emit("time-slot-modal-closed");
},
getModifiedSelectedTimeSlotId() {
if (this.modelValue.isPremiumAppointment) {
return this.addPremiumFlagToInput(this.modelValue.id);
} else {
return this.modelValue.id;
}
},
// Expected input: "HH:MM"
getDisplayTextForMilitaryTime(militaryTimeInput) {
let hours = parseInt(militaryTimeInput.split(":")[0]);