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 _requiredReportTypeIds without 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.primaryOnly should only surface when the related charge is primary (isPrimary on 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 as getUnmatchedReportsByService / getTrulyUnmatchedReports). Today getServicesWithRequiredReports includes every populated RequiredReportType with no primaryOnly or charge-primary check.
  • components/inspection/ReportsSection.tsx consumes getServicesWithRequiredReports and 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 (includes ReportsSection).
  • Charge + service shape should match whatever the API returns for inspection.charges and populated _serviceId (including isPrimary on charges and primaryOnly on 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 a primaryOnly + charge-primary filter in the scanned servicesWithRequiredReports logic, 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

Please authenticate to join the conversation.

Upvoters
Status

Completed

Board
🏠

Main App

Date

About 2 months ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.