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_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
|
||||
RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
|
||||
RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES: "resetServiceLocationAndDependencies",
|
||||
RESET_STATE: "resetState",
|
||||
|
||||
// SAVE COMPONENT STATE
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ export const mutations = {
|
|||
|
||||
//early bird fee used on schedule page also needs reset when schedule is reset
|
||||
const supportingItems = state.order.lineItems.supportingItems;
|
||||
const removeEarlyBirdIndex = supportingItems.findIndex(
|
||||
const removeEarlyBirdIndex = supportingItems?.findIndex(
|
||||
(item) => item.partType == PREMIUM_FEE_PART_TYPE
|
||||
);
|
||||
|
||||
|
|
@ -726,6 +726,15 @@ export const actions = {
|
|||
resetPartsAndDependencies(context) {
|
||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||
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) {
|
||||
|
|
@ -1777,10 +1786,7 @@ export const actions = {
|
|||
|
||||
saveSupportingItems(context, supportingItems) {
|
||||
if (!deepEqual(supportingItems, context.state.order.lineItems.supportingItems)) {
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
||||
|
||||
context.commit(storeMutations.RESET_SCHEDULE);
|
||||
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||
}
|
||||
|
||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
|
||||
|
|
@ -1856,26 +1862,24 @@ export const actions = {
|
|||
context.state.order.serviceLocation &&
|
||||
serviceZipCodeInfo.zipCode !== context.state.order.serviceLocation.zipCode
|
||||
) {
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
||||
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||
|
||||
context.commit(storeMutations.RESET_SCHEDULE);
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_MOBILE_ADDRESS);
|
||||
}
|
||||
|
||||
context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo);
|
||||
},
|
||||
|
||||
saveServiceLocation(context, serviceLocationInfo) {
|
||||
if (context.state.order.serviceLocationInfo) {
|
||||
if (context.state.order.serviceLocation) {
|
||||
if (
|
||||
serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode ||
|
||||
serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode ||
|
||||
!deepEqual(
|
||||
serviceLocationInfo.provider,
|
||||
context.state.order.serviceLocationInfo.provider
|
||||
context.state.order.serviceLocation.provider
|
||||
) ||
|
||||
serviceLocationInfo.appointmentType !==
|
||||
context.state.order.serviceLocationInfo.appointmentType
|
||||
context.state.order.serviceLocation.appointmentType
|
||||
) {
|
||||
context.commit(storeMutations.RESET_SCHEDULE);
|
||||
}
|
||||
|
|
@ -1903,10 +1907,7 @@ export const actions = {
|
|||
|
||||
saveGlassParts(context, parts) {
|
||||
if (!deepEqual(parts, context.state.order.lineItems.glassParts)) {
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_APPOINTMENT_TYPE);
|
||||
context.commit(storeMutations.RESET_SERVICE_LOCATION_PROVIDER);
|
||||
|
||||
context.commit(storeMutations.RESET_SCHEDULE);
|
||||
context.dispatch(storeActions.RESET_SERVICE_LOCATION_STATE_AND_DEPENDENCIES);
|
||||
}
|
||||
|
||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, parts);
|
||||
|
|
|
|||
Loading…
Reference in a new issue