Workorder: no control to set primary service on charge list (Edit charges only today)
Objective
- Make it possible to see and change which charge/service is primary in the normal workorder workflow, or deliberately keep Edit charges as the only place to set primary while improving discoverability—decision needed on the exact product rule.
- Reduce friction when PAC thresholds, report matching, or reschedule logic treats the primary charge specially (
primaryCharge/charge.isPrimary)—staff should not be blocked because the workorder charge list has no control.
Background
- Intake noted that on the inspection workorder there is no way to change which service is primary; reordering vs primary were reported together from the same thread. Slack — workorder charges & primary
charge.isPrimaryexists onattik-backend/src/models/chargeSchema.tsand surfaces in the UI viaChargeChips(attik-frontend/.../ChargeChips.tsx) on each charge row.- Edit charges flow compares
isPrimarywhen detecting changes (EditChargesModal.tsx)—primary is editable there, not via a dedicated control on the Services & payments table on the workorder. - Downstream logic references the primary charge in places such as
RescheduleJobModal.tsx(primaryCharge) andReports.tsx(mapping primary service for reports)—so which charge is primary has product impact beyond labeling.
Scope
Frontend
attik-frontend/src/app/tools/inspections/[id]/components/ServicesPayments.tsx— charge table rendersinspection.chargesbut does not offer a primary toggle;ChargeChipsonly displays.attik-frontend/src/app/tools/inspections/[id]/components/EditChargesModal.tsx— whereisPrimaryis currently set in the service/charge editor.attik-frontend/src/app/tools/inspections/[id]/components/ChargeChips.tsx— current primary badge behavior.attik-frontend/src/app/tools/inspections/[id]/components/RescheduleJobModal.tsx— readsinspection.charges.find((c) => c.isPrimary).attik-frontend/src/app/tools/inspections/[id]/components/reports/Reports.tsx—charge.isPrimaryused for service/report mapping.
Backend
attik-backend/src/models/chargeSchema.ts—isPrimaryfield persistence;PATCH chargeroutes as used when saving from Edit charges.
Product / architecture
- Decision needed: Inline primary selector on the workorder charge row vs overflow menu vs keep modal-only with copy / link to Edit charges.
- Decision needed: Exactly one primary per inspection vs validation when multiple flags exist (if ever).
References
- Slack — workorder charges & primary
- Related: ATT-1661 — charge display order after reorder (separate symptom).
attik-backend/src/models/chargeSchema.tsattik-frontend/src/app/tools/inspections/[id]/components/ServicesPayments.tsxattik-frontend/src/app/tools/inspections/[id]/components/EditChargesModal.tsxattik-frontend/src/app/tools/inspections/[id]/components/ChargeChips.tsx
Status: Planned
Log in to comment and vote
No comments yet
Be the first to share your thoughts.