From 962dadf78f76ee079a274d066d21ece164833b5d Mon Sep 17 00:00:00 2001 From: "US\\katie.kroell" Date: Thu, 26 Jan 2023 16:55:39 -0500 Subject: [PATCH] EOD commit - address-vehicles --- .../address-vehicles/address-vehicles.vue | 52 ++++++------------- src/router/router-constants/routing-table.js | 24 +++++++++ src/store/index.js | 13 +++++ 3 files changed, 52 insertions(+), 37 deletions(-) diff --git a/src/layouts/address-vehicles/address-vehicles.vue b/src/layouts/address-vehicles/address-vehicles.vue index 99cf1e58..9d61a08e 100644 --- a/src/layouts/address-vehicles/address-vehicles.vue +++ b/src/layouts/address-vehicles/address-vehicles.vue @@ -21,15 +21,6 @@ manualCopy="" v-bind:isDismissible="false" /> - {{ getRouterLinkDisplayTextFromCopy(copy) }} { this.$refs.siteFooter.removeLoader(); }); @@ -214,9 +191,7 @@ export default { this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId( vinLookup.data.carId ); - await this.dispatchStoreAction( - storeActions.SAVE_VIN, - { + await useMainStore().saveVin({ vehicleInfo: Object.assign(this.selectedVehicle.vehicle, { vin: this.selectedVehicle.vin, }), @@ -225,12 +200,15 @@ export default { }, false ); - return await this.navigateForward(); + + return await this.navigateForwardWithSingleCarMatch(); }, async navigateForward() { + // If the vehicle selected on this page is different from the one originally entered and the selected glass is not available + // for that vehicle, then navigate back to "vehicle-damage" and display vehicle changed alert on that page. if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - this.$router.navigateWithSaving( - this.navigationScenarios.CLICKED_FORWARD, + this.$router.navigate( + this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, this.$route, {}, { [routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true } diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 566457d1..342ef39a 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -328,6 +328,30 @@ const routingTable = function(store) { scenario: navigationScenarios.CLICKED_BACK, destinationIssPageValue: issPageValues.ADDRESS_LOOKUP, }, + { + scenario: navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, + destinationIssPageValue: issPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS, + destinationIssPageValue: issPageValues.PART_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE, + destinationIssPageValue: issPageValues.VEHICLE_PARTS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS, + destinationIssPageValue: issPageValues.MOLDING_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS, + destinationIssPageValue: issPageValues.CAPABILITY_QUESTIONS, + }, + { + scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, + destinationIssPageValue: issPageValues.COVERAGE_STATEMENT, + }, ], }, { diff --git a/src/store/index.js b/src/store/index.js index 56b11746..9961442c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -896,7 +896,20 @@ export const useMainStore = defineStore({ this.updateRegistration(registrationInfo); } }, + saveVin({ isSelectedGlassAvailableForVehicle, vehicleInfo }) { + //Reset dependent state when changing + if (vehicleInfo.vin !== this.order.vehicle.vin) { + this.resetRegistrationAndDependencies(); + if (!isSelectedGlassAvailableForVehicle) { + this.resetDamageAndDependencies(); + this.resetPartsAndDependencies(); + + //Save new values + this.updateVehicle(vehicleInfo); + } + } + }, saveRegistrationLicensePlateLookup({ isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) { //Reset dependent state when changing if