diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 8bac8dbb4..762af0d72 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -252,6 +252,7 @@ export default { this.$emit("updated-mobile-fee-part", mobileFeePart); this.$emit("updated-serviceability", serviceabilityDetails.data); this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase); + this.$emit("updated-mobile-ctu", zipCodeData.zipCodeCtu); // update the page level model this.$emit("update:modelValue", this.internalModel); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 0a74ab21e..bfec46932 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -83,6 +83,7 @@ @updated-mobile-fee-part="setMobileFeePart" @updated-serviceability="setServiceabilityDetails" @updated-contains-military-base="setContainsMilitaryBase" + @updated-mobile-ctu="setCtuForMobile" validationRules="mobile-location-required" ref="mobileLocationQuestions" linkWidgetName="MobileLocationLinkWidget" @@ -128,6 +129,7 @@ import contentGroupModal from "@/fmg-components/content-group-modal/content-grou // Supporting files import baseMixin from "@/mixins/base-mixin.js"; +import { AppointmentTypeStrings } from "@/constants/schedule-constants"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; @@ -181,6 +183,7 @@ export default { zipContainsMilitaryBase: false, zipCodeCtu: null, shopProviderData: null, + navigatingForward: false, }; }, async beforeRouteEnter(to, from, next) { @@ -374,6 +377,9 @@ export default { this.zipContainsMilitaryBase = val; } }, + setCtuForMobile(val) { + this.zipCodeCtu = val; + }, setMobileFeePart(mobileFeePart) { this.mobileFeePart = mobileFeePart; }, @@ -472,6 +478,33 @@ export default { } }, async forwardButtonAction() { + this.navigatingForward = true; + + // clear items not needed for appointmentType + if (this.selectedAppointmentType == AppointmentTypeStrings.IN_SHOP) { + // if we have a provider.zipCodeCtu that's different than the servicelocation.zipCodeCtu then they + // may have selected a shop in a different ctu. change the servicelocation zip/ctu if different + if (this.zipCodeCtu != this.selectedProvider.address.zipCodeCtu) { + this.zipCodeCtu = this.selectedProvider.address.zipCodeCtu; + this.zipCode = this.selectedProvider.address.zipCode; + } + + this.city = null; + this.streetAddress = null; + } + + if ( + this.selectedAppointmentType == AppointmentTypeStrings.MOBILE && + this.selectedProvider && + this.selectedProvider.address + ) { + this.selectedProvider.address.streetAddress = null; + this.selectedProvider.address.city = null; + this.selectedProvider.address.state = null; + this.selectedProvider.address.zipCode = null; + this.selectedProvider.address.zipCodeCtu = null; + } + await this.dispatchStoreAction( this.storeActions.SAVE_SERVICE_LOCATION, { @@ -507,16 +540,18 @@ export default { watch: { zipCode: { handler(newValue) { - getShopProviderData(this.zipCode).then(async (result) => { - this.shopProviderData = result.data; - if (this.selectedAppointmentType === "Mobile") { - this.selectedProvider = new Provider( - this.shopProviderData.mobileProviderNumber - ); - } else { - this.selectedProvider = new Provider(); - } - }); + if (!this.navigatingForward) { + getShopProviderData(this.zipCode).then(async (result) => { + this.shopProviderData = result.data; + if (this.selectedAppointmentType === "Mobile") { + this.selectedProvider = new Provider( + this.shopProviderData.mobileProviderNumber + ); + } else { + this.selectedProvider = new Provider(); + } + }); + } }, }, selectedAppointmentType: { diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 6ea36a903..d3fa4d0dd 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -155,7 +155,7 @@ export default { const deviceId = getDeviceIdValue(); // cookieNames.DXDEV const sessionId = getSessionIdValue(); // cookieNames.SESSION_ID const userAgent = navigator.userAgent; // navigator.userAgent - const refferer = + const referrer = applicationConfig.CURRENT_ENVIRONMENT != "Localhost" ? document.referrer : null; // see above const payload = { @@ -163,7 +163,7 @@ export default { deviceId: deviceId, sessionId: sessionId, userAgent: userAgent, - refferer: refferer, + referrer: referrer, }; const response = await baseMixin.methods.dispatchStoreAction(