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(), selectedDate: this.getSelectedDate(),
selectedTimeSlotData: { selectedTimeSlotData: {
id: this.getSelectedRouteCode(), id: this.getSelectedRouteCode(),
isPremiumAppointment: null, isPremiumAppointment: this.isMobilePremiumFeeOnOrderInVuex(),
}, },
selectableDatesData: [], selectableDatesData: [],
mobilePremiumAppointmentFee: null, mobilePremiumAppointmentFee: null,
@ -268,6 +268,12 @@ export default {
getSelectedRouteCode() { getSelectedRouteCode() {
return store.getters.order.schedule.routeCode; 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() { timeSlotModalClosed() {
// Clear the selectedDate if no timeSlot has been selected // Clear the selectedDate if no timeSlot has been selected
if (!this.selectedTimeSlotData.id) { if (!this.selectedTimeSlotData.id) {

View file

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