Merge branch 'develop' into feature/CSR-108

This commit is contained in:
Adam Caouette 2022-07-07 09:33:28 -04:00
commit 93fac7462d
13 changed files with 97 additions and 126 deletions

View file

@ -251,13 +251,8 @@ export default {
// Save vehicle, customer, service and registration information // Save vehicle, customer, service and registration information
await this.dispatchStoreAction(storeActions.SAVE_REGISTRATION_ADDRESS_LOOKUP, { await this.dispatchStoreAction(storeActions.SAVE_REGISTRATION_ADDRESS_LOOKUP, {
isCarIdDifferent: this.isCarIdDifferent,
isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle,
vehicleInfo: vehicleInfoToCommit, vehicleInfo: Object.keys(vehicleInfoToCommit).length === 0 ? this.$store.getters.vehicle : vehicleInfoToCommit,
serviceLocationInfo: {
zipCode: this.serviceZipCode,
state: resultMap.serviceZipValidationResponse.state,
},
registrationInfo: { registrationInfo: {
firstName: this.customerQuestions.firstName, firstName: this.customerQuestions.firstName,
lastName: this.customerQuestions.lastName, lastName: this.customerQuestions.lastName,
@ -265,8 +260,13 @@ export default {
city: this.customerQuestions.addressQuestions.city, city: this.customerQuestions.addressQuestions.city,
state: resultMap.serviceZipValidationResponse.state, state: resultMap.serviceZipValidationResponse.state,
zipCode: this.customerQuestions.addressQuestions.zipCode 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); }, false);
return await this.navigateForward(carsFound); 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" // 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. // display vehicle changed alert on that page.
console.log(this.isCarIdDifferent,!this.isSelectedGlassAvailableForVehicle,matchingCars.length === 1)
if (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}); this.$router.navigate(this.navigationScenarios.SELECTED_VIN_HAS_MISMATCHED_GLASS, this.$route, {}, {[routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]: true});
} else if (matchingCars.length === 1) { } else if (matchingCars.length === 1) {

View file

@ -177,7 +177,6 @@ export default {
await this.dispatchStoreAction(storeActions.SAVE_VIN, { await this.dispatchStoreAction(storeActions.SAVE_VIN, {
vehicleInfo: Object.assign(this.selectedVehicle.vehicle, { vin: this.selectedVehicle.vin }), vehicleInfo: Object.assign(this.selectedVehicle.vehicle, { vin: this.selectedVehicle.vin }),
isCarIdDifferent: this.isCarIdDifferent,
isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle
}, false); }, false);

View file

@ -264,7 +264,7 @@ export default {
// Check if the CarId has changed. // Check if the CarId has changed.
this.isCarIdDifferent = vinLookup.data.vehicle.carId !== this.$store.getters.vehicle.carId; this.isCarIdDifferent = vinLookup.data.vehicle.carId !== this.$store.getters.vehicle.carId;
console.log("here");
//Handle changing car //Handle changing car
if (this.isCarIdDifferent && vinLookup.data.vehicle.carId !== this.previouslyEnteredCarId) { if (this.isCarIdDifferent && vinLookup.data.vehicle.carId !== this.previouslyEnteredCarId) {
this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vinLookup.data.vehicle.carId); this.isSelectedGlassAvailableForVehicle = await isGlassAvailableForCarId(vinLookup.data.vehicle.carId);
@ -279,21 +279,21 @@ export default {
// Save vin, vehicle, customer, service and registration information // Save vin, vehicle, customer, service and registration information
await this.dispatchStoreAction(storeActions.SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP, { await this.dispatchStoreAction(storeActions.SAVE_REGISTRATION_LICENSE_PLATE_LOOKUP, {
isCarIdDifferent: this.isCarIdDifferent,
isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle,
vehicleInfo: Object.assign(vinLookup.data.vehicle, { vin: vinLookup.data.vin }), vehicleInfo: Object.assign(vinLookup.data.vehicle, { vin: vinLookup.data.vin }),
serviceLocationInfo: {
zipCode: this.serviceZip,
state: resultMap.serviceZipValidationResponse.state,
},
registrationInfo: { registrationInfo: {
licensePlate: this.licensePlate, licensePlate: this.licensePlate,
state: resultMap.registrationZipValidationResponse.state, state: resultMap.registrationZipValidationResponse.state,
zipCode: this.registrationZip, zipCode: this.registrationZip,
}, }
customerEmail: this.email,
}, false); }, 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(); return await this.navigateForward();
}, },
async navigateForward() { async navigateForward() {

View file

@ -133,7 +133,7 @@ describe("vehicle-damage.vue", () => {
wrapper.vm.selectedWindshieldOptions = { wrapper.vm.selectedWindshieldOptions = {
selectedWindshieldChipCount: null, selectedWindshieldChipCount: null,
selectedWindshieldReplaceOptions: ["Single"], selectedWindshieldReplaceOptions: ["Single"],
selectedWindshieldDamageType: ["Replace"] selectedWindshieldDamageType: "Replace"
}; };
wrapper.vm.sideDoorOptionsData = { wrapper.vm.sideDoorOptionsData = {
@ -232,7 +232,7 @@ describe("vehicle-damage.vue", () => {
wrapper.vm.selectedWindshieldOptions = { wrapper.vm.selectedWindshieldOptions = {
selectedWindshieldChipCount: null, selectedWindshieldChipCount: null,
selectedWindshieldReplaceOptions: ["Single"], selectedWindshieldReplaceOptions: ["Single"],
selectedWindshieldDamageType: ["Replace"] selectedWindshieldDamageType: "Replace"
}; };
const expectedGlassToReplace = [{ glassLocation: "Windshield", glassName: "Single" },]; const expectedGlassToReplace = [{ glassLocation: "Windshield", glassName: "Single" },];
@ -375,7 +375,7 @@ describe("vehicle-damage.vue", () => {
); );
wrapper.vm.selectedDamageLocations = ["Windshield"]; wrapper.vm.selectedDamageLocations = ["Windshield"];
wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: ["Repair"] }; wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: "Repair" };
//Assert //Assert
expect(wrapper.vm.isWindshieldRepair).toEqual(true); expect(wrapper.vm.isWindshieldRepair).toEqual(true);
@ -395,7 +395,7 @@ describe("vehicle-damage.vue", () => {
); );
wrapper.vm.selectedDamageLocations = ["SideDoor"]; wrapper.vm.selectedDamageLocations = ["SideDoor"];
wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: ["Repair"] }; wrapper.vm.selectedWindshieldOptions = { selectedWindshieldDamageType: "Repair" };
//Assert //Assert
expect(wrapper.vm.isWindshieldRepair).toEqual(false); expect(wrapper.vm.isWindshieldRepair).toEqual(false);
@ -518,19 +518,19 @@ describe("vehicle-damage.vue", () => {
}); });
const storeWindshieldOptions = [[1, false, "Windshield", "Single", { const storeWindshieldOptions = [[1, false, "Windshield", "Single", {
selectedWindshieldDamageType: [damageLocationsSelected.REPLACE], selectedWindshieldDamageType: damageLocationsSelected.REPLACE,
selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.SINGLE] selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.SINGLE]
}], }],
[2, false, "Windshield", "Driver", { [2, false, "Windshield", "Driver", {
selectedWindshieldDamageType: [damageLocationsSelected.REPLACE], selectedWindshieldDamageType: damageLocationsSelected.REPLACE,
selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.DRIVER] selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.DRIVER]
}], }],
[3, false, "Windshield", "Passenger", { [3, false, "Windshield", "Passenger", {
selectedWindshieldDamageType: [damageLocationsSelected.REPLACE], selectedWindshieldDamageType: damageLocationsSelected.REPLACE,
selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.PASSENGER] selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: [damageLocationsSelected.PASSENGER]
}], }],
[4, true, "", "", { [4, true, "", "", {
selectedWindshieldDamageType: [damageLocationsSelected.REPAIR], selectedWindshieldDamageType: damageLocationsSelected.REPAIR,
selectedWindshieldChipCount: [2], selectedWindshieldReplaceOptions: [] selectedWindshieldChipCount: [2], selectedWindshieldReplaceOptions: []
}] }]
]; ];

View file

@ -197,32 +197,32 @@ export default {
}, },
getWindshieldOptionsFromStore() { getWindshieldOptionsFromStore() {
var windShieldOptions = { selectedWindshieldDamageType: [], selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: []}; var windShieldOptions = { selectedWindshieldDamageType: "", selectedWindshieldChipCount: [], selectedWindshieldReplaceOptions: []};
if (store.getters.damage.isRepair === undefined) return windshieldOptions; if (store.getters.damage.isRepair === undefined) return windshieldOptions;
if (!store.getters.damage.isRepair) { if (!store.getters.damage.isRepair) {
if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
glass.glassName === damageLocationsSelected.SINGLE })) { glass.glassName === damageLocationsSelected.SINGLE })) {
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE); windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE); windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE);
} }
if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
glass.glassName === damageLocationsSelected.DRIVER })) { glass.glassName === damageLocationsSelected.DRIVER })) {
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE); windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER); windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER);
} }
if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD &&
glass.glassName === damageLocationsSelected.PASSENGER })) { glass.glassName === damageLocationsSelected.PASSENGER })) {
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPLACE); windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE;
windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER); windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER);
} }
} }
if (store.getters.damage.isRepair) { if (store.getters.damage.isRepair) {
windShieldOptions.selectedWindshieldDamageType.push(damageLocationsSelected.REPAIR); windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPAIR;
windShieldOptions.selectedWindshieldChipCount.push(store.getters.damage.numberOfChips); windShieldOptions.selectedWindshieldChipCount.push(store.getters.damage.numberOfChips);
} }
@ -350,12 +350,7 @@ export default {
}); });
}, },
isWindshieldRepair() { isWindshieldRepair() {
if (!this.isWindshieldDamageLocation) return false; return this.isWindshieldDamageLocation && this.selectedWindshieldOptions.selectedWindshieldDamageType === damageLocationsSelected.REPAIR;
return this.selectedWindshieldOptions.selectedWindshieldDamageType && this.selectedWindshieldOptions.selectedWindshieldDamageType.some(selectedDamageType =>
{
return selectedDamageType.toUpperCase() === "REPAIR";
});
}, },
isDriverSideReplace() { isDriverSideReplace() {
if (!this.isSideDoorDamageLocation) return false; if (!this.isSideDoorDamageLocation) return false;
@ -377,7 +372,7 @@ export default {
return this.isWindshieldDamageLocation && this.selectedDamageLocations.length > 1 && this.isWindshieldRepair; return this.isWindshieldDamageLocation && this.selectedDamageLocations.length > 1 && this.isWindshieldRepair;
}, },
hasSplitSingleConflict() { 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 => return this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.some(selectedSingleWindshield =>
{ {
@ -397,7 +392,7 @@ export default {
return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT]; return this.$route.params[this.routerParams.DISPLAY_VEHICLE_CHANGE_ALERT];
}, },
shouldHideBackButton() { shouldHideBackButton() {
return this.$store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie().HasDelayedClaimRegistration; return this.$store.getters.payment.insuranceCoverage.isVerified || getFunnelCookie()?.HasDelayedClaimRegistration;
} }
}, },

View file

@ -22,7 +22,7 @@ import store from "@/store";
export default ({ export default ({
name: "windshieldDamageTypeQuestion", name: "windshieldDamageTypeQuestion",
props: { props: {
modelValue: Array, modelValue: String,
groupName: String, groupName: String,
isAvailable: Boolean, isAvailable: Boolean,
suppressError: Boolean, suppressError: Boolean,

View file

@ -4,7 +4,7 @@
:isAvailable=isWindshieldDamageLocation :isAvailable=isWindshieldDamageLocation
:suppressError="hasRepairReplaceConflict || showNoReplacementAvailableError" :suppressError="hasRepairReplaceConflict || showNoReplacementAvailableError"
groupName="WindshieldDamageTypeQuestion" groupName="WindshieldDamageTypeQuestion"
v-model="selectedWindshieldDamageTypeValues" v-model="selectedWindshieldDamageTypeValue"
:validationRules="windshieldDamageTypeQuestionValidationRules" :validationRules="windshieldDamageTypeQuestionValidationRules"
/> />
<alert <alert
@ -21,7 +21,7 @@
validationRules="windshield-chip-count-required" validationRules="windshield-chip-count-required"
/> />
<replaceOptionsQuestion ref="replaceOptionsQuestion" cmsWidgetName="WindshieldReplaceOptionsQuestion" <replaceOptionsQuestion ref="replaceOptionsQuestion" cmsWidgetName="WindshieldReplaceOptionsQuestion"
:isAvailable=isReplaceOptionSelected :isAvailable="isReplaceOptionSelected"
isMultiSelect isMultiSelect
groupName="WindshieldReplaceOptions" groupName="WindshieldReplaceOptions"
v-model="selectedWindshieldReplaceOptionsValues" v-model="selectedWindshieldReplaceOptionsValues"
@ -55,21 +55,13 @@ defineRule("windshield-damage-type-required", required(errorMessages.WINDSHIELD_
defineRule("windshield-chip-count-required", required(errorMessages.WINDSHIELD_CHIP_COUNT_REQUIRED)); defineRule("windshield-chip-count-required", required(errorMessages.WINDSHIELD_CHIP_COUNT_REQUIRED));
defineRule("windshield-replace-options-required", required(errorMessages.WINSHIELD_REPLACE_OPTIONS_REQUIRED)); defineRule("windshield-replace-options-required", required(errorMessages.WINSHIELD_REPLACE_OPTIONS_REQUIRED));
defineRule("check-for-repair-and-replace", (value, [otherFieldValue]) => { defineRule("check-for-repair-and-replace", (selectedWindshieldDamageType, [selectedDamageLocations]) => {
if (value.toString().toUpperCase().includes(damageLocationsSelected.REPAIR.toUpperCase()) && return selectedWindshieldDamageType.toString() != damageLocationsSelected.REPAIR ||
otherFieldValue.toString().toUpperCase().includes(damageLocationsSelected.WINDSHIELD.toUpperCase()) && !selectedDamageLocations.includes(damageLocationsSelected.WINDSHIELD) ||
Array.isArray(otherFieldValue) && selectedDamageLocations.length === 1;
otherFieldValue.length > 1)
{
return false;
}
return true;
}); });
defineRule("repair-only", (value) => { defineRule("repair-only", (value) => {
if (value.toString().toUpperCase() === damageLocationsSelected.REPAIR.toUpperCase()) { return value.toString() === damageLocationsSelected.REPAIR;
return true;
}
return false;
}); });
defineRule("prevent-split-and-single-together", (value) => { defineRule("prevent-split-and-single-together", (value) => {
if (value.toString().toUpperCase().includes(damageLocationsSelected.SINGLE.toUpperCase()) && if (value.toString().toUpperCase().includes(damageLocationsSelected.SINGLE.toUpperCase()) &&
@ -91,7 +83,7 @@ export default ({
}, },
props: { props: {
modelValue: Array, modelValue: String,
selectedDamageLocations: Array, selectedDamageLocations: Array,
hasRepairReplaceConflict: Boolean, hasRepairReplaceConflict: Boolean,
hasSplitSingleConflict: Boolean, hasSplitSingleConflict: Boolean,
@ -120,7 +112,7 @@ export default ({
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
} }
}, },
selectedWindshieldDamageTypeValues:{ selectedWindshieldDamageTypeValue: {
get: function() { get: function() {
return this.selectedValues.selectedWindshieldDamageType; return this.selectedValues.selectedWindshieldDamageType;
}, },
@ -133,7 +125,7 @@ export default ({
return this.selectedValues.selectedWindshieldChipCount; return this.selectedValues.selectedWindshieldChipCount;
}, },
set: function(newValue) { set: function(newValue) {
this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValues, newValue, null); this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValue, newValue, null);
} }
}, },
selectedWindshieldReplaceOptionsValues: { selectedWindshieldReplaceOptionsValues: {
@ -141,7 +133,7 @@ export default ({
return this.selectedValues.selectedWindshieldReplaceOptions; return this.selectedValues.selectedWindshieldReplaceOptions;
}, },
set: function(newValue) { set: function(newValue) {
this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValues, null, newValue); this.selectedValues = this.getWindshieldOptions(this.selectedWindshieldDamageTypeValue, null, newValue);
} }
}, },
isWindshieldDamageLocation() { isWindshieldDamageLocation() {
@ -151,14 +143,10 @@ export default ({
}); });
}, },
isRepairOptionSelected(){ isRepairOptionSelected(){
if (!this.selectedWindshieldDamageTypeValues) return false; return this.selectedWindshieldDamageTypeValue === damageLocationsSelected.REPAIR && this.isWindshieldDamageLocation;
return this.selectedWindshieldDamageTypeValues.some(val => val.toUpperCase() === "REPAIR") && this.isWindshieldDamageLocation;
}, },
isReplaceOptionSelected(){ isReplaceOptionSelected(){
if (!this.selectedWindshieldDamageTypeValues) return false; return this.selectedWindshieldDamageTypeValue === damageLocationsSelected.REPLACE && this.isWindshieldDamageLocation;
return this.selectedWindshieldDamageTypeValues.some(val => val.toUpperCase() === "REPLACE") && this.isWindshieldDamageLocation;
}, },
isWindshieldReplaceAvailable() { isWindshieldReplaceAvailable() {
return !(Array.isArray(this.windshieldAvailableReplacementOptions) && this.windshieldAvailableReplacementOptions.length < 1); return !(Array.isArray(this.windshieldAvailableReplacementOptions) && this.windshieldAvailableReplacementOptions.length < 1);

View file

@ -330,15 +330,15 @@ export default {
// Save vin, vehicle, customer and service information // Save vin, vehicle, customer and service information
await this.dispatchStoreAction(storeActions.SAVE_VIN_LOOKUP, { await this.dispatchStoreAction(storeActions.SAVE_VIN_LOOKUP, {
isCarIdDifferent: this.isCarIdDifferent,
isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle,
vehicleInfo: Object.assign(resultMap.vehicleLookupResponse, { vin: this.vin }), vehicleInfo: Object.assign(resultMap.vehicleLookupResponse, { vin: this.vin })
serviceLocationInfo: { }, false);
await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.email, false);
await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, {
zipCode: this.zip, zipCode: this.zip,
state: resultMap.validateZipResponse.state, state: resultMap.validateZipResponse.state,
}, }, false);
customerEmail: this.email,
}, false);
return await this.navigateForward(); return await this.navigateForward();
} }

View file

@ -661,10 +661,10 @@ export const actions = {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
}
//Save new values //Save new values
context.commit(storeMutations.UPDATE_YEAR, year); context.commit(storeMutations.UPDATE_YEAR, year);
}
}, },
saveVehicleMake(context, make) { saveVehicleMake(context, make) {
@ -681,10 +681,10 @@ export const actions = {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
}
//Save new values //Save new values
context.commit(storeMutations.UPDATE_MAKE, make); context.commit(storeMutations.UPDATE_MAKE, make);
}
}, },
saveVehicleModel(context, model) { saveVehicleModel(context, model) {
@ -700,10 +700,10 @@ export const actions = {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
}
//Save new values //Save new values
context.commit(storeMutations.UPDATE_MODEL, model); context.commit(storeMutations.UPDATE_MODEL, model);
}
}, },
saveVehicleStyle(context, style) { saveVehicleStyle(context, style) {
@ -718,10 +718,10 @@ export const actions = {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
}
//Save new values //Save new values
context.commit(storeMutations.UPDATE_STYLE, style); context.commit(storeMutations.UPDATE_STYLE, style);
}
}, },
saveVehicleDamage(context, { isWindshieldRepair, selectedGlassToReplace, selectedWindshieldChipCount }) { saveVehicleDamage(context, { isWindshieldRepair, selectedGlassToReplace, selectedWindshieldChipCount }) {
@ -744,58 +744,49 @@ export const actions = {
}, },
// Vin lookup // Vin lookup
saveVinLookup(context, { isCarIdDifferent, isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo, serviceLocationInfo, customerEmail }) { saveVinLookup(context, { isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }) {
//Reset dependent state when changing //Reset dependent state when changing
if (vehicleInfo.vin !== context.state.order.vehicle.vin) { if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { if (!isSelectedGlassAvailableForVehicle) {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); 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 //Reset dependent state when changing
if (registrationInfo?.licensePlate !== context.state.order.vehicle.registration?.licensePlate) { if (registrationInfo?.licensePlate !== context.state.order.vehicle.registration?.licensePlate) {
context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { if (!isSelectedGlassAvailableForVehicle) {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); 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 //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) { 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); context.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { if (!isSelectedGlassAvailableForVehicle) {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); 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 // Misc order actions
@ -805,14 +796,15 @@ export const actions = {
saveEmail(context, email) { saveEmail(context, email) {
context.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, email); context.commit(storeMutations.UPDATE_CUSTOMER_EMAIL_ADDRESS, email);
}, },
saveVin(context, { isCarIdDifferent, isSelectedGlassAvailableForVehicle, vehicleInfo }) { saveVin(context, { isSelectedGlassAvailableForVehicle, vehicleInfo }) {
//Reset dependent state when changing //Reset dependent state when changing
if (vehicleInfo.vin !== context.state.order.vehicle.vin) { if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
if (isCarIdDifferent && !isSelectedGlassAvailableForVehicle) { if (!isSelectedGlassAvailableForVehicle) {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
} }
//Save new values
context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo); context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo);
} }
}, },

View file

@ -784,8 +784,7 @@ describe("Actions", () => {
// Assert // Assert
expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
expect(dispatch).toHaveBeenNthCalledWith(2, storeActions.RESET_DAMAGE_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_VEHICLE, payload.vehicleInfo);
expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo);
}); });
@ -818,8 +817,6 @@ describe("Actions", () => {
// Assert // Assert
expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
expect(dispatch).toHaveBeenNthCalledWith(2, storeActions.RESET_DAMAGE_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_VEHICLE, payload.vehicleInfo);
expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo);
@ -853,8 +850,6 @@ describe("Actions", () => {
// Assert // Assert
expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); expect(dispatch).toHaveBeenNthCalledWith(1, storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
expect(dispatch).toHaveBeenNthCalledWith(2, storeActions.RESET_DAMAGE_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_VEHICLE, payload.vehicleInfo);
expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo); expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo);

View file

@ -119,14 +119,13 @@ export default {
if(!this.selectingInitiatesLoad) { if(!this.selectingInitiatesLoad) {
this.handleCheckChange(); this.handleCheckChange();
} }
this.handleChange(this.value);
}, },
triggerButton() { triggerButton() {
if(this.selectingInitiatesLoad) { if(this.selectingInitiatesLoad) {
this.displayLoader(); this.displayLoader();
this.handleCheckChange(); this.handleCheckChange();
} }
this.handleChange(this.value);
this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true); this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true);
}, },
handleCheckChange() { handleCheckChange() {
@ -135,6 +134,8 @@ export default {
value: this.value.toString(), value: this.value.toString(),
buttonId: this.buttonID && this.buttonID.toString(), buttonId: this.buttonID && this.buttonID.toString(),
}; };
this.handleChange(this.value);
this.$emit("isCheckedChanged", emitEvent); this.$emit("isCheckedChanged", emitEvent);
this.$emit("update:modelValue", emitEvent); this.$emit("update:modelValue", emitEvent);
} }

View file

@ -63,6 +63,7 @@
<script> <script>
import { useField } from "vee-validate"; import { useField } from "vee-validate";
import { toRef } from "vue";
import { queryStrings } from "@/constants/query-strings"; import { queryStrings } from "@/constants/query-strings";
export default { export default {
@ -146,14 +147,13 @@ export default {
if(!this.selectingInitiatesLoad) { if(!this.selectingInitiatesLoad) {
this.handleCheckChange(); this.handleCheckChange();
} }
this.handleChange(this.value);
}, },
triggerButton() { triggerButton() {
if(this.selectingInitiatesLoad) { if(this.selectingInitiatesLoad) {
this.displayLoader(); this.displayLoader();
this.handleCheckChange(); this.handleCheckChange();
} }
this.handleChange(this.value);
this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true); this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, this.value.toString(), true);
}, },
handleCheckChange() { handleCheckChange() {
@ -162,6 +162,8 @@ export default {
value: this.value.toString(), value: this.value.toString(),
buttonId: this.buttonID && this.buttonID.toString(), buttonId: this.buttonID && this.buttonID.toString(),
}; };
this.handleChange(this.value);
this.$emit("isCheckedChanged", emitEvent); this.$emit("isCheckedChanged", emitEvent);
this.$emit("update:modelValue", emitEvent); this.$emit("update:modelValue", emitEvent);
}, },
@ -176,7 +178,7 @@ export default {
}, },
selectedValues(newVal) { selectedValues(newVal) {
if (typeof newVal === "string") { if (typeof newVal === "string") {
this.handleChange(this.value); this.handleChange(newVal);
this.checkValue = newVal == this.value; this.checkValue = newVal == this.value;
} }
else if (newVal !== undefined) { else if (newVal !== undefined) {
@ -202,8 +204,8 @@ export default {
const { const {
handleChange, handleChange,
errors, errors,
} = useField(props.groupName, props.validationRules, fieldOptions); } = useField(toRef(props, "groupName"), toRef(props, "validationRules"), fieldOptions);
return { return {
handleChange, handleChange,
errors, errors,

View file

@ -24,7 +24,6 @@
</template> </template>
<script> <script>
import { toRefs } from "vue";
import { useField } from "vee-validate"; import { useField } from "vee-validate";
export default { export default {
name: "radio", name: "radio",