Inspection reports: hide primaryOnly required slots when charge is not primary (parity with toolsv2)
Objective
- Align the inspection Reports experience on Attik Mobile with web behavior so primary-only required report slots do not appear for add-on (non-primary) charges.
- Keep primary service charges showing those slots, and non–primary-only required types visible as they are today.
Background
- On the inspection screen, mobile builds required report buckets from each service’s populated
_requiredReportTypeIdswithout considering whether the slot is marked primary-only or whether the job’s charge for that service is the primary charge. - Product expectation (from legacy web / toolsv2 behavior described in discovery):
RequiredReportType.primaryOnlyshould only surface when the related charge is primary (isPrimaryon the charge); otherwise those slots should be omitted so add-on jobs do not show empty primary-only rows. - Unmatched / “truly unmatched” grouping in mobile depends on the same required-report sets; changing which slots exist must stay consistent across those helpers.
Scope
Attik Mobile
- Required-report discovery and ordering live in
components/inspection/reports/reportGrouping.ts(getServicesWithRequiredReports,getServiceFromCharge,getAllServices, and downstream helpers such asgetUnmatchedReportsByService/getTrulyUnmatchedReports). TodaygetServicesWithRequiredReportsincludes every populatedRequiredReportTypewith noprimaryOnlyor charge-primary check. components/inspection/ReportsSection.tsxconsumesgetServicesWithRequiredReportsand related grouping functions from that module; any change to which slots exist flows through this UI.- The inspection route that mounts reports is
app/(app)/inspection/[id].tsx(includesReportsSection). - Charge + service shape should match whatever the API returns for
inspection.chargesand populated_serviceId(includingisPrimaryon charges andprimaryOnlyon required report types where populated).
Attik Frontend (parity reference)
- Current workorder reports UI lives under
src/app/tools/inspections/[id]/components/reports/(Reports.tsx,ReportCard.tsx,useReportUpload.ts). This tree is the closest in-repo reference for how web lists required slots and handles uploads; it does not currently apply aprimaryOnly+ charge-primary filter in the scannedservicesWithRequiredReportslogic, so the exact parity target may be legacy toolsv2 or a shared rule to be confirmed during implementation.
References
- Mobile:
attik-mobile/components/inspection/reports/reportGrouping.ts,attik-mobile/components/inspection/ReportsSection.tsx,attik-mobile/app/(app)/inspection/[id].tsx - Web (in-repo):
attik-frontend/src/app/tools/inspections/[id]/components/reports/Reports.tsx
Status: Completed
Log in to comment and vote
No comments yet
Be the first to share your thoughts.