diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 989dec817..49c4ab354 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -95,7 +95,7 @@ async function getLatestPageForRedirection() { if (store.getters.vehicle.vin) { return fmgPageValues.LICENSE_PLATE_LOOKUP; } else { - return fmgPageValues.ESTIMATE; + return fmgPageValues.VIN_LOOKUP; } } } @@ -134,7 +134,7 @@ function overrideYmmsDirectionIfNeeded(toRoute) { /* istanbul ignore next */ function isVinRelatedPage(toRoute) { const fmgPageValue = toRoute.query[queryStrings.FMG_PAGE]; - + return fmgPageValue === fmgPageValues.VIN_LOOKUP || fmgPageValue === fmgPageValues.LICENSE_PLATE_LOOKUP || fmgPageValue === fmgPageValues.ADDRESS_LOOKUP || diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index c3a1bbc33..409039bdc 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -31,10 +31,11 @@ - - { + const vehicleLookup = await this.lookupVehicle(this.vin).catch(() => { + this.vinNotFound = true; this.$refs.funnelFooter.removeLoader(); - this.noMatchAlert = true; return; }); - if (vinLookup.data.carId !== store.getters.vehicle.carId) { - this.customAlertData.vehicleInfo = vinLookup.data.vehicle; + this.isCarIdDifferent = vehicleLookup.data.carId !== store.getters.vehicle.carId; + + if (this.isCarIdDifferent && (vehicleLookup.data.carId !== this.previouslyEnteredCarId)) { + this.previouslyEnteredCarId = vehicleLookup.data.carId; + this.customAlertData.vehicleInfo = vehicleLookup.data; + this.$refs.funnelFooter.updateButtonText(`Continue with ${vehicleLookup.data.year} ${vehicleLookup.data.make} ${vehicleLookup.data.model}`); + this.isVinValid = true; + this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vehicleLookup.data.carId); this.$refs.funnelFooter.removeLoader(); - this.foundWindshieldAlert = true; + this.matchedDifferentVehicle = true; return; - } - const carInfo = this.vinDoesNotMatchCarId ? vinLookup.data : store.getters.vehicle; - this.updateStore(carInfo) - const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( - this.storeActions.GET_PARTS_OR_QUESTIONS, - { - carId: store.getters.vehicle.carId, - glassArray: store.getters.damage.glassToReplace, - zipCode: this.zip, - vin: vinLookup.vin - }, - false - ); - this.navigateForward(partsData); + }; + //const carInfo = this.vinDoesNotMatchCarId ? vehicleLookup.data : store.getters.vehicle; + //this.updateStore(carInfo) + // const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( + // this.storeActions.GET_PARTS_OR_QUESTIONS, + // { + // carId: store.getters.vehicle.carId, + // glassArray: store.getters.damage.glassToReplace, + // zipCode: this.zip, + // vin: vehicleLookup.vin + // }, + // false + // ); + // this.navigateForward(partsData); }, navigateForward(partsData){ if(partsData.data.partsOrQuestions[0].partQuestions && partsData.data.partsOrQuestions[0].partQuestions.length > 0){ @@ -229,7 +259,7 @@ export default { { zip } ); }, - lookupVin(vin) { + lookupVehicle(vin) { return baseMixin.methods.dispatchNonBlockingStoreAction( storeActions.LOOKUP_VEHICLE_BY_VIN, { vin } @@ -253,11 +283,6 @@ export default { store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, }, - computed: { - isVinFieldReadOnly(){ - return this.$store.getters.payment.insuranceCoverage.isVerified; - } - }, components: { Form, funnelHeader,