Refactoring hasAnyNonWindshieldPart getter

This commit is contained in:
Michaela Brydon 2024-05-30 14:59:39 -04:00
parent 95e49cb88c
commit cee84b55a0

View file

@ -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,