From 1d1384dbcc07935b8dedbc85f783f139f7055c39 Mon Sep 17 00:00:00 2001 From: bmauger Date: Fri, 29 Apr 2022 10:45:41 -0400 Subject: [PATCH] WIP vin lookup. --- .../heritage-integration/navigation-helper.js | 2 +- src/layouts/vin-lookup/vin-lookup.vue | 34 +++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 49c4ab354..221b7b79b 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -93,7 +93,7 @@ async function getLatestPageForRedirection() { return fmgPageValues.VEHICLE_DAMAGE; } else { if (store.getters.vehicle.vin) { - return fmgPageValues.LICENSE_PLATE_LOOKUP; + return fmgPageValues.VIN_LOOKUP; } else { return fmgPageValues.VIN_LOOKUP; } diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c596a4078..8e6c583bc 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -149,12 +149,13 @@ export default { foundWindshieldAlert: false, vinNotFound: false, perfectMatchNewVinAlert: false, - vin: '', - zip: '', - email: '', + vin: this.getVinFromStore(), + zip: this.getZipFromStore(), + email: this.getEmailFromStore(), customAlertData: {}, isCarIdDifferent: false, previouslyEnteredCarId: '', + invalidZip: '', }; }, computed: { @@ -172,7 +173,7 @@ export default { return text; }, NoServiceZipHeader(){ - let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.zip); + let text = this.getCmsContent("NoServiceZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.invalidZip); return text; }, @@ -201,6 +202,15 @@ export default { store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null); store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, + getEmailFromStore(){ + return store.getters.order.customer.emailAddress + }, + getVinFromStore(){ + return store.getters.vehicle.vin + }, + getZipFromStore(){ + return store.getters.vehicle.registration.zipCode + }, backButtonAction() { this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route); }, @@ -210,17 +220,20 @@ export default { this.customAlertData.zip = this.zip; this.$refs.funnelFooter.removeLoader(); this.noServiceZip = true; + this.invalidZip = this.zip; return; } const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => { this.vinNotFound = true; this.$refs.funnelFooter.removeLoader(); + this.noServiceZip = false; return; }); this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId; if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) { this.previouslyEnteredCarId = vehicleLookup.data.carId; + this.noServiceZip = false; this.customAlertData.vehicleInfo = vehicleLookup.data; this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`); this.isVinValid = true; @@ -228,19 +241,18 @@ export default { this.$refs.funnelFooter.removeLoader(); this.matchedDifferentVehicle = true; return; - }; - this.updateStore(vehicleLookup) + } + this.updateStore(vehicleLookup.data) const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( this.storeActions.GET_PARTS_OR_QUESTIONS, { carId: vehicleLookup.data.carId, glassArray: this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle ? [] : store.getters.damage.glassToReplace, zipCode: this.zip, - vin: vehicleLookup.vin + vin: this.vin }, false ); - console.log(vehicleLookup.data); this.navigateForward(partsData); }, navigateForward(partsData){ @@ -265,9 +277,9 @@ export default { ); }, updateStore(carInfo) { - // if(vehicleDamage){ - // store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - // } + if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + } store.commit(storeMutations.UPDATE_VEHICLE_VIN, this.vin); store.commit(storeMutations.UPDATE_YEAR, carInfo.year); store.commit(storeMutations.UPDATE_MAKE, carInfo.make);