Merge pull request #724 from Safelite/bug/brydon/SSR-1292

Refactoring hasAnyNonWindshieldPart getter
This commit is contained in:
michaela-brydon-safelite 2024-05-30 15:48:11 -04:00 committed by GitHub
commit 596fc64841
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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,