From ddc47e346b3c2b36a8c30a09fc65c22459bdf245 Mon Sep 17 00:00:00 2001 From: Katie Date: Fri, 13 May 2022 09:20:04 -0400 Subject: [PATCH] CSR-416 Move setting service address to address-lookup --- .../heritage-integration/navigation-helper.js | 12 ------------ src/layouts/address-lookup/address-lookup.vue | 11 +++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 6d2c0d93e..9bf69ddcf 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -58,8 +58,6 @@ export async function navigateAfterSaveToHeritageFunnel(currentRoute) { const currentComponent = currentRoute.matched[0].components; currentComponent.default.methods.resetDependentState(); - setupOrderBeforeSave(); - // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); @@ -144,14 +142,4 @@ function isVinRelatedPage(toRoute) { fmgPageValue === fmgPageValues.ADDRESS_LOOKUP || fmgPageValue === fmgPageValues.ADDRESS_VEHICLES || fmgPageValue === fmgPageValues.ESTIMATE; -} - -function setupOrderBeforeSave() { - const serviceLocation = store.getters.order.serviceLocation; - - if (!serviceLocation.zipCode && serviceLocation.zipCode == store.getters.vehicle.registration.zipCode) { - baseMixin.methods.dispatchStoreAction( - storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION - ); - } } \ No newline at end of file diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index b6140be2f..95b3fd690 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -264,6 +264,8 @@ export default { this.displayVinLookupByHomeAddressNotAllowedAlert = false; }, navigateForward(carEntered, carsFound) { + this.updateServiceLocationIfNecessary(); + if (carsFound.length == 1) { // if a different vehicle is found than the one entered and the selected glass // is not available for that vehicle @@ -335,6 +337,15 @@ export default { store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.customerQuestions.emailAddress); }, + updateServiceLocationIfNecessary() { + const serviceLocation = store.getters.order.serviceLocation; + + if (!serviceLocation.address && serviceLocation.zipCode && serviceLocation.zipCode == store.getters.vehicle.registration.zipCode) { + baseMixin.methods.dispatchStoreAction( + storeActions.UPDATE_SERVICE_LOCATION_WITH_VEHICLE_REGISTRATION + ); + } + } }, computed: { AlertNonServiceableZipHeader(){