CSR-1137 | Working version before messing with pricing

This commit is contained in:
Scott Kiener 2023-05-18 15:28:18 -04:00
parent 8967676496
commit 1f539e9d79
3 changed files with 21 additions and 16 deletions

View file

@ -45,6 +45,7 @@
type="radio" type="radio"
name="day-of-month" name="day-of-month"
v-model="selectedDate" v-model="selectedDate"
@click="fireDateClickedEvent"
:value="date.inputValue" :value="date.inputValue"
:id="`${month.monthLabel}-${date.dateNum.toString()}`" /> :id="`${month.monthLabel}-${date.dateNum.toString()}`" />
<label :for="`${month.monthLabel}-${date.dateNum.toString()}`"> <label :for="`${month.monthLabel}-${date.dateNum.toString()}`">
@ -145,6 +146,9 @@ export default {
}, },
}, },
methods: { methods: {
fireDateClickedEvent() {
this.$emit("date-clicked");
},
getWeekStartDate(date) { getWeekStartDate(date) {
// Get the day of the week for date // Get the day of the week for date
let dayOfWeek = date.getDay(); let dayOfWeek = date.getDay();

View file

@ -33,7 +33,8 @@
selectableDatesSetting="custom" selectableDatesSetting="custom"
ref="datePicker" ref="datePicker"
v-model="selectedDate" v-model="selectedDate"
:customSelectableDatesCallback="getAvailableDatesMethod" /> :customSelectableDatesCallback="getAvailableDatesMethod"
@date-clicked="openInshopTimeSlotsModal" />
<!-- todayOverrideDateString="2023-08-06T03:00:00" --> <!-- todayOverrideDateString="2023-08-06T03:00:00" -->
<time-slot-modal-question <time-slot-modal-question
ref="timeSlotModalQuestion" ref="timeSlotModalQuestion"
@ -42,16 +43,13 @@
mobileCmsWidgetName="MobileTimeSlotModal" mobileCmsWidgetName="MobileTimeSlotModal"
dropoffCmsWidgetName="DropOffTimeSlotModal" dropoffCmsWidgetName="DropOffTimeSlotModal"
v-model="selectedTimeSlotId" v-model="selectedTimeSlotId"
@time-slot-modal-closed="timeSlotModalClosed"
:appointmentType="appointmentType" :appointmentType="appointmentType"
:mobileEarlyBirdFee="mobileEarlyBirdFee" :mobileEarlyBirdFee="mobileEarlyBirdFee"
:dateAndTimeSlotData="timeSlotsForSelectedDate" :dateAndTimeSlotData="timeSlotsForSelectedDate"
:estimatedServiceMinutesMinimum="selectableDatesData.estimatedServiceMinutesMinimum" :estimatedServiceMinutesMinimum="selectableDatesData.estimatedServiceMinutesMinimum"
:estimatedServiceMinutesMaximum="selectableDatesData.estimatedServiceMinutesMaximum" :estimatedServiceMinutesMaximum="selectableDatesData.estimatedServiceMinutesMaximum"
validationRules="time-slot-selection-required" /> validationRules="time-slot-selection-required" />
<button @click="setAppointmentType('Inshop')">Set to Inshop</button>
<button @click="setAppointmentType('Mobile')">Set to Mobile</button>
<button @click="setAppointmentType('Dropoff')">Set to Dropoff</button>
<button @click="openInshopTimeSlotsModal">Click for timeslots</button>
<funnel-footer <funnel-footer
cmsWidgetName="FunnelFooterWidget" cmsWidgetName="FunnelFooterWidget"
ref="funnelFooter" ref="funnelFooter"
@ -129,7 +127,6 @@ export default {
selectableDatesData: [], selectableDatesData: [],
weatherAlerts: [], weatherAlerts: [],
mobileEarlyBirdFee: null, mobileEarlyBirdFee: null,
TEMPORARYappointmentType: "Inshop",
}; };
}, },
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
@ -227,8 +224,7 @@ export default {
return this.weatherAlerts.length > 0; return this.weatherAlerts.length > 0;
}, },
appointmentType() { appointmentType() {
return this.TEMPORARYappointmentType; return this.$store.getters.order.serviceLocation.appointmentType;
//return this.$store.getters.order.serviceLocation.appointmentType;
}, },
timeSlotsForSelectedDate() { timeSlotsForSelectedDate() {
if (this.selectedDate === null) { if (this.selectedDate === null) {
@ -305,9 +301,6 @@ export default {
getServiceZipCtuCodeFromStore() { getServiceZipCtuCodeFromStore() {
return store.getters.order.serviceLocation.zipCodeCtu; return store.getters.order.serviceLocation.zipCodeCtu;
}, },
setAppointmentType(appointmentType) {
this.TEMPORARYappointmentType = appointmentType;
},
openInshopTimeSlotsModal() { openInshopTimeSlotsModal() {
this.$refs["timeSlotModalQuestion"].openModal(); this.$refs["timeSlotModalQuestion"].openModal();
}, },
@ -317,6 +310,12 @@ export default {
).timeSlots; ).timeSlots;
return timeSlots.find((timeSlot) => timeSlot.id === timeSlotId); return timeSlots.find((timeSlot) => timeSlot.id === timeSlotId);
}, },
timeSlotModalClosed() {
// Clear the selectedDate if no timeslot has been selected
if (!this.selectedTimeSlotId) {
this.selectedDate = null;
}
},
backButtonAction() { backButtonAction() {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);
}, },
@ -337,10 +336,11 @@ export default {
}, },
}, },
watch: { watch: {
selectedDate(date) { selectedDate(newValue, oldValue) {
/* EXAMPLE RETURNED date OBJECT: // Clear time slot selection if date selected changes
{ "year": 2023, "month": 5, "date": 25, "dateString": "2023-05-25" } if (newValue!== oldValue) {
*/ this.selectedTimeSlotId = null;
}
}, },
}, },
components: { components: {

View file

@ -166,7 +166,7 @@ export default {
} }
let availableTimeSlots; let availableTimeSlots;
if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) { if (this.appointmentType === AppointmentTypeStrings.DROP_OFF) {
availableTimeSlots = [{ value: "Dropoff", buttonLabel: this.dropoffButtonText }]; availableTimeSlots = [{ value: this.dateAndTimeSlotData.timeSlots[0], buttonLabel: this.dropoffButtonText }];
} else { } else {
availableTimeSlots = this.dateAndTimeSlotData.timeSlots.map((timeslot) => { availableTimeSlots = this.dateAndTimeSlotData.timeSlots.map((timeslot) => {
let readableTime; let readableTime;
@ -210,6 +210,7 @@ export default {
// fires any time the modal is closed, AFTER "closeModal" fires if footer button is used // fires any time the modal is closed, AFTER "closeModal" fires if footer button is used
onModalClosed() { onModalClosed() {
this.selectedTimeSlot = this.modelValue; this.selectedTimeSlot = this.modelValue;
this.$emit("time-slot-modal-closed");
}, },
// Expected input: "HH:MM:SS" // Expected input: "HH:MM:SS"
getDisplayTextForMilitaryTime(militaryTimeInput) { getDisplayTextForMilitaryTime(militaryTimeInput) {