Merge branch 'develop' into feature/CSR-108
This commit is contained in:
commit
93fac7462d
13 changed files with 97 additions and 126 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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: []
|
||||
}]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import store from "@/store";
|
|||
export default ({
|
||||
name: "windshieldDamageTypeQuestion",
|
||||
props: {
|
||||
modelValue: Array,
|
||||
modelValue: String,
|
||||
groupName: String,
|
||||
isAvailable: Boolean,
|
||||
suppressError: Boolean,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
:isAvailable=isWindshieldDamageLocation
|
||||
:suppressError="hasRepairReplaceConflict || showNoReplacementAvailableError"
|
||||
groupName="WindshieldDamageTypeQuestion"
|
||||
v-model="selectedWindshieldDamageTypeValues"
|
||||
v-model="selectedWindshieldDamageTypeValue"
|
||||
:validationRules="windshieldDamageTypeQuestionValidationRules"
|
||||
/>
|
||||
<alert
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
validationRules="windshield-chip-count-required"
|
||||
/>
|
||||
<replaceOptionsQuestion ref="replaceOptionsQuestion" cmsWidgetName="WindshieldReplaceOptionsQuestion"
|
||||
:isAvailable=isReplaceOptionSelected
|
||||
:isAvailable="isReplaceOptionSelected"
|
||||
isMultiSelect
|
||||
groupName="WindshieldReplaceOptions"
|
||||
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-replace-options-required", required(errorMessages.WINSHIELD_REPLACE_OPTIONS_REQUIRED));
|
||||
|
||||
defineRule("check-for-repair-and-replace", (value, [otherFieldValue]) => {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
|
||||
<script>
|
||||
import { useField } from "vee-validate";
|
||||
import { toRef } from "vue";
|
||||
import { queryStrings } from "@/constants/query-strings";
|
||||
|
||||
export default {
|
||||
|
|
@ -146,14 +147,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() {
|
||||
|
|
@ -162,6 +162,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);
|
||||
},
|
||||
|
|
@ -176,7 +178,7 @@ export default {
|
|||
},
|
||||
selectedValues(newVal) {
|
||||
if (typeof newVal === "string") {
|
||||
this.handleChange(this.value);
|
||||
this.handleChange(newVal);
|
||||
this.checkValue = newVal == this.value;
|
||||
}
|
||||
else if (newVal !== undefined) {
|
||||
|
|
@ -202,8 +204,8 @@ export default {
|
|||
const {
|
||||
handleChange,
|
||||
errors,
|
||||
} = useField(props.groupName, props.validationRules, fieldOptions);
|
||||
|
||||
} = useField(toRef(props, "groupName"), toRef(props, "validationRules"), fieldOptions);
|
||||
|
||||
return {
|
||||
handleChange,
|
||||
errors,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { toRefs } from "vue";
|
||||
import { useField } from "vee-validate";
|
||||
export default {
|
||||
name: "radio",
|
||||
|
|
|
|||
Loading…
Reference in a new issue