diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index f29e3d21a..c3f3b217d 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -85,12 +85,14 @@ import { storeMutations } from "@/constants/store-mutations"; import baseMixin from "@/mixins/base-mixin"; import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { getDamageString, isGlassAvailableForCarId } from "@/helpers/damage-helper"; +import vinPagesMixin from "@/mixins/vin-pages-mixin"; defineRule("service-zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); defineRule("service-zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT)); export default { name: "address-lookup", + mixins: [vinPagesMixin], async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -298,19 +300,17 @@ export default { ); } else { // otherwise - this.$refs.loadingModal.showModal(); - navigateAfterSaveToHeritageFunnel(this.$route); + this.navigateForwardWithSingleCarMatch(); } } else if (carsFound.length > 1) { // if multiple cars were found let matchingCars = carsFound.filter(car => car.vehicle.carId === carEntered.carId); if (matchingCars.length === 1) { - 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); + + this.navigateForwardWithSingleCarMatch(); } else { // if there are no matches or there are multiple matches, navigate to "address-vehicles" page this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_MULTIPLE_VEHICLES, this.$route, {}, {}, carsFound); diff --git a/src/layouts/address-vehicles/address-vehicles.vue b/src/layouts/address-vehicles/address-vehicles.vue index faf71e1fb..db4000956 100644 --- a/src/layouts/address-vehicles/address-vehicles.vue +++ b/src/layouts/address-vehicles/address-vehicles.vue @@ -71,13 +71,15 @@ import { isGlassAvailableForCarId } from "@/helpers/damage-helper"; import { doesCopyContainRouterLink, splitCopyOnCMSPlaceHolder, getRouterLinkRouteFromCopy, - getRouterLinkDisplayTextFromCopy, } from "@/helpers/cms-content-helper" + getRouterLinkDisplayTextFromCopy, } from "@/helpers/cms-content-helper"; +import vinPagesMixin from "@/mixins/vin-pages-mixin"; // DEFINE VALIDATION RULES defineRule("vehicle-required", required(errorMessages.VEHICLE_REQUIRED)); export default { name: "address-vehicles", + mixins: [vinPagesMixin], async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -188,8 +190,7 @@ export default { ); return; } else { - this.$refs.loadingModal.showModal(); - navigateAfterSaveToHeritageFunnel(this.$route); + this.navigateForwardWithSingleCarMatch(); return; } }, diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index f3a5d3e83..b0360776c 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -98,10 +98,10 @@ import baseMixin from "@/mixins/base-mixin.js"; import { storeActions } from "@/constants/store-actions"; import { storeMutations } from "@/constants/store-mutations"; import { errorMessages } from "@/constants/error-messages"; -import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { getDamageString, isGlassAvailableForCarId, } from "@/helpers/damage-helper"; import { required, regex, } from "@/helpers/validation-rules"; import { Form, defineRule, } from "vee-validate"; +import vinPagesMixin from "@/mixins/vin-pages-mixin"; // DEFINE VALIDATION RULES defineRule("license-plate-required", required(errorMessages.LICENSE_PLATE_REQUIRED)); @@ -112,6 +112,7 @@ defineRule("email-address-format", regex(/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+ export default { name: "license-plate-lookup", + mixins: [vinPagesMixin], async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -297,8 +298,7 @@ export default { ); return; } else { - this.$refs.loadingModal.showModal(); - navigateAfterSaveToHeritageFunnel(this.$route); + this.navigateForwardWithSingleCarMatch(); return; } }, @@ -312,7 +312,7 @@ export default { }, updateCustomerInfo(vin, vehicleInfo, registrationState, serviceState) { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } store.commit(storeMutations.UPDATE_VEHICLE_VIN, vin); store.commit(storeMutations.UPDATE_YEAR, vehicleInfo.year); diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 54c4aaf4d..ba75e8e9e 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -5,9 +5,7 @@

Part Questions Page Placeholder

- +
diff --git a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue index 86045e52e..1d371fdc1 100644 --- a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue +++ b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue @@ -135,6 +135,7 @@ export default { }, PartDataFromApi() { + console.log(this.$store.getters.pageData(this.$route.query.fmgPage)) return this.$store.getters.pageData(this.$route.query.fmgPage); }, }, @@ -168,7 +169,7 @@ export default { // Check if only a single part is present for the tint and set the v-model if it is. AutoSelectIfSinglePart() { // Check if the selected tint only has a single feature - Object.keys(this.PartDataFromApi.partsOrQuestions).forEach((key) => { + Object.keys(this.PartDataFromApi.partsOrQuestions ?? {}).forEach((key) => { const currentGlassSelection = this.PartDataFromApi.partsOrQuestions[key]; diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 93435b82a..ff5e75612 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -140,6 +140,7 @@ import { required, regex } from "@/helpers/validation-rules"; import { Form, defineRule } from "vee-validate"; import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { getFunnelCookie } from "@/helpers/heritage-integration/cookie-helper"; +import vinPagesMixin from "@/mixins/vin-pages-mixin"; // DEFINE VALIDATION RULES defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); @@ -151,6 +152,7 @@ defineRule("vin-format", regex(/^[a-hA-Hj-nJ-NpPr-zR-Z0-9]{17}$/, errorMessages. export default { name: "vin-lookup", + mixins: [vinPagesMixin], async beforeRouteEnter(to, from, next) { // Call APIs const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); @@ -321,29 +323,7 @@ export default { this.$router.navigateAfterSave(this.navigationScenarios.CONTINUING_WITH_DIFFERENT_GLASS, this.$route, {}, { displayVehicleChangeAlert: true }, {}); return; } else { - // this.$refs.loadingModal.showModal(); - // navigateAfterSaveToHeritageFunnel(this.-$route); - const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS); - const partsOrQuestions = result.data.partsOrQuestions; - const hasPartsQuestions = partsOrQuestions.some(pq => pq.partQuestions?.length > 0); - const hasGlassLocationWithMultipleParts = partsOrQuestions.some(pq => pq.parts?.length > 1); - console.log(partsOrQuestions) - if (hasPartsQuestions) { - console.log("A") - // TODO Header not updating - this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, this.$route, {}, {}, result.data); - } - else if (hasGlassLocationWithMultipleParts) { - console.log("B") - // this.$router.navigateAfterSave(this.navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, this.$route, {}, {}, result.data); - } - else { - console.log("C") - store.commit(storeMutations.UPDATE_PARTS, partsOrQuestions); - this.$refs.loadingModal.showModal(); - navigateAfterSaveToHeritageFunnel(this.$route); - } - console.log(result) + this.navigateForwardWithSingleCarMatch(); return; } }, diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 16ad49c80..7e1074a16 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -72,7 +72,7 @@ const routingTable = [ maps: [ { scenario: navigationScenarios.CLICKED_BACK, - destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP, }, { scenario: navigationScenarios.SELECTED_PARTS, @@ -133,6 +133,14 @@ const routingTable = [ scenario: navigationScenarios.CLICKED_FORWARD, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + } ], }, { @@ -150,6 +158,14 @@ const routingTable = [ scenario: navigationScenarios.CONTINUING_WITH_DIFFERENT_GLASS, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + } ], }, { @@ -162,7 +178,15 @@ const routingTable = [ { scenario: navigationScenarios.CLICKED_FORWARD, destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, - }, + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_PART_QUESTIONS, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS + }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MULTIPLE_PARTS, + destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS + } ], }, { @@ -186,6 +210,15 @@ const routingTable = [ }, ], }, + { + fmgPageValue: fmgPageValues.PART_QUESTIONS, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VIN_LOOKUP + } + ] + }, ]; export { routingTable };