diff --git a/jest.config.js b/jest.config.js index a757d5ada..28c5557cb 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,7 +26,7 @@ module.exports = { testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], coverageThreshold: { global: { - statements: 80, + statements: 78, // Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90 }, }, diff --git a/src/constants/endpoints.js b/src/constants/endpoints.js index 7d83642a6..53f981d8a 100644 --- a/src/constants/endpoints.js +++ b/src/constants/endpoints.js @@ -108,12 +108,14 @@ const endpoints = { }, GetShopTimeSlots: { url: "/schedule/api/v1/schedule/shop-time-slots", - mockUrl: "https://mockey.qa.sagaws.net/service/shop-time-slots", // TODO: REMOVE MOCKURL + method: "POST", + }, + GetMobileTimeSlots: { + url: "/schedule/api/v1/schedule/mobile-time-slots", method: "POST", }, GetMobileEarlyBirdFee: { url: "/parts/api/v1/parts/mobile-early-bird-fee", - mockUrl: "https://mockey.qa.sagaws.net/service/mobile-early-bird-fee", // TODO: REMOVE MOCKURL method: "GET", }, SaveSession: { diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 341fcd487..5ff98fd9d 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -33,6 +33,7 @@ const storeActions = { GET_MOBILE_FEE_PART: "getMobileFeePart", GET_SERVICEABILITY_DETAILS: "getServiceabilityDetails", GET_SHOP_TIME_SLOTS: "getShopTimeSlots", + GET_MOBILE_TIME_SLOTS: "getMobileTimeSlots", GET_PROVIDERS: "getProviders", GET_MOBILE_EARLY_BIRD_FEE: "getMobileEarlyBirdFee", SAVE_SESSION: "saveSession", diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index bd9ae6d9a..fefeb30ff 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -245,9 +245,10 @@ export default { let myPromise = new Promise((resolve, reject) => { const response = config.customSelectableDatesCallback( - initialViewStartDate, - initialViewEndDate, - store.getters.order.serviceLocation.appointmentType + initialViewStartDate.toISOString().split("T")[0], + initialViewEndDate.toISOString().split("T")[0], + store.getters.order.serviceLocation.appointmentType, + store.getters.order.serviceLocation.provider.providerNumber ); resolve(response); }); @@ -309,7 +310,6 @@ export default { this.hideSomeDaysForInitialView = config.hideSomeDaysForInitialView; const hideSecondMonth = config.hideSecondMonth; const direction = config.calendarViewDirection; - const monthsAfterToLoadOffset = 12; const monthsBeforeToLoadOffset = 36; config.initialShopTimeSlotsResponse.days.forEach((selectableDate) => { @@ -526,7 +526,8 @@ export default { const moreSelectableDates = await this.customSelectableDatesCallback( monthStart, monthEnd, - this.$store.getters.order.serviceLocation.appointmentType + this.$store.getters.order.serviceLocation.appointmentType, + this.$store.getters.order.serviceLocation.provider.providerNumber ); moreSelectableDates.days.forEach((selectableDate) => { const index = this.selectableDatesData.findIndex( diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index b43be23ad..37bdc8622 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -81,18 +81,33 @@ import store from "@/store"; defineRule("date-required", required(errorMessages.DATE_REQUIRED)); defineRule("time-slot-selection-required", required(errorMessages.DATE_REQUIRED)); -const getAvailableDates = async (startDate, endDate, appointmentType) => { +const getAvailableDates = async (startDate, endDate, appointmentType, providerNumber) => { // USING DATES PASSED, MAKE AN API CALL - const newShopTimeSlotsResponse = await baseMixin.methods.dispatchStoreAction( - storeActions.GET_SHOP_TIME_SLOTS, - { - startDate: startDate, - endDate: endDate, - shopAppointmentType: appointmentType, - }, - false - ); - const newShopTimeSlots = newShopTimeSlotsResponse.data; + + let newTimeSlotsResponse; + if (appointmentType === AppointmentTypeStrings.MOBILE) { + newTimeSlotsResponse = await baseMixin.methods.dispatchStoreAction( + storeActions.GET_MOBILE_TIME_SLOTS, + { + startDate: startDate, + endDate: endDate, + }, + false + ); + } else { + newTimeSlotsResponse = await baseMixin.methods.dispatchStoreAction( + storeActions.GET_SHOP_TIME_SLOTS, + { + startDate: startDate, + endDate: endDate, + shopAppointmentType: appointmentType, + providerNumber: providerNumber, + }, + false + ); + } + + const newShopTimeSlots = newTimeSlotsResponse.data; return convertApiResponse(newShopTimeSlots); }; const convertApiResponse = (responseData) => { @@ -152,7 +167,6 @@ export default { const alertReasonsPromise = locationAlerts.methods.loadInitialData( store.getters.order.serviceLocation.zipCodeCtu ); - // Settle promises and get results const promiseResultMap = [ { @@ -241,7 +255,8 @@ export default { const newShopTimeSlots = await getAvailableDates( startDate, endDate, - this.appointmentType + this.appointmentType, + this.$store.getters.order.serviceLocation.provider.providerNumber ); // ADD API CALL RESULTS TO EXISTING DATE DATA this.selectableDatesData.days = this.selectableDatesData.days.concat( @@ -262,7 +277,7 @@ export default { return timeSlots.find((timeSlot) => timeSlot.id === timeSlotId); }, timeSlotModalClosed() { - // Clear the selectedDate if no timeslot has been selected + // Clear the selectedDate if no timeSlot has been selected if (!this.selectedTimeSlotData.id) { this.selectedDate = null; } @@ -302,6 +317,7 @@ export default { convertSelectedDateToShortMonthAndDay(selectedDate) { // This conversion ensures we don't get get GMT induced date changes const dateObject = new Date(`${selectedDate.dateString}T00:00:00`); + // Ex: April 25 return dateObject.toLocaleDateString("en-us", { month: "short", day: "numeric" }); }, // Expected input: "HH:MM:SS" diff --git a/src/layouts/schedule/time-slot-modal-question/timeslot-modal-list-button/timeslot-modal-list-button.vue b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-list-button/time-slot-modal-list-button.vue similarity index 97% rename from src/layouts/schedule/time-slot-modal-question/timeslot-modal-list-button/timeslot-modal-list-button.vue rename to src/layouts/schedule/time-slot-modal-question/time-slot-modal-list-button/time-slot-modal-list-button.vue index 8c0f3db0a..44ac0d9e8 100644 --- a/src/layouts/schedule/time-slot-modal-question/timeslot-modal-list-button/timeslot-modal-list-button.vue +++ b/src/layouts/schedule/time-slot-modal-question/time-slot-modal-list-button/time-slot-modal-list-button.vue @@ -15,7 +15,6 @@ {{ formattedButtonLabelSubCopy }} - {{ screenReaderOnlyText }} @@ -28,7 +27,7 @@ import baseInputButton from "@/digital-components/base-input-button/base-input-b import inputButtonWrapperMixin from "@/mixins/input-button-wrapper-mixin"; export default { - name: "timeslotModalListButton", + name: "timeSlotModalListButton", mixins: [inputButtonWrapperMixin], computed: { formattedButtonLabelSubCopy() { @@ -52,9 +51,6 @@ export default {