From 123666dd9e10507065d4f944df61cbb2d0bd17b6 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Mon, 20 Jun 2022 08:42:18 -0400 Subject: [PATCH 01/58] resetting state csr 439 --- src/constants/store-actions.js | 4 + src/layouts/vehicle-make/vehicle-make.vue | 7 +- src/layouts/vehicle-year/vehicle-year.vue | 7 +- src/store/index.js | 122 +++++++++++++++++++++- 4 files changed, 135 insertions(+), 5 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index 0ac79ac28..dcf8cc581 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -31,6 +31,10 @@ const storeActions = { RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies", RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies", RESET_STATE: "resetState", + + //RESET STATE + RESET_SAVE_VEHICLE_YEAR: "saveVehicleYear", + RESET_SAVE_VEHICLE_MAKE :"saveVehicleMake" }; export { storeActions }; diff --git a/src/layouts/vehicle-make/vehicle-make.vue b/src/layouts/vehicle-make/vehicle-make.vue index aecd90a6f..286560b98 100644 --- a/src/layouts/vehicle-make/vehicle-make.vue +++ b/src/layouts/vehicle-make/vehicle-make.vue @@ -82,7 +82,10 @@ export default { } return false; }, - resetDependentState() { + resetDependentState: function(){ + store.dispatch(storeActions.RESET_SAVE_VEHICLE_MAKE); + } + /* resetDependentState() { // Set store.commit(storeMutations.UPDATE_MODEL, null); store.commit(storeMutations.UPDATE_STYLE, null); @@ -96,7 +99,7 @@ export default { // Invokes store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - }, + }, */ }, watch: { diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 1041f82ae..18c1822d0 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -100,7 +100,10 @@ export default { arePagePrerequisitesValid() { return true; }, - resetDependentState() { + resetDependentState: function(){ + store.dispatch(storeActions.RESET_SAVE_VEHICLE_YEAR); + } + /* resetDependentState() { // Set store.commit(storeMutations.UPDATE_MAKE, null); store.commit(storeMutations.UPDATE_MODEL, null); @@ -115,7 +118,7 @@ export default { // Invokes store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - }, + }, */ }, components: { yearQuestion, diff --git a/src/store/index.js b/src/store/index.js index dda0fab35..a1a0b00da 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -69,6 +69,9 @@ const getDefaultState = () => { export const state = getDefaultState(); +const oldState = state; +const newState = state; + // Export Mutations export const mutations = { // VEHICLE MUTATIONS @@ -615,7 +618,41 @@ export const actions = { context.commit(storeMutations.UPDATE_STATE_WITH_ORDER_INFORMATION, response.data); return response; }); - } + }, + + saveVehicleYear(){ + //NEED TO COMPARE OLDVALUE TO NEW VALUE + console.log(state.order.vehicle.year); + if(state.order.vehicle.year!=null){ + storeMutations.updateMake = null; + storeMutations.updateModel = null; + storeMutations.updateStyle = null; + storeMutations.updateCarId = null; + storeMutations.updateVehicleCategory = null; + storeMutations.updateVehicleVin = null; + storeMutations.updateVehicleImageUrl = null; + storeMutations.updateVehicleImageVifNumber = null; + storeMutations.updateVehicleImageColor = null; + storeMutations.resetDamageAndDependencies; + storeMutations.resetRegistrationAndDependencies; + console.log("save vehicle year!"); + } + }, + saveVehicleMake(){ + if(state.order.vehicle.year!=null && state.order.vehicle.make!=null){ + storeMutations.updateModel = null; + storeMutations.updateStyle = null; + storeMutations.updateCarId = null; + storeMutations.updateVehicleCategory = null; + storeMutations.updateVehicleVin = null; + storeMutations.updateVehicleImageUrl = null; + storeMutations.updateVehicleImageVifNumber = null; + storeMutations.updateVehicleImageColor = null; + storeMutations.resetDamageAndDependencies; + storeMutations.resetRegistrationAndDependencies; + console.log("save vehicle make!"); + } + }, } export default createStore({ @@ -631,4 +668,87 @@ export default createStore({ actions, }); +/* export const mutationActions ={ + saveVehicleMake(){ + storeMutations.updateModel = null; + storeMutations.updateStyle = null; + storeMutations.updateCarId = null; + storeMutations.updateVehicleCategory = null; + storeMutations.updateVehicleVin = null; + storeMutations.updateVehicleImageUrl = null; + storeMutations.updateVehicleImageVifNumber = null; + storeMutations.updateVehicleImageColor = null; + storeMutations.resetDamageAndDependencies; + storeMutations.resetRegistrationAndDependencies; + }, + saveVehicleModel(){ + storeMutations.updateStyle = null; + storeMutations.updateCarId = null; + storeMutations.updateVehicleCategory = null; + storeMutations.updateVehicleVin = null; + storeMutations.updateVehicleImageUrl = null; + storeMutations.updateVehicleImageVifNumber = null; + storeMutations.updateVehicleImageColor = null; + storeMutations.resetDamageAndDependencies; + storeMutations.resetRegistrationAndDependencies; + }, + saveVehicleStyle(){ + storeMutations.updateCarId = null; + storeMutations.updateVehicleCategory = null; + storeMutations.updateVehicleVin = null; + storeMutations.updateVehicleImageUrl = null; + storeMutations.updateVehicleImageVifNumber = null; + storeMutations.updateVehicleImageColor = null; + storeMutations.resetDamageAndDependencies; + storeMutations.resetRegistrationAndDependencies; + }, + saveVehicleDamage(){ + storeMutations.resetPartsAndDependencies; + }, + saveVinLookup(carId){ + if(state.carId!=carId && state.payload.glass==false){ + storeMutations.resetDamageAndDependencies; + } + storeMutations.resetRegistrationAndDependencies; + }, + saveServiceLocation(){ + + }, + saveEmail(){ + + }, + saveRegistrationLicensePlateLookup(carId){ + if(state.carId!=carId && state.payload.glass==false){ + storeMutations.resetDamageAndDependencies; + } + storeMutations.registrationAddress = null; + storeMutations.registrationCity = null; + storeMutations.registration.firstName = null; + storeMutations.registration.lastName = null; + }, + saveVin(carId){ + if(state.carId!=carId && state.payload.glass==false){ + storeMutations.resetDamageAndDependencies; + } + }, + saveRegistrationAddressLookup(carId){ + if(state.carId!=carId && state.payload.glass==false){ + storeMutations.resetDamageAndDependencies; + } + storeMutations.registrationAddress = null; + storeMutations.registrationCity = null; + storeMutations.registration.firstName = null; + storeMutations.registration.lastName = null; + }, + savePartQuestionAnswers(){ + + }, + saveGlassParts(){ + + } +} */ + // Private Functions + +//Track state values +const oldValue = state; From b76811ded01e5f57588498503598a0370aa34f03 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Fri, 24 Jun 2022 13:44:03 -0400 Subject: [PATCH 02/58] pushing changes csr-439 --- src/constants/store-actions.js | 17 +- .../heritage-integration/navigation-helper.js | 1 - src/layouts/address-lookup/address-lookup.vue | 4 +- .../address-vehicles/address-vehicles.vue | 3 +- .../license-plate-lookup.vue | 2 +- src/layouts/vehicle-damage/vehicle-damage.vue | 4 +- src/layouts/vehicle-make/vehicle-make.vue | 22 +- src/layouts/vehicle-model/vehicle-model.vue | 18 +- src/layouts/vehicle-parts/vehicle-parts.vue | 2 +- src/layouts/vehicle-style/vehicle-style.vue | 13 +- src/layouts/vehicle-year/vehicle-year.vue | 23 +- src/layouts/vin-lookup/vin-lookup.vue | 2 +- src/router/index.js | 16 +- src/store/index.js | 234 +++++++++--------- 14 files changed, 154 insertions(+), 207 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index dcf8cc581..1866442f5 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -32,9 +32,20 @@ const storeActions = { RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies", RESET_STATE: "resetState", - //RESET STATE - RESET_SAVE_VEHICLE_YEAR: "saveVehicleYear", - RESET_SAVE_VEHICLE_MAKE :"saveVehicleMake" + //RESET COMPONENT STATE + SAVE_VEHICLE_YEAR: "saveVehicleYear", + SAVE_VEHICLE_MAKE:"saveVehicleMake", + SAVE_VEHICLE_MODEL:"saveVehicleModel", + SAVE_VEHICLE_STYLE: "saveVehicleStyle", + SAVE_VEHICLE_DAMAGE: "saveVehicleDamage", + SAVE_VIN_LOOKUP: "saveVinLookup", + SAVE_SERVICE_LOCATION: "saveServiceLocation", + SAVE_EMAIL: "saveEmail", + SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP: "saveRegistrationLicensePlateLookup", + SAVE_VIN: "saveVin", + SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup", + SAVE_PARTS_QUESTION_ANSWERS: "savePartQuestionAnswers", + SAVE_GLASS_PARTS: "saveGlassParts", }; export { storeActions }; diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js index 9bf69ddcf..22d984530 100644 --- a/src/helpers/heritage-integration/navigation-helper.js +++ b/src/helpers/heritage-integration/navigation-helper.js @@ -56,7 +56,6 @@ export async function navigateToHeritageFunnel() { export async function navigateAfterSaveToHeritageFunnel(currentRoute) { const currentComponent = currentRoute.matched[0].components; - currentComponent.default.methods.resetDependentState(); // Create the order (or save existing order) when navigating to Heritage Funnel. await saveOrder(); diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 2e13299de..cfd23f02e 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -288,7 +288,7 @@ export default { // if a different vehicle is found than the one entered and the selected glass // is not available for that vehicle if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - this.$router.navigateAfterSave( + this.$router.navigate( // then navigate back to "vehicle-damage", and display vehicle changed alert // on that page this.navigationScenarios.CONTINUING_WITH_DIFFERENT_GLASS, @@ -313,7 +313,7 @@ export default { navigateAfterSaveToHeritageFunnel(this.$route); } 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); + this.$router.navigate(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..4a7a59bcb 100644 --- a/src/layouts/address-vehicles/address-vehicles.vue +++ b/src/layouts/address-vehicles/address-vehicles.vue @@ -180,7 +180,7 @@ export default { }, navigateForward() { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - this.$router.navigateAfterSave( + this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, @@ -202,6 +202,7 @@ export default { resetDependentState() { // needed because navigateAfterSaveToHeritageFunnel calls it store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); }, + //this.$store.dispatch(storeActions.SAVE_VIN, vin,vehicle), updateCustomerInfo(vin, vehicle) { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index f3a5d3e83..931dff9c8 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -288,7 +288,7 @@ export default { }, navigateForward() { if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle) { - this.$router.navigateAfterSave( + this.$router.navigate( this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 266e2ba1a..056b2a5a9 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -301,11 +301,11 @@ export default { // If vin already exists, navigate directly to vin-lookup if(store.getters.vehicle.vin) { - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); + this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITH_VIN, this.$route); return; } else { - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route); + this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD_WITHOUT_VIN, this.$route); return; } }, diff --git a/src/layouts/vehicle-make/vehicle-make.vue b/src/layouts/vehicle-make/vehicle-make.vue index 286560b98..60e407a64 100644 --- a/src/layouts/vehicle-make/vehicle-make.vue +++ b/src/layouts/vehicle-make/vehicle-make.vue @@ -82,30 +82,12 @@ export default { } return false; }, - resetDependentState: function(){ - store.dispatch(storeActions.RESET_SAVE_VEHICLE_MAKE); - } - /* resetDependentState() { - // Set - 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_VIN, 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); - - // Invokes - store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - }, */ }, watch: { selectedMake(make) { - this.$store.commit(this.storeMutations.UPDATE_MAKE, make); - this.$router.navigateAfterSave( + this.$store.dispatch(storeActions.SAVE_VEHICLE_MAKE, make); + this.$router.navigate( this.navigationScenarios.SELECTED_MAKE, this.$route ); diff --git a/src/layouts/vehicle-model/vehicle-model.vue b/src/layouts/vehicle-model/vehicle-model.vue index c661c824e..27e378d91 100644 --- a/src/layouts/vehicle-model/vehicle-model.vue +++ b/src/layouts/vehicle-model/vehicle-model.vue @@ -83,26 +83,12 @@ export default { } return false; }, - resetDependentState() { - // Set - 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_VIN, 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); - - // Invokes - store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - }, }, watch: { selectedModel(model) { - this.$store.commit(this.storeMutations.UPDATE_MODEL, model); - this.$router.navigateAfterSave( + this.$store.dispatch(storeActions.SAVE_VEHICLE_MODEL, model); + this.$router.navigate( this.navigationScenarios.SELECTED_MODEL, this.$route ); diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 842cc0720..74b361a20 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -180,7 +180,7 @@ export default { store.commit(storeMutations.UPDATE_PARTS, matchedParts); // Navigate to the next page. - this.$router.navigateAfterSave( + this.$router.navigate( this.navigationScenarios.SELECTED_PARTS, this.$route ); diff --git a/src/layouts/vehicle-style/vehicle-style.vue b/src/layouts/vehicle-style/vehicle-style.vue index c7589d32d..463fc551b 100644 --- a/src/layouts/vehicle-style/vehicle-style.vue +++ b/src/layouts/vehicle-style/vehicle-style.vue @@ -94,22 +94,13 @@ export default { } return false; }, - resetDependentState() { - // Invokes - store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - store.commit(storeMutations.UPDATE_IS_REPAIR, null); - store.commit(storeMutations.UPDATE_NUMBER_OF_CHIPS, null); - store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, []); - store.commit(storeMutations.UPDATE_VEHICLE_VIN, null); - }, }, watch: { selectedStyle(style) { - this.$store.commit(this.storeMutations.UPDATE_STYLE, style); + this.$store.dispatch(storeActions.SAVE_VEHICLE_STYLE, style); this.setVehicle().then(() => { - this.$router.navigateAfterSave( + this.$router.navigate( this.navigationScenarios.SELECTED_STYLE, this.$route ); diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 18c1822d0..0738c09f7 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -89,8 +89,8 @@ export default { watch: { selectedYear(year) { const parsedYear = parseInt(year); - this.$store.commit(this.storeMutations.UPDATE_YEAR, parsedYear); - this.$router.navigateAfterSave( + this.$store.dispatch(storeActions.SAVE_VEHICLE_YEAR, parsedYear); + this.$router.navigate( this.navigationScenarios.SELECTED_YEAR, this.$route ); @@ -100,25 +100,6 @@ export default { arePagePrerequisitesValid() { return true; }, - resetDependentState: function(){ - store.dispatch(storeActions.RESET_SAVE_VEHICLE_YEAR); - } - /* resetDependentState() { - // Set - 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_VIN, 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); - - // Invokes - store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - }, */ }, components: { yearQuestion, diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 6c0f305b5..59e09ce9e 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -319,7 +319,7 @@ export default { }, navigateForward(){ if(this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle){ - this.$router.navigateAfterSave(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, {}); + this.$router.navigate(this.navigationScenarios.CLICKED_FORWARD, this.$route, {}, { displayVehicleChangeAlert: true }, {}); return; } else { this.$refs.loadingModal.showModal(); diff --git a/src/router/index.js b/src/router/index.js index 74ee110de..2fc79b938 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -139,12 +139,9 @@ router.afterEach(async (to, from) => { }); router.navigate = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => { - navigate(scenario, currentRoute, false, optionalQuery, optionalParams, optionalPageData); + navigate(scenario, currentRoute, optionalQuery, optionalParams, optionalPageData); } -router.navigateAfterSave = (scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) => { - navigate(scenario, currentRoute, true, optionalQuery, optionalParams, optionalPageData); -} router.navigateToExternalUrl = (url, optionalQuery = {}) => { navigateToUrl(url, optionalQuery); @@ -153,7 +150,7 @@ router.navigateToExternalUrl = (url, optionalQuery = {}) => { // PRIVATE FUNCTIONS // Navigate to the next route, depending on the scenario. -async function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) { +async function navigate(scenario, currentRoute, optionalQuery = {}, optionalParams = {}, optionalPageData = {}) { if (!scenario) { console.error("No scenario provided. Please review the routing table."); return; @@ -169,10 +166,6 @@ async function navigate(scenario, currentRoute, invalidateOnSave, optionalQuery // If we need to do invalidation const currentComponent = currentRoute.matched[0].components; - if (invalidateOnSave) { - resetDependentState(currentComponent); - } - // Append page data to the store for the NEXT page, if any. It will be an empty object if none is provided. baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData); @@ -270,9 +263,4 @@ function arePagePrerequisitesValid(component) { return component.default.methods.arePagePrerequisitesValid(); } -// Reset dependant state on route change. -function resetDependentState(component) { - return component.default.methods.resetDependentState(); -} - export default router; diff --git a/src/store/index.js b/src/store/index.js index a1a0b00da..acf245565 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -4,6 +4,7 @@ import { storeMutations } from "@/constants/store-mutations"; import { getDateForSavedSessionTimeout } from "@/helpers/heritage-integration/session-helper"; import createPersistedState from "vuex-persistedstate"; import globalMethods from "@/global-methods"; +import { storeActions } from "../constants/store-actions"; // Export State const getDefaultState = () => { @@ -620,39 +621,128 @@ export const actions = { }); }, - saveVehicleYear(){ - //NEED TO COMPARE OLDVALUE TO NEW VALUE - console.log(state.order.vehicle.year); - if(state.order.vehicle.year!=null){ - storeMutations.updateMake = null; - storeMutations.updateModel = null; - storeMutations.updateStyle = null; - storeMutations.updateCarId = null; - storeMutations.updateVehicleCategory = null; - storeMutations.updateVehicleVin = null; - storeMutations.updateVehicleImageUrl = null; - storeMutations.updateVehicleImageVifNumber = null; - storeMutations.updateVehicleImageColor = null; - storeMutations.resetDamageAndDependencies; - storeMutations.resetRegistrationAndDependencies; - console.log("save vehicle year!"); - } + saveVehicleYear(context, year){ + + //If different year, reset state dependencies + if(state.order.vehicle.year!==year){ + context.commit(storeMutations.UPDATE_YEAR, null); + context.commit(storeMutations.UPDATE_MAKE, null); + context.commit(storeMutations.UPDATE_MODEL, null); + context.commit(storeMutations.UPDATE_STYLE, null); + context.commit(storeMutations.UPDATE_CAR_ID, null); + context.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); + context.commit(storeMutations.UPDATE_VEHICLE_VIN, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, null); + + context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); + } + + //Update vehicle year + state.order.vehicle.year = year; }, - saveVehicleMake(){ - if(state.order.vehicle.year!=null && state.order.vehicle.make!=null){ - storeMutations.updateModel = null; - storeMutations.updateStyle = null; - storeMutations.updateCarId = null; - storeMutations.updateVehicleCategory = null; - storeMutations.updateVehicleVin = null; - storeMutations.updateVehicleImageUrl = null; - storeMutations.updateVehicleImageVifNumber = null; - storeMutations.updateVehicleImageColor = null; - storeMutations.resetDamageAndDependencies; - storeMutations.resetRegistrationAndDependencies; - console.log("save vehicle make!"); + saveVehicleMake(context, make){ + //If new make, reset state dependencies + if(state.order.vehicle.make !== make){ + context.commit(storeMutations.UPDATE_MODEL, null); + context.commit(storeMutations.UPDATE_STYLE, null); + context.commit(storeMutations.UPDATE_CAR_ID, null); + context.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); + context.commit(storeMutations.UPDATE_VEHICLE_VIN, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, null); + + // Invokes + context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); } + //Update vehicle make + state.order.vehicle.make = make; }, + saveVehicleModel(context, model){ + + //If new model, reset state dependencies + if (state.order.vehicle.make !== model) { + context.commit(storeMutations.UPDATE_STYLE, null); + context.commit(storeMutations.UPDATE_CAR_ID, null); + context.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); + context.commit(storeMutations.UPDATE_VEHICLE_VIN, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, null); + + context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); + } + //Update vehicle model + state.order.vehicle.model = model; + }, + saveVehicleStyle(context, style){ + //If new style, reset state dependencies + if(state.order.vehicle.style !== style){ + context.commit(storeMutations.UPDATE_CAR_ID, null); + context.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); + context.commit(storeMutations.UPDATE_VEHICLE_VIN, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_URL, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_VIF_NUMBER, null); + context.commit(storeMutations.UPDATE_VEHICLE_IMAGE_COLOR, null); + + context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); + } + //Update vehicle style + state.order.vehicle.style = style; +}, +saveVehicleDamage(context){ + context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); +}, +saveVinLookup(context){ + //if cardId is different AND selected glass part is not available reset damage and dependeices + if(context.isCarIdDifferent && !context.isSelectedGlassAvailableForVehicle){ + context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + } + context.dispatch(storeMutations.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); +}, +saveServiceLocation(context){ + // to be implemented +}, +saveEmail(context){ + // to be implemented +}, +saveRegistrationLicensePlateLookup(context){ + //if cardId is different AND selected glass part is not available reset damage and dependeices + if(context.isCarIdDifferent && !context.isSelectedGlassAvailableForVehicle){ + context.dispatch(storeMutations.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + } + context.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, null); + context.commit(storeMutations.UPDATE_REGISTRATION_CITY, null); + context.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, null); + context.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null); +}, +saveVin(context){ + //if cardId is different AND selected glass part is not available reset damage and dependeices + if(context.isCarIdDifferent && !context.isSelectedGlassAvailableForVehicle){ + context.dispatch(storeMutations.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + } +}, +saveRegistrationAddressLookup(context){ + if(context.isCarIdDifferent && !context.isSelectedGlassAvailableForVehicle){ + storeMutations.RESET_DAMAGE_STATE_AND_DEPENDENCIES; + } + context.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, null); + context.commit(storeMutations.UPDATE_REGISTRATION_CITY, null); + context.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, null); + context.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null); +}, +savePartQuestionAnswers(context){ + // to be implemented later +}, +saveGlassParts(context){ + // to be implemented later +} } export default createStore({ @@ -668,87 +758,5 @@ export default createStore({ actions, }); -/* export const mutationActions ={ - saveVehicleMake(){ - storeMutations.updateModel = null; - storeMutations.updateStyle = null; - storeMutations.updateCarId = null; - storeMutations.updateVehicleCategory = null; - storeMutations.updateVehicleVin = null; - storeMutations.updateVehicleImageUrl = null; - storeMutations.updateVehicleImageVifNumber = null; - storeMutations.updateVehicleImageColor = null; - storeMutations.resetDamageAndDependencies; - storeMutations.resetRegistrationAndDependencies; - }, - saveVehicleModel(){ - storeMutations.updateStyle = null; - storeMutations.updateCarId = null; - storeMutations.updateVehicleCategory = null; - storeMutations.updateVehicleVin = null; - storeMutations.updateVehicleImageUrl = null; - storeMutations.updateVehicleImageVifNumber = null; - storeMutations.updateVehicleImageColor = null; - storeMutations.resetDamageAndDependencies; - storeMutations.resetRegistrationAndDependencies; - }, - saveVehicleStyle(){ - storeMutations.updateCarId = null; - storeMutations.updateVehicleCategory = null; - storeMutations.updateVehicleVin = null; - storeMutations.updateVehicleImageUrl = null; - storeMutations.updateVehicleImageVifNumber = null; - storeMutations.updateVehicleImageColor = null; - storeMutations.resetDamageAndDependencies; - storeMutations.resetRegistrationAndDependencies; - }, - saveVehicleDamage(){ - storeMutations.resetPartsAndDependencies; - }, - saveVinLookup(carId){ - if(state.carId!=carId && state.payload.glass==false){ - storeMutations.resetDamageAndDependencies; - } - storeMutations.resetRegistrationAndDependencies; - }, - saveServiceLocation(){ - - }, - saveEmail(){ - - }, - saveRegistrationLicensePlateLookup(carId){ - if(state.carId!=carId && state.payload.glass==false){ - storeMutations.resetDamageAndDependencies; - } - storeMutations.registrationAddress = null; - storeMutations.registrationCity = null; - storeMutations.registration.firstName = null; - storeMutations.registration.lastName = null; - }, - saveVin(carId){ - if(state.carId!=carId && state.payload.glass==false){ - storeMutations.resetDamageAndDependencies; - } - }, - saveRegistrationAddressLookup(carId){ - if(state.carId!=carId && state.payload.glass==false){ - storeMutations.resetDamageAndDependencies; - } - storeMutations.registrationAddress = null; - storeMutations.registrationCity = null; - storeMutations.registration.firstName = null; - storeMutations.registration.lastName = null; - }, - savePartQuestionAnswers(){ - - }, - saveGlassParts(){ - - } -} */ - // Private Functions - -//Track state values -const oldValue = state; + From 5dd9c0fbb5b085378e3d908cadd84139b06f8659 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Fri, 24 Jun 2022 15:58:28 -0400 Subject: [PATCH 03/58] pushing changes csr -439 --- src/layouts/estimate/estimate.vue | 1 - src/layouts/vehicle-parts/vehicle-parts.vue | 4 ---- 2 files changed, 5 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index fe62d7647..569429dde 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -85,7 +85,6 @@ export default { } return false; }, - resetDependentState() {}, backButtonAction() { // route to move backwards this.$router.navigate( diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 74b361a20..6324b6ba4 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -186,10 +186,6 @@ export default { ); }, - resetDependentState() { - // Nothing additional to reset here: The page save is already fully resetting all the line-items on the order - }, - LoadInitialPartsData() { const partsData = this.PartsFromApi; const alreadyPopulatedPartsData = From 2fb78f4fc563af83436410e3441ca4a2bc84fd25 Mon Sep 17 00:00:00 2001 From: Donielle Austin Date: Fri, 24 Jun 2022 16:08:27 -0400 Subject: [PATCH 04/58] added missing comma --- src/layouts/vehicle-parts/vehicle-parts.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index f4c0f37b1..8228dc92d 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -225,8 +225,7 @@ methods: { this.glassParts[g.glassLocation + "-" + g.glassName] = { [g.glassLocation]: [partNumber], }; - } - }); + } }); }); }); From 9d7c6fc1fc92b157751ddcef02d16c212f0943da Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 27 Jun 2022 08:40:56 -0400 Subject: [PATCH 05/58] CSR-343 WIP --- .../button-question/button-question.vue | 76 +-- .../glass-part-question.vue | 439 +++++++++--------- src/layouts/vehicle-parts/vehicle-parts.vue | 71 +-- src/ux-components/radio/radio.vue | 2 +- 4 files changed, 313 insertions(+), 275 deletions(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index f1c2ad98a..6523bedb3 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -1,44 +1,48 @@ @@ -34,14 +34,13 @@ export default { questionText(){ return this.getCmsContent(this.cmsWidgetName, 'QuestionText'); }, - selectedValueAsArray: { + selectedValue: { get: function() { const modelValueAsArray = this.modelValue ? [this.modelValue] : []; return modelValueAsArray; }, set: function(newValue) { - const newValueAsScalar = newValue && newValue.length > 0 ? newValue[0] : null; - this.$emit("update:modelValue", newValueAsScalar); + this.$emit("update:modelValue", newValue); } } }, diff --git a/src/layouts/vehicle-year/year-question/year-question.vue b/src/layouts/vehicle-year/year-question/year-question.vue index a5b263fe8..ff2e2902a 100644 --- a/src/layouts/vehicle-year/year-question/year-question.vue +++ b/src/layouts/vehicle-year/year-question/year-question.vue @@ -7,7 +7,7 @@ :answers="years" groupName="ChooseVehicleYear" textPosition="text-start" - v-model="selectedValueAsArray" + v-model="selectedValue" isRequired=true /> @@ -35,14 +35,13 @@ export default { questionText(){ return this.getCmsContent(this.cmsWidgetName, 'QuestionText'); }, - selectedValueAsArray: { + selectedValue: { get: function() { const modelValueAsArray = this.modelValue ? [this.modelValue] : []; return modelValueAsArray; }, set: function(newValue) { - const newValueAsScalar = newValue && newValue.length > 0 ? newValue[0] : null; - this.$emit("update:modelValue", newValueAsScalar); + this.$emit("update:modelValue", newValue); } } }, diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index bcb414ca7..1ba6fb336 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -177,15 +177,10 @@ export default { previouslyEnteredCarId: '', invalidZip: '', vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0, - isInsuranceVerified: false, }; }, mounted() { this.attachCustomEvents(); - if (this.vinPopulatedOnPageLoad) { - this.setupVinMask(); - this.isInsuranceVerified = store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie().HasDelayedClaimRegistration; - } }, watch: { vin() { @@ -231,12 +226,20 @@ export default { return this.getCmsContent("PerfectMatchInsuranceVerifiedAlert", "BodyText").replaceAll("{custom:damage}", getIsWindshieldOnly()) }, + isInsuranceVerified() { + return store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie().HasDelayedClaimRegistration; + }, + vinMask() { + if (this.vinPopulatedOnPageLoad) { + const lastSixChars = this.vin.substring(11, this.vin.length); + return `!X!X!X!X!X!X!X!X!X!X!X${lastSixChars}`; + } + else { + return 'XXXXXXXXXXXXXXXXX'; + } + }, }, methods: { - setupVinMask() { - const lastSixChars = this.vin.substring(11, this.vin.length); - this.vinMask = `!X!X!X!X!X!X!X!X!X!X!X${lastSixChars}`; - }, arePagePrerequisitesValid() { return store.getters.vehicle.carId !== null; }, diff --git a/src/router/router-constants/fmgPage-values.js b/src/router/router-constants/fmgPage-values.js index 9abb45cd2..d067895ee 100644 --- a/src/router/router-constants/fmgPage-values.js +++ b/src/router/router-constants/fmgPage-values.js @@ -12,6 +12,7 @@ const fmgPageValues = { REVEAL: "reveal", ESTIMATE: "estimate", ADDRESS_VEHICLES: "address-vehicles", + QUOTE: "quote" }; export { fmgPageValues }; diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss index 95985f7c4..25a651d52 100644 --- a/src/styles/common-error-styles.scss +++ b/src/styles/common-error-styles.scss @@ -46,6 +46,7 @@ html { input[type=radio]+label:before, input[type=checkbox]+label:before { border: 1px solid $red; + background-color: initial; } input[type=checkbox]:checked + label:before { border: 1px solid $blue; diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index dfd322cb3..e60d0d22c 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -223,18 +223,26 @@ export default { span { font-size: .875rem; } - } + } +} + +.col { &:first-of-type { - label { - border-bottom-left-radius: 0.5rem; - border-top-left-radius: 0.5rem; - z-index: 2; + .list-button-horizontal { + label { + border-bottom-left-radius: 0.5rem; + border-top-left-radius: 0.5rem; + z-index: 2; + } } } + &:last-of-type { - label { - border-bottom-right-radius: 0.5rem; - border-top-right-radius: 0.5rem; + .list-button-horizontal { + label { + border-bottom-right-radius: 0.5rem; + border-top-right-radius: 0.5rem; + } } } } diff --git a/src/ux-components/list-card/list-card.spec.js b/src/ux-components/list-card/list-card.spec.js index 2fbdaade4..7db735ced 100644 --- a/src/ux-components/list-card/list-card.spec.js +++ b/src/ux-components/list-card/list-card.spec.js @@ -205,7 +205,7 @@ describe("list-card.vue", () => { }); wrapper.vm.handleCheckChange(); // Assert - expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: [Boolean, String], buttonId: 'list-card-id'}]); + expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: "List Card Checkbox", buttonId: 'list-card-id'}]); }); it("Should set checkValue data if selectedButtonIDs has value(s)", async () => { diff --git a/src/ux-components/list-card/list-card.vue b/src/ux-components/list-card/list-card.vue index 88aad0b6a..84762fc91 100644 --- a/src/ux-components/list-card/list-card.vue +++ b/src/ux-components/list-card/list-card.vue @@ -1,8 +1,9 @@ diff --git a/src/layouts/vehicle-year/year-question/year-question.vue b/src/layouts/vehicle-year/year-question/year-question.vue index 5892c5dd9..8889a0fdc 100644 --- a/src/layouts/vehicle-year/year-question/year-question.vue +++ b/src/layouts/vehicle-year/year-question/year-question.vue @@ -8,7 +8,7 @@ groupName="ChooseVehicleYear" textPosition="text-start" v-model="selectedValue" - isRequired=true + isRequired /> From 37123df3f68d7dff90f0ba258033821e2a6389ea Mon Sep 17 00:00:00 2001 From: Katie Date: Wed, 13 Jul 2022 09:20:32 -0400 Subject: [PATCH 58/58] CSR-612 Cleanup --- src/common-components/question-chain/question-chain.vue | 2 +- .../address-vehicles-question/address-vehicles-question.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common-components/question-chain/question-chain.vue b/src/common-components/question-chain/question-chain.vue index c6a4f098d..6993bf170 100644 --- a/src/common-components/question-chain/question-chain.vue +++ b/src/common-components/question-chain/question-chain.vue @@ -9,7 +9,7 @@ :answers="q.answers" :groupName="`${questionData.glassName}-${questionData.glassLocation}-${i}`" v-model="selectedValuesArray" - :isRequired="true" + isRequired :validationRules="validationRules" :clearOnUnmount=false /> diff --git a/src/layouts/address-vehicles/address-vehicles-question/address-vehicles-question.vue b/src/layouts/address-vehicles/address-vehicles-question/address-vehicles-question.vue index 5b021f286..6f6df03ff 100644 --- a/src/layouts/address-vehicles/address-vehicles-question/address-vehicles-question.vue +++ b/src/layouts/address-vehicles/address-vehicles-question/address-vehicles-question.vue @@ -6,7 +6,7 @@ :questionText="questionText" :answers="vehicles" v-model="selectedVehicleVinAsArray" - :isRequired="true" + isRequired :validation-rules="validationRules" />