diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index d9d231541..d72b78964 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -43,10 +43,10 @@ export async function getPageToRouteExistingOrderTo(toRoute = {}, existingHerita return 'vehicle-damage' } else { if (store.getters.vehicle.vin) { - return 'heritage'; + return 'vehicle-damage'; //return "vin-lookup"; (uncomment) } else { - return 'vehicle-damage'; + return 'license-plate-lookup'; //return "estimate" (uncomment) } } diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 2f6782a40..9d447e848 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -105,6 +105,7 @@ export default { // Call the "next" function to complete the transition to this page. next((vm) => { vm.setCmsContent(resultMap.cmsContent); + console.log(store.state) }); }, props: { @@ -142,25 +143,39 @@ export default { this.newServiceZipRequired = true; return; } - const vinLookup = await this.lookupVin(this.licensePlate, zipValidation.data.state).catch(() => { + const vinLookup = await this.lookupVin(this.licensePlate, zipValidation.data.state).catch((err) => { + console.log(err) this.$refs.funnelFooter.removeLoader(); this.vinNotValid = true; return; }); - if (vinLookup.data.vehicle.carId !== store.getters.vehicle.carId) { + if (vinLookup.data.vehicle.carId !== store.getters.vehicle.carId && !this.vinDoesNotMatchCarId) { this.$refs.funnelFooter.updateButtonText(`Continue with ${vinLookup.data.vin} ${vinLookup.data.vehicle.year} ${vinLookup.data.vehicle.make} ${vinLookup.data.vehicle.model}`); this.$refs.funnelFooter.removeLoader(); this.vinDoesNotMatchCarId = true; return; } + let vin; + let carInfo; + + if(this.vinDoesNotMatchCarId) { + vin = vinLookup.data.vin; + carInfo = vinLookup.data.vehicle; + } else { + vin = store.getters.vehicle.vin; + carInfo = store.getters.vehicle; + } + + this.updateStore(vin, carInfo, zipValidation.data.state); + const partsData = await baseMixin.methods.dispatchNonBlockingStoreAction( this.storeActions.GET_PARTS_OR_QUESTIONS, { - carId: store.getters.vehicle.carId, + carId: carInfo.carId, glassArray: store.getters.damage.glassToReplace, - zipCode: this.zip, - vin: vinLookup.vin + zipCode: this.serviceZip ? this.serviceZip : this.zip, + vin: vin }, false ); @@ -190,25 +205,25 @@ export default { { licensePlate: plate, licenseState: state } ); }, - updateStore() { + updateStore(vin, carInfo, registrationState) { // if(vehicleDamage){ // store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); // } - store.commit(storeMutations.UPDATE_VEHICLE_VIN, null); - store.commit(storeMutations.UPDATE_YEAR, null); - store.commit(storeMutations.UPDATE_MAKE, null); - store.commit(storeMutations.UPDATE_MODEL, null); - store.commit(storeMutations.UPDATE_STYLE, null); - store.commit(storeMutations.UPDATE_CAR_ID, null); - store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); - store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, null); - store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, null); - store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, null); - store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, null); - store.commit(storeMutations.UPDATE_REGISTRATION_STATE, null); - store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, null); - store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, null); - store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, null); + store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin); + store.commit(storeMutations.UPDATE_YEAR, carInfo.year); + store.commit(storeMutations.UPDATE_MAKE, carInfo.make); + store.commit(storeMutations.UPDATE_MODEL, carInfo.model); + store.commit(storeMutations.UPDATE_STYLE, carInfo.style); + store.commit(storeMutations.UPDATE_CAR_ID, carInfo.carId); + store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, carInfo.category); + store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, carInfo.imageUrl); + store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, carInfo.imageVifNumber); + store.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, carInfo.imageColor); + store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, this.licensePlate); + store.commit(storeMutations.UPDATE_REGISTRATION_STATE, registrationState); + store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, this.zip); + store.commit(storeMutations.UPDATE_SERVICE_LOCATION_ZIP, this.serviceZip); + store.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, this.email); }, }, components: {