From 635d79c357ae7b37b512fe1a2c344679923caacb Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Wed, 14 Jun 2023 13:57:56 -0400 Subject: [PATCH] Implement first round of resetting logic per ticket --- src/store/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/store/index.js b/src/store/index.js index bd8ccffe7..ec015d9a6 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1779,6 +1779,8 @@ export const actions = { 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.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems); @@ -1857,12 +1859,36 @@ export const actions = { 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.RESET_SCHEDULE); } context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceZipCodeInfo); }, saveServiceLocation(context, serviceLocationInfo) { + if (context.state.order.serviceLocationInfo) { + if (serviceLocationInfo.zipCode !== context.state.order.serviceLocationInfo.zipCode) { + context.commit(storeMutations.RESET_SCHEDULE); + } + + if ( + !deepEqual( + serviceLocationInfo.provider, + context.state.order.serviceLocationInfo.provider + ) + ) { + context.commit(storeMutations.RESET_SCHEDULE); + } + + if ( + serviceLocationInfo.appointmentType !== + context.state.order.serviceLocationInfo.appointmentType + ) { + context.commit(storeMutations.RESET_SCHEDULE); + } + } + context.commit(storeMutations.UPDATE_SERVICE_LOCATION, serviceLocationInfo); }, @@ -1887,6 +1913,8 @@ export const actions = { 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.commit(storeMutations.UPDATE_GLASS_PARTS, parts);