From 7f549a758bfb9a33e2d593a65027655b5f9ef3e2 Mon Sep 17 00:00:00 2001 From: Scott Kiener Date: Tue, 27 Jun 2023 09:19:38 -0400 Subject: [PATCH] CSR-1476 | Recognize early bird from loadSession --- src/layouts/schedule/schedule.vue | 8 +++++++- .../time-slot-modal-question.vue | 15 +++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index a364319ee..5d517913c 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -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) { diff --git a/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue index 589b12cc5..159994079 100644 --- a/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue +++ b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-question.vue @@ -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]);