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 Object.keys(vehicleInfoToCommit).length === 0
? this.$store.getters.vehicle ? this.$store.getters.vehicle
: vehicleInfoToCommit, : vehicleInfoToCommit,
registrationInfo: { customerInfo: {
firstName: this.customerQuestions.firstName, firstName: this.customerQuestions.firstName,
lastName: this.customerQuestions.lastName, lastName: this.customerQuestions.lastName,
}, },

View file

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

View file

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

View file

@ -234,8 +234,6 @@ export const mutations = {
}, },
updateRegistration(state, registrationInfo) { updateRegistration(state, registrationInfo) {
state.order.vehicle.registration.licensePlate = registrationInfo?.licensePlate; state.order.vehicle.registration.licensePlate = registrationInfo?.licensePlate;
state.order.customer.firstName = registrationInfo?.firstName;
state.order.customer.lastName = registrationInfo?.lastName;
}, },
updateServiceZip(state, serviceZipInfo) { updateServiceZip(state, serviceZipInfo) {
state.order.serviceLocation.state = serviceZipInfo.state; state.order.serviceLocation.state = serviceZipInfo.state;
@ -1662,15 +1660,25 @@ export const actions = {
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);
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( saveRegistrationAddressLookup(
context, context,
{ isSelectedGlassAvailableForVehicle, vehicleInfo, registrationInfo } { isSelectedGlassAvailableForVehicle, vehicleInfo, customerInfo }
) { ) {
//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) {
@ -1679,10 +1687,16 @@ export const actions = {
if (!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);
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 && customerInfo) {
context.commit(storeMutations.UPDATE_CUSTOMER_DETAILS, {
firstName: customerInfo.firstName,
lastName: customerInfo.lastName,
});
} }
}, },

View file

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