Update with better cascading logic.
This commit is contained in:
parent
8348781ca7
commit
9b75367894
2 changed files with 19 additions and 17 deletions
|
|
@ -54,6 +54,7 @@ const storeActions = {
|
||||||
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
|
RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
|
||||||
RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
|
RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
|
||||||
RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
|
RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
|
||||||
|
RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES: "resetServiceLocationAndDependencies",
|
||||||
RESET_STATE: "resetState",
|
RESET_STATE: "resetState",
|
||||||
|
|
||||||
// SAVE COMPONENT STATE
|
// SAVE COMPONENT STATE
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ export const mutations = {
|
||||||
|
|
||||||
//early bird fee used on schedule page also needs reset when schedule is reset
|
//early bird fee used on schedule page also needs reset when schedule is reset
|
||||||
const supportingItems = state.order.lineItems.supportingItems;
|
const supportingItems = state.order.lineItems.supportingItems;
|
||||||
const removeEarlyBirdIndex = supportingItems.findIndex(
|
const removeEarlyBirdIndex = supportingItems?.findIndex(
|
||||||
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -726,6 +726,15 @@ export const actions = {
|
||||||
resetPartsAndDependencies(context) {
|
resetPartsAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
|
|
||||||
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
|
},
|
||||||
|
|
||||||
|
resetServiceLocationAndDependencies(context) {
|
||||||
|
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
||||||
|
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
||||||
|
|
||||||
|
context.commit(storeMutations.RESET_SCHEDULE);
|
||||||
},
|
},
|
||||||
|
|
||||||
resetState(context) {
|
resetState(context) {
|
||||||
|
|
@ -1777,10 +1786,7 @@ export const actions = {
|
||||||
|
|
||||||
saveSupportingItems(context, supportingItems) {
|
saveSupportingItems(context, supportingItems) {
|
||||||
if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) {
|
if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) {
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
|
||||||
|
|
||||||
context.commit(storeMutations.RESET_SCHEDULE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
|
||||||
|
|
@ -1856,26 +1862,24 @@ export const actions = {
|
||||||
context.state.order.serviceLocation &&
|
context.state.order.serviceLocation &&
|
||||||
serviceZipCodeInfo.zipCode !== context.state.order.serviceLocation.zipCode
|
serviceZipCodeInfo.zipCode !== context.state.order.serviceLocation.zipCode
|
||||||
) {
|
) {
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
|
||||||
|
|
||||||
context.commit(storeMutations.RESET_SCHEDULE);
|
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo);
|
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo);
|
||||||
},
|
},
|
||||||
|
|
||||||
saveServiceLocation(context, serviceLocationInfo) {
|
saveServiceLocation(context, serviceLocationInfo) {
|
||||||
if (context.state.order.serviceLocationInfo) {
|
if (context.state.order.serviceLocation) {
|
||||||
if (
|
if (
|
||||||
serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode ||
|
serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode ||
|
||||||
!deepEqual(
|
!deepEqual(
|
||||||
serviceLocationInfo.provider,
|
serviceLocationInfo.provider,
|
||||||
context.state.order.serviceLocationInfo.provider
|
context.state.order.serviceLocation.provider
|
||||||
) ||
|
) ||
|
||||||
serviceLocationInfo.appointmentType !==
|
serviceLocationInfo.appointmentType !==
|
||||||
context.state.order.serviceLocationInfo.appointmentType
|
context.state.order.serviceLocation.appointmentType
|
||||||
) {
|
) {
|
||||||
context.commit(storeMutations.RESET_SCHEDULE);
|
context.commit(storeMutations.RESET_SCHEDULE);
|
||||||
}
|
}
|
||||||
|
|
@ -1903,10 +1907,7 @@ export const actions = {
|
||||||
|
|
||||||
saveGlassParts(context, parts) {
|
saveGlassParts(context, parts) {
|
||||||
if (!deepEqual(parts, context.state.order.lineItems.glassParts)) {
|
if (!deepEqual(parts, context.state.order.lineItems.glassParts)) {
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
|
||||||
|
|
||||||
context.commit(storeMutations.RESET_SCHEDULE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue