From cee84b55a0fdda3c981d1a9632ce08edf972d965 Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Thu, 30 May 2024 14:59:39 -0400 Subject: [PATCH] Refactoring hasAnyNonWindshieldPart getter --- src/store/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index 40863522..450e902d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -281,7 +281,11 @@ export const useMainStore = defineStore({ return !damage.isRepair && (lineItems.glassParts?.some((gp) => gp.partType === partTypeStrings.WINDSHIELD) ?? false); }, - hasAnyNonWindshieldGlassParts: (s) => !s.order.policy.isDamageGlassOnly, + hasAnyNonWindshieldGlassParts: (s) => { + const { damage } = s.order; + const nonWindshieldItems = damage.glassToReplace?.filter((glass) => glass.glassLocation !== damageLocationsSelected.WINDSHIELD); + return !!nonWindshieldItems?.length; + }, isMobileAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE || state.order.serviceLocation.appointmentType === AppointmentTypeStrings.MOBILE_NOT_ITAC_AND_NOT_NOCOMP, isDropOffAppointment: (state) => state.order.serviceLocation.appointmentType === AppointmentTypeStrings.DROP_OFF,