diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index e1cb33e14..ebffdebde 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -63,6 +63,7 @@ const storeActions = { SAVE_VEHICLE_STYLE: "saveVehicleStyle", SAVE_VEHICLE_DAMAGE: "saveVehicleDamage", SAVE_VIN_LOOKUP: "saveVinLookup", + SAVE_SERVICE_ZIP_CODE_INFO: "saveServiceZipCodeInfo", SAVE_SERVICE_LOCATION: "saveServiceLocation", SAVE_SCHEDULE: "saveSchedule", SAVE_EMAIL: "saveEmail", @@ -79,7 +80,8 @@ const storeActions = { SAVE_PAYMENT_TYPE: "savePaymentType", SAVE_PARENT_ACCOUNT_NUMBER: "saveParentAccountNumber", SAVE_SUPPORTING_ITEMS: "saveSupportingItems", - SAVE_SUPPORTING_ITEMS_AND_RESET_SERVICE_LOCATION: "saveSupportingItemsAndResetServiceLocation", + SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING: + "saveSupportingItemsSuppressingStateResetting", SAVE_VAPS: "saveVaps", }; diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 404caff1d..e1c58bd49 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -229,7 +229,7 @@ export default { const zipCodeData = await this.getZipCodeData(this.serviceZipCode); await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); await this.dispatchStoreAction( - storeActions.SAVE_SERVICE_LOCATION, + storeActions.SAVE_SERVICE_ZIP_CODE_INFO, { zipCode: this.serviceZipCode, state: zipCodeData.state, @@ -272,7 +272,7 @@ export default { const resultMap = await settleAllPromises(promiseResultMap); this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS_AND_RESET_SERVICE_LOCATION, + this.storeActions.SAVE_SUPPORTING_ITEMS, resultMap.supportingItems, false ); diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 4a28151f3..1e78647dc 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -207,7 +207,7 @@ export default { } this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS_AND_RESET_SERVICE_LOCATION, + this.storeActions.SAVE_SUPPORTING_ITEMS, this.supportingItems, false ); diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 69b1de0c1..7fcf3afcd 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -372,7 +372,7 @@ export default { } this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS, + this.storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING, supportingItems, false ); @@ -385,7 +385,7 @@ export default { if (removeEarlyBirdIndex >= 0) { supportingItems.splice(removeEarlyBirdIndex, 1); this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS, + this.storeActions.SAVE_SUPPORTING_ITEMS_SUPPRESSING_STATE_RESETTING, supportingItems, false ); diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index e3dbb7875..ae89a61e6 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -329,7 +329,7 @@ export default { storeActions.GET_SUPPORTING_ITEMS ); this.dispatchStoreAction( - this.storeActions.SAVE_SUPPORTING_ITEMS_AND_RESET_SERVICE_LOCATION, + this.storeActions.SAVE_SUPPORTING_ITEMS, supportingItems.data, false ); diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 578f3f72d..3a2b79a8c 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -323,7 +323,7 @@ export default { await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); await this.dispatchStoreAction( - storeActions.SAVE_SERVICE_LOCATION, + storeActions.SAVE_SERVICE_ZIP_CODE_INFO, { zipCode: this.serviceZipCode, state: resultMap.zipCodeData.state, @@ -360,7 +360,7 @@ export default { ); } else { await this.dispatchStoreAction( - storeActions.SAVE_SERVICE_LOCATION, + storeActions.SAVE_SERVICE_ZIP_CODE_INFO, { zipCode: this.serviceZipCode, state: zipCodeData.state, diff --git a/src/store/index.js b/src/store/index.js index 3b7bb4314..bd8ccffe7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1776,10 +1776,6 @@ export const actions = { }, saveSupportingItems(context, supportingItems) { - context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); - }, - - saveSupportingItemsAndResetServiceLocation(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); @@ -1788,6 +1784,10 @@ export const actions = { context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); }, + saveSupportingItemsSuppressingStateResetting(context, supportingItems) { + context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); + }, + saveVaps(context, vaps) { context.commit(storeMutations.UPDATE_VAPS, vaps); }, @@ -1849,14 +1849,20 @@ export const actions = { context.commit(storeMutations.UPDATE_SCHEDULE, scheduleInfo); }, - saveServiceLocation(context, serviceLocationInfo) { + saveServiceZipCodeInfo(context, serviceZipCodeInfo) { if ( context.state.order.serviceLocation && - serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode + 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.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); + }, + + saveServiceLocation(context, serviceLocationInfo) { context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo); },