WIP
This commit is contained in:
parent
b54b6ed5f3
commit
6a7d3b8626
6 changed files with 36 additions and 15 deletions
|
|
@ -70,6 +70,7 @@ const storeActions = {
|
|||
SAVE_VIN: "saveVin",
|
||||
SAVE_REGISTRATION_ADDRESS_LOOKUP: "saveRegistrationAddressLookup",
|
||||
SAVE_GLASS_PARTS: "saveGlassParts",
|
||||
SAVE_GLASS_PART_PRICES: "saveGlassPartPrices",
|
||||
SAVE_PART_QUESTION_ANSWERS: "savePartQuestionAnswers",
|
||||
RESET_MOLDING_AND_CAPABILITY_QUESTIONS_IF_NEEDED:
|
||||
"resetMoldingAndCapabilityQuestionAnswersIfNeeded",
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ const storeMutations = {
|
|||
RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise",
|
||||
RESET_SERVICE_LOCATION_APPOINTMENT_TYPE: "resetServiceLocationAppointmentType",
|
||||
RESET_SERVICE_LOCATION_PROVIDER: "resetServiceLocationProvider",
|
||||
RESET_SERVICE_LOCATION_MOBILE_ADDRESS: "resetServiceLocationMobileAddress",
|
||||
|
||||
// OTHER MUTATIONS
|
||||
UPDATE_PAGE_DATA: "updatePageData",
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@ export default {
|
|||
this.isInsuranceSelected,
|
||||
false
|
||||
);
|
||||
|
||||
if (!this.isInsuranceSelected) {
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_PARENT_ACCOUNT_NUMBER,
|
||||
|
|
@ -196,18 +197,21 @@ export default {
|
|||
) {
|
||||
this.supportingItems = this.filterOutFees(this.supportingItems);
|
||||
}
|
||||
|
||||
if (this.pricedGlassParts.length > 0) {
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_GLASS_PARTS,
|
||||
this.storeActions.SAVE_GLASS_PART_PRICES,
|
||||
this.pricedGlassParts,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||
this.supportingItems,
|
||||
false
|
||||
);
|
||||
|
||||
this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false);
|
||||
|
||||
const payment = this.$store.getters.payment;
|
||||
|
|
|
|||
|
|
@ -442,7 +442,10 @@ export default {
|
|||
const collectedGlassParts = this.reducedGlassPartsArray(partsOrQuestions);
|
||||
|
||||
// save to store lineItems.glassParts
|
||||
self.$store.commit(storeMutations.UPDATE_GLASS_PARTS, collectedGlassParts);
|
||||
await baseMixin.methods.dispatchStoreAction(
|
||||
storeActions.SAVE_GLASS_PARTS,
|
||||
collectedGlassParts
|
||||
)
|
||||
|
||||
const payment = store.getters.payment;
|
||||
|
||||
|
|
|
|||
|
|
@ -2240,15 +2240,17 @@ describe("vehicle-questions-mixin", () => {
|
|||
|
||||
// Assert
|
||||
expect(wrapper.vm.$store.commit).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$store.commit).toHaveBeenCalledWith(
|
||||
storeMutations.UPDATE_GLASS_PARTS,
|
||||
expect(wrapper.vm.$store.dispatch).toHaveBeenCalledWith(
|
||||
storeActions.SAVE_GLASS_PARTS,
|
||||
collectedGlassParts
|
||||
);
|
||||
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||
{ query: { fmgPage: "vin-lookup" } }
|
||||
);
|
||||
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -253,16 +253,7 @@ export const mutations = {
|
|||
state.order.serviceLocation.isVehicleProtected = serviceLocationInfo.isVehicleProtected;
|
||||
|
||||
if (serviceLocationInfo.provider) {
|
||||
state.order.serviceLocation.provider.providerNumber =
|
||||
serviceLocationInfo.provider?.providerNumber;
|
||||
state.order.serviceLocation.provider.address.streetAddress =
|
||||
serviceLocationInfo.provider?.address?.streetAddress;
|
||||
state.order.serviceLocation.provider.address.city =
|
||||
serviceLocationInfo.provider?.address?.city;
|
||||
state.order.serviceLocation.provider.address.state =
|
||||
serviceLocationInfo.provider?.address?.state;
|
||||
state.order.serviceLocation.provider.address.zip =
|
||||
serviceLocationInfo.provider?.address?.zip;
|
||||
state.order.serviceLocation.provider = serviceLocationInfo.provider;
|
||||
}
|
||||
},
|
||||
updateSchedule(state, scheduleInfo) {
|
||||
|
|
@ -354,6 +345,14 @@ export const mutations = {
|
|||
resetServiceLocationProvider(state) {
|
||||
state.order.serviceLocation.provider = null;
|
||||
},
|
||||
resetServiceLocationMobileAddress(state) {
|
||||
state.order.serviceLocation.address = null;
|
||||
state.order.serviceLocation.address2 = null;
|
||||
state.order.serviceLocation.city = null;
|
||||
state.order.serviceLocation.state = null;
|
||||
state.order.serviceLocation.zipCode = null;
|
||||
state.order.serviceLocation.isVehicleProtected = null;
|
||||
},
|
||||
// Misc Mutations
|
||||
updateStateWithOrderInformation(state, sessionInformation) {
|
||||
state.order.referralNumber = sessionInformation.order.referralNumber;
|
||||
|
|
@ -1825,6 +1824,13 @@ export const actions = {
|
|||
},
|
||||
|
||||
saveServiceLocation(context, serviceLocationInfo) {
|
||||
if (
|
||||
context.state.order.serviceLocation &&
|
||||
serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode
|
||||
) {
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
||||
}
|
||||
|
||||
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo);
|
||||
},
|
||||
|
||||
|
|
@ -1846,7 +1852,7 @@ export const actions = {
|
|||
},
|
||||
|
||||
saveGlassParts(context, parts) {
|
||||
if (!deepEqual(parts, context.getters.order.lineItems.glassParts)) {
|
||||
if (!deepEqual(parts, context.state.order.lineItems.glassParts)) {
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
||||
}
|
||||
|
|
@ -1854,6 +1860,10 @@ export const actions = {
|
|||
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
|
||||
},
|
||||
|
||||
saveGlassPartPrices(context, parts) {
|
||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
|
||||
},
|
||||
|
||||
clearVin(context) {
|
||||
context.commit(storeMutations.UPDATE_VEHICLE_VIN, null);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue