diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index ddbecc5c8..849e5772f 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -251,13 +251,8 @@ export default { // Save vehicle, customer, service and registration information await this.dispatchStoreAction(storeActions.SAVE_REGISTRATION_ADDRESS_LOOKUP, { - isCarIdDifferent: this.isCarIdDifferent, isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, - vehicleInfo: vehicleInfoToCommit, - serviceLocationInfo: { - zipCode: this.serviceZipCode, - state: resultMap.serviceZipValidationResponse.state, - }, + vehicleInfo: Object.keys(vehicleInfoToCommit).length === 0 ? this.$store.getters.vehicle : vehicleInfoToCommit, registrationInfo: { firstName: this.customerQuestions.firstName, lastName: this.customerQuestions.lastName, @@ -265,8 +260,13 @@ export default { city: this.customerQuestions.addressQuestions.city, state: resultMap.serviceZipValidationResponse.state, zipCode: this.customerQuestions.addressQuestions.zipCode - }, - customerEmail: this.customerQuestions.emailAddress, + } + }, false); + + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.customerQuestions.emailAddress, false); + await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, { + zipCode: this.serviceZipCode, + state: resultMap.serviceZipValidationResponse.state, }, false); return await this.navigateForward(carsFound); @@ -277,7 +277,7 @@ export default { // If a different vehicle is found than the one entered and the selected glass is not available for that vehicle then navigate back to "vehicle-damage" // display vehicle changed alert on that page. - console.log(this.isCarIdDifferent,!this.isSelectedGlassAvailableForVehicle,matchingCars.length === 1) + if (this.isCarIdDifferent && !this.isSelectedGlassAvailableForVehicle && matchingCars.length === 1) { this.$router.navigate(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, {[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true}); } else if (matchingCars.length === 1) { diff --git a/src/layouts/address-vehicles/address-vehicles.vue b/src/layouts/address-vehicles/address-vehicles.vue index c55b0ab08..7936ef83e 100644 --- a/src/layouts/address-vehicles/address-vehicles.vue +++ b/src/layouts/address-vehicles/address-vehicles.vue @@ -177,7 +177,6 @@ export default { await this.dispatchStoreAction(storeActions.SAVE_VIN, { vehicleInfo: Object.assign(this.selectedVehicle.vehicle, { vin: this.selectedVehicle.vin }), - isCarIdDifferent: this.isCarIdDifferent, isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle }, false); diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index 17868be0e..3e9240719 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -264,7 +264,7 @@ export default { // Check if the CarId has changed. this.isCarIdDifferent = vinLookup.data.vehicle.carId !== this.$store.getters.vehicle.carId; - console.log("here"); + //Handle changing car if (this.isCarIdDifferent && vinLookup.data.vehicle.carId !== this.previouslyEnteredCarId) { this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vinLookup.data.vehicle.carId); @@ -279,21 +279,21 @@ export default { // Save vin, vehicle, customer, service and registration information await this.dispatchStoreAction(storeActions.SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP, { - isCarIdDifferent: this.isCarIdDifferent, isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, vehicleInfo: Object.assign(vinLookup.data.vehicle, { vin: vinLookup.data.vin }), - serviceLocationInfo: { - zipCode: this.serviceZip, - state: resultMap.serviceZipValidationResponse.state, - }, registrationInfo: { licensePlate: this.licensePlate, state: resultMap.registrationZipValidationResponse.state, zipCode: this.registrationZip, - }, - customerEmail: this.email, + } }, false); + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.email, false); + await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, { + zipCode: this.serviceZip, + state: resultMap.serviceZipValidationResponse.state, + }, false); + return await this.navigateForward(); }, async navigateForward() { diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index 778dcdef3..db5211a7b 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -133,7 +133,7 @@ describe("vehicle-damage.vue", () => { wrapper.vm.selectedWindshieldOptions = { selectedWindshieldChipCount: null, selectedWindshieldReplaceOptions: ["Single"], - selectedWindshieldDamageType: ["Replace"] + selectedWindshieldDamageType: "Replace" }; wrapper.vm.sideDoorOptionsData = { @@ -232,7 +232,7 @@ describe("vehicle-damage.vue", () => { wrapper.vm.selectedWindshieldOptions = { selectedWindshieldChipCount: null, selectedWindshieldReplaceOptions: ["Single"], - selectedWindshieldDamageType: ["Replace"] + selectedWindshieldDamageType: "Replace" }; const expectedGlassToReplace = [{ glassLocation: "Windshield", glassName: "Single" },]; @@ -375,7 +375,7 @@ describe("vehicle-damage.vue", () => { ); wrapper.vm.selectedDamageLocations = ["Windshield"]; - wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: ["Repair"] }; + wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: "Repair" }; //Assert expect(wrapper.vm.isWindshieldRepair).toEqual(true); @@ -395,7 +395,7 @@ describe("vehicle-damage.vue", () => { ); wrapper.vm.selectedDamageLocations = ["SideDoor"]; - wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: ["Repair"] }; + wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: "Repair" }; //Assert expect(wrapper.vm.isWindshieldRepair).toEqual(false); @@ -518,19 +518,19 @@ describe("vehicle-damage.vue", () => { }); const storeWindshieldOptions = [[1, false, "Windshield", "Single", { - selectedWindshieldDamageType: [damageLocationsSelected.REPLACE], + selectedWindshieldDamageType: damageLocationsSelected.REPLACE, selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.SINGLE] }], [2, false, "Windshield", "Driver", { - selectedWindshieldDamageType: [damageLocationsSelected.REPLACE], + selectedWindshieldDamageType: damageLocationsSelected.REPLACE, selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.DRIVER] }], [3, false, "Windshield", "Passenger", { - selectedWindshieldDamageType: [damageLocationsSelected.REPLACE], + selectedWindshieldDamageType: damageLocationsSelected.REPLACE, selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.PASSENGER] }], [4, true, "", "", { - selectedWindshieldDamageType: [damageLocationsSelected.REPAIR], + selectedWindshieldDamageType: damageLocationsSelected.REPAIR, selectedWindshieldChipCount: [2], selectedWindshieldReplaceOptions: [] }] ]; diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index d36247640..b144ef2b3 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -197,32 +197,32 @@ export default { }, getWindshieldOptionsFromStore() { - var windShieldOptions = { selectedWindshieldDamageType: [], selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: []}; + var windShieldOptions = { selectedWindshieldDamageType: "", selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: []}; if (store.getters.damage.isRepair === undefined) return windshieldOptions; if (!store.getters.damage.isRepair) { if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && glass.glassName === damageLocationsSelected.SINGLE })) { - windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE); + windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE; windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE); } if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && glass.glassName === damageLocationsSelected.DRIVER })) { - windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE); + windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE; windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER); } if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && glass.glassName === damageLocationsSelected.PASSENGER })) { - windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE); + windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE; windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER); } } if (store.getters.damage.isRepair) { - windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPAIR); + windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPAIR; windShieldOptions.selectedWindshieldChipCount.push(store.getters.damage.numberOfChips); } @@ -350,12 +350,7 @@ export default { }); }, isWindshieldRepair() { - if (!this.isWindshieldDamageLocation) return false; - - return this.selectedWindshieldOptions.selectedWindshieldDamageType && this.selectedWindshieldOptions.selectedWindshieldDamageType.some(selectedDamageType => - { - return selectedDamageType.toUpperCase() === "REPAIR"; - }); + return this.isWindshieldDamageLocation && this.selectedWindshieldOptions.selectedWindshieldDamageType === damageLocationsSelected.REPAIR; }, isDriverSideReplace() { if (!this.isSideDoorDamageLocation) return false; @@ -377,7 +372,7 @@ export default { return this.isWindshieldDamageLocation && this.selectedDamageLocations.length > 1 && this.isWindshieldRepair; }, hasSplitSingleConflict() { - if (!this.selectedDamageLocations || !this.selectedDamageLocations.includes("Windshield") || !this.selectedWindshieldOptions.selectedWindshieldDamageType || !this.selectedWindshieldOptions.selectedWindshieldDamageType.includes("Replace") || !this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false; + if (!this.selectedDamageLocations?.includes("Windshield") || this.selectedWindshieldOptions.selectedWindshieldDamageType === damageLocationsSelected.REPAIR || !this.selectedWindshieldOptions.selectedWindshieldReplaceOptions) return false; return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield => { @@ -397,7 +392,7 @@ export default { return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]; }, shouldHideBackButton() { - return this.$store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie().HasDelayedClaimRegistration; + return this.$store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie()?.HasDelayedClaimRegistration; } }, diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question.vue b/src/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question.vue index 455c27361..ce162617d 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-damage-type-question/windshield-damage-type-question.vue @@ -22,7 +22,7 @@ import store from "@/store"; export default ({ name: "windshieldDamageTypeQuestion", props: { - modelValue: Array, + modelValue: String, groupName: String, isAvailable: Boolean, suppressError: Boolean, diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue index bdbe25195..02670108c 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-options.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-options.vue @@ -4,7 +4,7 @@ :isAvailable=isWindshieldDamageLocation :suppressError="hasRepairReplaceConflict || showNoReplacementAvailableError" groupName="WindshieldDamageTypeQuestion" - v-model="selectedWindshieldDamageTypeValues" + v-model="selectedWindshieldDamageTypeValue" :validationRules="windshieldDamageTypeQuestionValidationRules" /> { - if (value.toString().toUpperCase().includes(damageLocationsSelected.REPAIR.toUpperCase()) && - otherFieldValue.toString().toUpperCase().includes(damageLocationsSelected.WINDSHIELD.toUpperCase()) && - Array.isArray(otherFieldValue) && - otherFieldValue.length > 1) - { - return false; - } - return true; +defineRule("check-for-repair-and-replace", (selectedWindshieldDamageType, [selectedDamageLocations]) => { + return selectedWindshieldDamageType.toString() != damageLocationsSelected.REPAIR || + !selectedDamageLocations.includes(damageLocationsSelected.WINDSHIELD) || + selectedDamageLocations.length === 1; }); defineRule("repair-only", (value) => { - if (value.toString().toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase()) { - return true; - } - return false; + return value.toString() === damageLocationsSelected.REPAIR; }); defineRule("prevent-split-and-single-together", (value) => { if (value.toString().toUpperCase().includes(damageLocationsSelected.SINGLE.toUpperCase()) && @@ -91,7 +83,7 @@ export default ({ }, props: { - modelValue: Array, + modelValue: String, selectedDamageLocations: Array, hasRepairReplaceConflict: Boolean, hasSplitSingleConflict: Boolean, @@ -120,7 +112,7 @@ export default ({ this.$emit("update:modelValue", newValue); } }, - selectedWindshieldDamageTypeValues:{ + selectedWindshieldDamageTypeValue: { get: function() { return this.selectedValues.selectedWindshieldDamageType; }, @@ -133,7 +125,7 @@ export default ({ return this.selectedValues.selectedWindshieldChipCount; }, set: function(newValue) { - this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValues, newValue, null); + this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValue, newValue, null); } }, selectedWindshieldReplaceOptionsValues: { @@ -141,7 +133,7 @@ export default ({ return this.selectedValues.selectedWindshieldReplaceOptions; }, set: function(newValue) { - this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValues, null, newValue); + this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValue, null, newValue); } }, isWindshieldDamageLocation() { @@ -151,14 +143,10 @@ export default ({ }); }, isRepairOptionSelected(){ - if (!this.selectedWindshieldDamageTypeValues) return false; - - return this.selectedWindshieldDamageTypeValues.some(val => val.toUpperCase() === "REPAIR") && this.isWindshieldDamageLocation; + return this.selectedWindshieldDamageTypeValue === damageLocationsSelected.REPAIR && this.isWindshieldDamageLocation; }, isReplaceOptionSelected(){ - if (!this.selectedWindshieldDamageTypeValues) return false; - - return this.selectedWindshieldDamageTypeValues.some(val => val.toUpperCase() === "REPLACE") && this.isWindshieldDamageLocation; + return this.selectedWindshieldDamageTypeValue === damageLocationsSelected.REPLACE && this.isWindshieldDamageLocation; }, isWindshieldReplaceAvailable() { return !(Array.isArray(this.windshieldAvailableReplacementOptions) && this.windshieldAvailableReplacementOptions.length < 1); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 1ba6fb336..d5943ecdb 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -330,15 +330,15 @@ export default { // Save vin, vehicle, customer and service information await this.dispatchStoreAction(storeActions.SAVE_VIN_LOOKUP, { - isCarIdDifferent: this.isCarIdDifferent, isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, - vehicleInfo: Object.assign(resultMap.vehicleLookupResponse, { vin: this.vin }), - serviceLocationInfo: { + vehicleInfo: Object.assign(resultMap.vehicleLookupResponse, { vin: this.vin }) + }, false); + + await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.email, false); + await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, { zipCode: this.zip, state: resultMap.validateZipResponse.state, - }, - customerEmail: this.email, - }, false); + }, false); return await this.navigateForward(); } diff --git a/src/store/index.js b/src/store/index.js index c03421fa8..7785a47fc 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -661,10 +661,10 @@ export const actions = { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - } - //Save new values - context.commit(storeMutations.UPDATE_YEAR, year); + //Save new values + context.commit(storeMutations.UPDATE_YEAR, year); + } }, saveVehicleMake(context, make) { @@ -681,10 +681,10 @@ export const actions = { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - } - //Save new values - context.commit(storeMutations.UPDATE_MAKE, make); + //Save new values + context.commit(storeMutations.UPDATE_MAKE, make); + } }, saveVehicleModel(context, model) { @@ -700,10 +700,10 @@ export const actions = { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - } - //Save new values - context.commit(storeMutations.UPDATE_MODEL, model); + //Save new values + context.commit(storeMutations.UPDATE_MODEL, model); + } }, saveVehicleStyle(context, style) { @@ -718,10 +718,10 @@ export const actions = { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - } - //Save new values - context.commit(storeMutations.UPDATE_STYLE, style); + //Save new values + context.commit(storeMutations.UPDATE_STYLE, style); + } }, saveVehicleDamage(context, { isWindshieldRepair, selectedGlassToReplace, selectedWindshieldChipCount }) { @@ -744,58 +744,49 @@ export const actions = { }, // Vin lookup - saveVinLookup(context, { isCarIdDifferent, isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo, serviceLocationInfo, customerEmail }) { + saveVinLookup(context, { isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) { //Reset dependent state when changing if (vehicleInfo.vin !== context.state.order.vehicle.vin) { context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { + if (!isSelectedGlassAvailableForVehicle) { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } + + //Save new values + context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); + context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo); } - - //Save new values - context.dispatch(storeActions.SAVE_EMAIL, customerEmail); - context.dispatch(storeActions.SAVE_SERVICE_LOCATION, serviceLocationInfo); - - context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); - context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo); }, - saveRegistrationLicensePlateLookup(context, { isCarIdDifferent, isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo, serviceLocationInfo, customerEmail }) { + saveRegistrationLicensePlateLookup(context, { isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) { //Reset dependent state when changing if (registrationInfo?.licensePlate !== context.state.order.vehicle.registration?.licensePlate) { context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { + if (!isSelectedGlassAvailableForVehicle) { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } + + //Save new values + context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); + context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo); } - - //Save new values - context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); - context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo); - - context.dispatch(storeActions.SAVE_EMAIL, customerEmail); - context.dispatch(storeActions.SAVE_SERVICE_LOCATION, serviceLocationInfo); }, - saveRegistrationAddressLookup(context, { isCarIdDifferent, isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo, serviceLocationInfo, customerEmail }) { + saveRegistrationAddressLookup(context, { isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) { //Reset dependent state when changing if (registrationInfo?.address !== context.state.order.vehicle.registration?.address || registrationInfo?.city !== context.state.order.vehicle.registration?.city || registrationInfo?.state !== context.state.order.vehicle.registration?.state || registrationInfo?.zipCode !== context.state.order.vehicle.registration?.zipCode || registrationInfo?.firstName !== context.state.order.vehicle.registration?.firstName || registrationInfo?.lastName !== context.state.order.vehicle.registration?.lastName) { context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); - if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { + if (!isSelectedGlassAvailableForVehicle) { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } + + //Save new values + context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); + context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo); } - - //Save new values - context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); - context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo); - - context.dispatch(storeActions.SAVE_EMAIL, customerEmail); - context.dispatch(storeActions.SAVE_SERVICE_LOCATION, serviceLocationInfo); }, // Misc order actions @@ -805,14 +796,15 @@ export const actions = { saveEmail(context, email) { context.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, email); }, - saveVin(context, { isCarIdDifferent, isSelectedGlassAvailableForVehicle, vehicleInfo }) { + saveVin(context, { isSelectedGlassAvailableForVehicle, vehicleInfo }) { //Reset dependent state when changing if (vehicleInfo.vin !== context.state.order.vehicle.vin) { - if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { + if (!isSelectedGlassAvailableForVehicle) { context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); } + //Save new values context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); } }, diff --git a/src/store/store.spec.js b/src/store/store.spec.js index b4a644c3c..960a6d784 100644 --- a/src/store/store.spec.js +++ b/src/store/store.spec.js @@ -784,8 +784,7 @@ describe("Actions", () => { // Assert expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); expect(dispatch).toHaveBeenNthCalledWith(2, storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - expect(dispatch).toHaveBeenNthCalledWith(3, storeActions.SAVE_EMAIL, payload.customerEmail); - expect(dispatch).toHaveBeenNthCalledWith(4, storeActions.SAVE_SERVICE_LOCATION, payload.serviceLocationInfo); + expect(commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE, payload.vehicleInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo); }); @@ -818,8 +817,6 @@ describe("Actions", () => { // Assert expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); expect(dispatch).toHaveBeenNthCalledWith(2, storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - expect(dispatch).toHaveBeenNthCalledWith(3, storeActions.SAVE_EMAIL, payload.customerEmail); - expect(dispatch).toHaveBeenNthCalledWith(4, storeActions.SAVE_SERVICE_LOCATION, payload.serviceLocationInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE, payload.vehicleInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo); @@ -853,8 +850,6 @@ describe("Actions", () => { // Assert expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); expect(dispatch).toHaveBeenNthCalledWith(2, storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); - expect(dispatch).toHaveBeenNthCalledWith(3, storeActions.SAVE_EMAIL, payload.customerEmail); - expect(dispatch).toHaveBeenNthCalledWith(4, storeActions.SAVE_SERVICE_LOCATION, payload.serviceLocationInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE, payload.vehicleInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo); 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 e60d0d22c..49978aa1e 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -119,14 +119,13 @@ export default { if(!this.selectingInitiatesLoad) { this.handleCheckChange(); } - this.handleChange(this.value); }, triggerButton() { if(this.selectingInitiatesLoad) { this.displayLoader(); this.handleCheckChange(); } - this.handleChange(this.value); + this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true); }, handleCheckChange() { @@ -135,6 +134,8 @@ export default { value: this.value.toString(), buttonId: this.buttonID && this.buttonID.toString(), }; + + this.handleChange(this.value); this.$emit("isCheckedChanged", emitEvent); this.$emit("update:modelValue", emitEvent); } diff --git a/src/ux-components/list-card/list-card.vue b/src/ux-components/list-card/list-card.vue index 84762fc91..de5a1a72f 100644 --- a/src/ux-components/list-card/list-card.vue +++ b/src/ux-components/list-card/list-card.vue @@ -63,6 +63,7 @@