Merge branch 'develop' into feature/CSR-1414

This commit is contained in:
Chloe Herd 2023-09-14 08:56:42 -04:00
commit f90e0007e7
5 changed files with 48 additions and 17 deletions

View file

@ -320,7 +320,7 @@ export default {
Object.keys(vehicleInfoToCommit).length === 0
? this.$store.getters.vehicle
: vehicleInfoToCommit,
registrationInfo: {
customerInfo: {
firstName: this.customerQuestions.firstName,
lastName: this.customerQuestions.lastName,
},

View file

@ -1,6 +1,7 @@
<template>
<dropdownQuestion
disableAutoFill
class="mb-5 mt-4"
v-model="selectedValue"
:valueAsKey="true"
:disableValidationIfElementDisabled="true" />

View file

@ -13,7 +13,6 @@
<vehicleQuestion
ref="vehicleYearQuestion"
class="mb-2 mt-4"
v-model="selectedYear"
:isDisabled="!yearOptions.length"
:options="yearOptions"
@ -24,7 +23,6 @@
<vehicleQuestion
ref="vehicleMakeQuestion"
class="mb-2 mt-4"
v-model="selectedMake"
:isDisabled="!makeOptions.length"
:options="makeOptions"
@ -35,7 +33,6 @@
<vehicleQuestion
ref="vehicleModelQuestion"
class="mb-2 mt-4"
v-model="selectedModel"
cmsWidgetName="VehicleModelQuestion"
:isDisabled="!modelOptions.length"
@ -46,7 +43,6 @@
<vehicleQuestion
ref="vehicleStyleQuestion"
class="mb-2 mt-4"
v-model="selectedStyle"
cmsWidgetName="VehicleStyleQuestion"
:isDisabled="!styleOptions.length"
@ -61,7 +57,7 @@
:displayVehicleImage="imageUrl"
:vehicleCategory="category"
:displayUnmatchedVehicleIcon="unmatchedVehicleIcon"
class="mt-5 mb-3"
class="mt-5 vehicle-footer"
ref="banner" />
<funnelFooter
@ -410,8 +406,11 @@ export default {
margin-left: 0.75rem;
margin-right: 0.75rem;
}
.vehicle-footer {
margin-bottom: 0;
}
.siteSubHeader {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
}
</style>

View file

@ -234,8 +234,6 @@ export const mutations = {
},
updateRegistration(state, registrationInfo) {
state.order.vehicle.registration.licensePlate = registrationInfo?.licensePlate;
state.order.customer.firstName = registrationInfo?.firstName;
state.order.customer.lastName = registrationInfo?.lastName;
},
updateServiceZip(state, serviceZipInfo) {
state.order.serviceLocation.state = serviceZipInfo.state;
@ -1662,15 +1660,25 @@ export const actions = {
context.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
}
//Save new values
context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo);
context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo);
if (registrationInfo) {
context.commit(storeMutations.UPDATE_REGISTRATION, registrationInfo);
// only update name information if there isn't a value in state already
if (!context.getters.order.customer.firstName) {
context.commit(storeMutations.UPDATE_CUSTOMER_DETAILS, {
firstName: registrationInfo.firstName,
lastName: registrationInfo.lastName,
});
}
}
}
},
saveRegistrationAddressLookup(
context,
{ isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo }
{ isSelectedGlassAvailableForVehicle, vehicleInfo, customerInfo }
) {
//Reset dependent state when changing
if (vehicleInfo.vin !== context.state.order.vehicle.vin) {
@ -1679,10 +1687,16 @@ export const actions = {
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);
context.commit(storeMutations.UPDATE_VEHICLE, vehicleInfo);
// only update name information if there isn't a value in state already
if (!context.getters.order.customer.firstName && customerInfo) {
context.commit(storeMutations.UPDATE_CUSTOMER_DETAILS, {
firstName: customerInfo.firstName,
lastName: customerInfo.lastName,
});
}
},

View file

@ -1492,9 +1492,18 @@ describe("Actions", () => {
licensePlate: "ABC123",
},
},
customer: {
firstName: "test",
lastName: "test",
},
},
};
context.getters = {
...getters,
order: getters.order(context),
};
const commit = jest.fn();
const dispatch = jest.fn();
@ -1538,9 +1547,18 @@ describe("Actions", () => {
address: "123 Main St",
},
},
customer: {
firstName: "test",
lastName: "test",
},
},
};
context.getters = {
...getters,
order: getters.order(context),
};
const commit = jest.fn();
const dispatch = jest.fn();
@ -1552,7 +1570,7 @@ describe("Actions", () => {
isCarIdDifferent: true,
isSelectedGlassAvailableForVehicle: false,
vehicleInfo: { carId: "C010101", vin: "XXXXX" },
registrationInfo: { firstName: "abc", lastName: "123" },
customerInfo: { firstName: "abc", lastName: "123" },
serviceLocationInfo: { state: "CO" },
customerEmail: "test@safelite.com",
};
@ -1570,7 +1588,6 @@ describe("Actions", () => {
);
expect(commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE, payload.vehicleInfo);
expect(commit).toBeCalledWith(storeMutations.UPDATE_REGISTRATION, payload.registrationInfo);
});
it("saveVehicle, should save vehicle info", () => {