diff --git a/src/layouts/service-location/appointment-type-question/appointment-type-question.vue b/src/layouts/service-location/appointment-type-question/appointment-type-question.vue index 4c1c0d031..cc702529a 100644 --- a/src/layouts/service-location/appointment-type-question/appointment-type-question.vue +++ b/src/layouts/service-location/appointment-type-question/appointment-type-question.vue @@ -34,6 +34,7 @@ export default { isServiceableInshop: Boolean, isServiceableDropoff: Boolean, mobileFeeApplies: Boolean, + zipCode: String, }, computed: { questionText() { @@ -47,6 +48,7 @@ export default { const shouldShowInshop = this.isServiceableInshop; const shouldShowDropoff = this.isServiceableDropoff && !this.$store.getters.damage.isRepair; + const zipCode = this.zipCode; var answers = this.answersFromCms ? this.answersFromCms.filter((answer) => { @@ -87,12 +89,15 @@ export default { watch: { answersToDisplay: { handler(newValue) { - // If there is only one option to display and that option is 'Mobile' then select it - if ( - newValue.length == 1 && - newValue.findIndex((answer) => answer.Name == "Mobile") != -1 - ) { - this.selectedValue = "Mobile"; + // If there is only one option to display and that option is 'Mobile' or 'Inshop' then select it + if (newValue.length == 1) { + const name = newValue[0].Name; + if ( + name === AppointmentTypeStrings.MOBILE || + name === AppointmentTypeStrings.IN_SHOP + ) { + this.selectedValue = name; + } } }, immediate: true, @@ -100,14 +105,14 @@ export default { isMobileOnly: { handler(newValue) { if (newValue) { - this.selectedValue = "Mobile"; + this.selectedValue = AppointmentTypeStrings.MOBILE; } }, }, isInshopOnly: { handler(newValue) { if (newValue) { - this.selectedValue = "Inshop"; + this.selectedValue = AppointmentTypeStrings.IN_SHOP; } }, }, diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index 106ed892c..a85b180f9 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -8,6 +8,7 @@ export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) { } const zipCodeData = await getZipCodeData(serviceZipCode); + const providerData = await getShopProviderData(serviceZipCode); // Get the Mobile Fee Part const mobileFeePart = await baseMixin.methods.dispatchStoreActionWithLogging( @@ -15,6 +16,7 @@ export async function getPricedMobileFeePart(serviceZipCode, pageNameToLog) { { serviceZipCode: serviceZipCode, serviceZipCodeCtu: zipCodeData.zipCodeCtu, + mobileProviderNumber: providerData.data.mobileProviderNumber, }, pageNameToLog, false diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js index 5bb41c657..06f34f125 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.spec.js @@ -91,6 +91,7 @@ const mockStoreActionPriceOrderItemsAndSaveServerData = storeActions.PRICE_ORDER_ITEMS_AND_SAVE_SERVER_DATA; const mockStoreActionGetServiceabilityDetails = storeActions.GET_SERVICEABILITY_DETAILS; const mockStoreActionGetShopTimeSlots = storeActions.GET_SHOP_TIME_SLOTS; +const mockStoreActionGetProviders = storeActions.GET_PROVIDERS; const mockGetShopTimeSlotsGoodAvailability = { data: { @@ -236,6 +237,15 @@ jest.mock("@/mixins/base-mixin.js", () => ({ return Promise.resolve(mockGetShopTimeSlotsLowAvailability); } + + if (actionName === mockStoreActionGetProviders) { + return Promise.resolve({ + data: { + mobileProviderNumber: "001820", + shopProviders: [{}], + }, + }); + } }), }, })); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index ef27cbbb8..b161a6141 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -79,6 +79,7 @@ :isServiceableDropoff="isServiceableDropoff" :isDisplayed="isAppointmentTypeDisplayed" :mobileFeeApplies="mobileFeeApplies" + :zipCode="zipCode" ref="appointmentTypeQuestion" groupName="appointmentTypeQuestion" cmsWidgetName="AppointmentTypeQuestionWidget" @@ -112,14 +113,17 @@ :selectedAppointmentType="selectedAppointmentType" :shopProviderData="shopProviderData" :isDisplayed="isShopQuestionDisplayed" - cmsWidgetName="ShopQuestionWidget" /> + cmsWidgetName="ShopQuestionWidget" + :isInshopOnly="isInshopOnly" /> @@ -419,6 +423,11 @@ export default { isNoComp() { return store.getters.order.policy.isNoComp; }, + isInshopOnly() { + return ( + this.isServiceableInshop && !this.isServiceableMobile && !this.isServiceableDropoff + ); + }, }, methods: { arePagePrerequisitesValid() { diff --git a/src/layouts/service-location/shop-question/shop-question.vue b/src/layouts/service-location/shop-question/shop-question.vue index 417a3b4c4..5e85b752b 100644 --- a/src/layouts/service-location/shop-question/shop-question.vue +++ b/src/layouts/service-location/shop-question/shop-question.vue @@ -77,6 +77,7 @@ export default { cmsWidgetName: String, validationRules: String, isDisplayed: Boolean, + isInshopOnly: Boolean, }, computed: { questionText() { @@ -233,9 +234,8 @@ export default { // nothing to do with this component. We could mitigate this by showing / hiding this component with v-if but that messes // up the component initialization on page load. async handler() { - this.resetAnswers(); - await nextTick(); + this.resetAnswers(); this.getNextShopsFromList(); }, }, diff --git a/src/store/index.js b/src/store/index.js index 53ec6864e..753d8509b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1736,7 +1736,10 @@ export const actions = { return response; }, - getMobileFeePart(context, { payload: { serviceZipCode, serviceZipCodeCtu }, pageNameToLog }) { + getMobileFeePart( + context, + { payload: { serviceZipCode, serviceZipCodeCtu, mobileProviderNumber }, pageNameToLog } + ) { const serviceType = context.getters.damage.isRepair ? "Repair" : "Install"; const facilityType = "Mobile"; const parentAccountNumber = context.getters.payment.parentAccountNumber; @@ -1754,6 +1757,7 @@ export const actions = { order.serviceLocation?.zipCode; var providerNumber = + mobileProviderNumber ?? serviceZipCodeCtu ?? order.serviceLocation?.provider?.providerNumber ?? order.serviceLocation?.zipCodeCtu;