diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index d83050f1a..45a34abbd 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -306,8 +306,7 @@ export default { const monthsAfterToLoadOffset = 12; // TO BE MADE "CONSTANTS" const monthsBeforeToLoadOffset = 36; // TO BE MADE "CONSTANTS" - - config.initialShopTimeSlotsResponse.forEach((selectableDate) => { + config.initialShopTimeSlotsResponse.days.forEach((selectableDate) => { this.selectableDatesData.push(selectableDate); }); @@ -522,7 +521,7 @@ export default { monthStart, monthEnd ); - moreSelectableDates.forEach((selectableDate) => { + moreSelectableDates.days.forEach((selectableDate) => { const index = this.selectableDatesData.findIndex( (obj) => obj.dateString === selectableDate.dateString ); diff --git a/src/digital-components/date-picker/mixins/constants.js b/src/digital-components/date-picker/mixins/constants.js index b35d324cd..f37e312f5 100644 --- a/src/digital-components/date-picker/mixins/constants.js +++ b/src/digital-components/date-picker/mixins/constants.js @@ -21,10 +21,6 @@ const MONTHS_OF_YEAR = [ "December", ]; -<<<<<<< HEAD:src/constants/scheduling.js -const daysOfWeek = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; +const DAYS_OF_WEEK = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; -export { monthsOfYear, daysOfWeek }; -======= -export { TIMINGFUNC_MAP, BUFFER_OFFSET, MONTHS_OF_YEAR }; ->>>>>>> CSR-886:src/digital-components/date-picker/mixins/constants.js +export { TIMINGFUNC_MAP, BUFFER_OFFSET, MONTHS_OF_YEAR, DAYS_OF_WEEK }; diff --git a/src/digital-components/modal/modal.vue b/src/digital-components/modal/modal.vue index 508ca256c..e1f3fb462 100644 --- a/src/digital-components/modal/modal.vue +++ b/src/digital-components/modal/modal.vue @@ -100,7 +100,7 @@ export default { isFooterButtonDisabled() { if (!this.meta.touched) { return !this.meta.valid; - } + } return !this.meta.dirty || !this.meta.valid; }, }, diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 30dd040af..d82f43ea9 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -46,9 +46,8 @@ :mobileEarlyBirdFee="mobileEarlyBirdFee" :dateAndTimeSlotData="timeSlotsForSelectedDate" :estimatedServiceMinutesMinimum="selectableDatesData.estimatedServiceMinutesMinimum" - :estimatedServiceMinutesMaximum=" - selectableDatesData.estimatedServiceMinutesMaximum" - validationRules="time-slot-selection-required"/> + :estimatedServiceMinutesMaximum="selectableDatesData.estimatedServiceMinutesMaximum" + validationRules="time-slot-selection-required" /> @@ -106,11 +105,11 @@ const getAvailableDates = async (startDate, endDate) => { false ); const newShopTimeSlots = newShopTimeSlotsResponse.data; - return convertApiResponse(newShopTimeSlots.days); + return convertApiResponse(newShopTimeSlots); }; const convertApiResponse = (responseData) => { // DATA CONVERSION - responseData?.forEach((date) => { + responseData?.days.forEach((date) => { const dateString = date.date; date.dateString = dateString; const dateStringPieces = dateString.split("-"); @@ -131,7 +130,6 @@ export default { weatherAlerts: [], mobileEarlyBirdFee: null, TEMPORARYappointmentType: "Inshop", - }; }, async beforeRouteEnter(to, from, next) { @@ -142,19 +140,17 @@ export default { selectableDatesSetting: "custom", initialViewRowsToShow: 5, customSelectableDatesCallback: getAvailableDates, - const earlyBirdPromise = baseMixin.methods.dispatchStoreAction( - storeActions.GET_MOBILE_EARLY_BIRD_FEE - ); - // Price EARLY BIRD pre-emptively to allow for asynchronous call to pricing - // const pricingPromise = baseMixin.methods.dispatchStoreAction( - // storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, - // { - // availableLineItems: [ - // {partNumber: "EARLY BIRD"} - // ], - // }, - // false - // ); + + // Price EARLY BIRD pre-emptively to allow for asynchronous call to pricing + // const pricingPromise = baseMixin.methods.dispatchStoreAction( + // storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA, + // { + // availableLineItems: [ + // {partNumber: "EARLY BIRD"} + // ], + // }, + // false + // ); /* vvvvv SAVE THESE FOR TESTING PURPOSES FOR NOW vvvvv @@ -173,6 +169,9 @@ export default { */ }); + const earlyBirdPromise = baseMixin.methods.dispatchStoreAction( + storeActions.GET_MOBILE_EARLY_BIRD_FEE + ); const alertReasonsPromise = getAlertReasons(store.getters.order.serviceLocation.zipCodeCtu); // Settle promises and get results @@ -210,6 +209,7 @@ export default { vm.mobileEarlyBirdFee.laborAmount = 15; vm.mobileEarlyBirdFee.sellingPrice = 0; vm.mobileEarlyBirdFee.kitPrice = 0; + vm.selectableDatesData = resultMap.datePickerInitialData.initialShopTimeSlotsResponse; // if (resultMap.earlyBird) { // vm.mobileEarlyBirdFee = resultMap.pricingResults; // } @@ -234,7 +234,7 @@ export default { if (this.selectedDate === null) { return null; } - return this.selectableDatesData.find( + return this.selectableDatesData.days.find( (selectableDate) => selectableDate.dateString === this.selectedDate.dateString ); }, @@ -267,20 +267,12 @@ export default { // NEED TODO - WHAT ARE PAGE REQ'S FOR THIS PAGE? }, async getAvailableDatesMethod(startDate, endDate) { - /* TODO - DO WE NEED TO KEEP AN AGGREGATE OF ALL DATES RETURNED - FOR TIMESLOTS in this.selectableDatesData? IS selectableDatesData EVEN NEEDED? - - // // ADD API CALL RESULTS TO EXISTING DATE DATA - // this.selectableDatesData = this.selectableDatesData.concat( - // this.convertApiResponse(newShopTimeSlots.days) - // ); - // // console.log("this.selectableDatesData is now: ", this.selectableDatesData); - - // // RETURN AGGREGATE DATE DATA - // return this.selectableDatesData; - */ - - return await getAvailableDates(startDate, endDate); + const newShopTimeSlots = await getAvailableDates(startDate, endDate); + // ADD API CALL RESULTS TO EXISTING DATE DATA + this.selectableDatesData.days = this.selectableDatesData.days.concat( + newShopTimeSlots.days + ); + return newShopTimeSlots; }, setData(alertReasonsData) { if (alertReasonsData) { @@ -320,7 +312,7 @@ export default { this.$refs["timeSlotModalQuestion"].openModal(); }, getTimeSlotObjectFromTimeSlotId(timeSlotId) { - const timeSlots = this.selectableDatesData.find( + const timeSlots = this.selectableDatesData.days.find( (selectableDate) => selectableDate.dateString === this.selectedDate.dateString ).timeSlots; return timeSlots.find((timeSlot) => timeSlot.id === timeSlotId); 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 e9bef555e..21b095704 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 @@ -20,10 +20,13 @@ groupName="ChooseTimeSlot" textPosition="text-center" v-model="selectedTimeSlot" - isRequired + isRequired validationRules="time-slot-required" - class="mt-5"/> -
+ class="mt-5" /> +