From 7dc75315338fb8e5903df64bb0384ea0906ad7e2 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 18 May 2022 08:02:07 -0400 Subject: [PATCH] Now disabling the address autocomplete after displaying city, state, and zip --- src/layouts/address-lookup/address-lookup.vue | 4 +++- .../address-questions/address-questions.vue | 13 ++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index fca2b500c..b3ef4c6ae 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -297,8 +297,10 @@ export default { // if multiple cars were found let matchingCars = carsFound.filter(car => car.vehicle.carId === carEntered.carId); if (matchingCars.length === 1) { - // and one and only of them matches the car id entered this.$refs.loadingModal.showModal(); + + // and one and only of them matches the car id entered + const matchingCar = matchingCars[0]; this.updateVehicleInfo(matchingCar.vin, matchingCar.vehicle); navigateAfterSaveToHeritageFunnel(this.$route); } else { diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index e4acdcee0..59e4d26ab 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -175,7 +175,7 @@ export default ({ ); // Standard place_changed event handling - autocomplete.addListener('place_changed', fillInAddress); + const autocompleteListener = window.google.maps.event.addListener(autocomplete, 'place_changed', fillInAddress); // Wrapping the addressField1 element in the Google Address Autocomplete object // will cause "autocomplete='off'" which Chrome completely ignores. This event @@ -225,7 +225,6 @@ export default ({ } if (place && place.address_components) { - self.addressModel.streetAddress= ""; self.showAddressFields = true; for (const component of place.address_components) { @@ -262,7 +261,15 @@ export default ({ else { self.displayVerificationWarning = true; self.displayNoMatchWarning = false; - } + } + + // after showing the address fields, disable the address autocomplete + window.google.maps.event.removeListener(autocompleteListener); + window.google.maps.event.clearInstanceListeners(autocomplete); + addressField1.onchange = null; + const pacContainer = document.querySelector(".pac-container"); + pacContainer.remove(); + } }) .catch(() => {