Objective
- Evolve the Inspector Balance widget so ops can do capacity planning in large markets: visible total capacity, clearer per-inspector totals, and less friction when focusing a subset of inspectors.
Background
- Daily view is called out as already shipped; remaining widget asks include a gray total-capacity bar, more prominent total available counts, and team filter UX that does not dominate the layout.
- Duplicate reports note truncation, overlap, and resize glitches on narrow widths—tooltips or hover detail may help.
- Today,
GET dashboard/balanceinattik-backend/src/routes/dashboard.tsreturns per-inspectortotalAvailable,usedSlots, andpercentFilledusing synthetic/historic slots (createSyntheticSlotArrayForDateRange,calcAvailableSlots,calcFilledSlotsunderattik-backend/src/util/functions/slots/). Used slots currently treat both inspections and charge-backed events as filling a slot (calcFilledSlots.ts); available is counted per slot with no grouping. There is no company-level mode switch, per-inspector slot grouping, or inspector-level denominator override oninspectorSchemayet. - Inspector settings UI:
attik-frontend/src/app/tools/settings/inspectors/[id]/(InspectorForm). Widget:attik-frontend/src/components/dashboard/inspectorBalance/(InspectorWorkBreakdown.tsx,InspWorkBar.tsx), mounted fromattik-frontend/src/app/tools/page.tsx.
Repro / UX context
Screen Recording 2026-05-08 at 8.07.33 AM.mov
Screen Recording 2026-05-08 at 8.08.18 AM.mov
- In narrow layouts, Inspector Balance values truncate or overlap; hover/tooltip for full numbers was suggested.
Scope
Frontend (widget UX — existing)
attik-frontend/src/components/dashboard/inspectorBalance/(InspectorWorkBreakdown.tsx,InspWorkBar.tsx): gray capacity bar, visible totals, team filter priority, responsive/tooltip improvements per original request.- Parent dashboard layout on
attik-frontend/src/app/tools/page.tsxas needed for filter ordering and breakpoints.
Frontend (configuration — additional, same PRs)
- Company-wide settings UI for balance numerator/denominator mode:
inspections only|events only|blended(inspections + inspection events). - Per-inspector configuration for grouping multiple time slots into one availability window (inspector settings, not company-default only).
- Inspector settings (
attik-frontend/src/app/tools/settings/inspectors/[id]/,InspectorForm): manual denominator override; when set, dashboard should reflect that the override replaces computed capacity (not added to it).
Backend (aggregation — additional, same PRs)
- Extend
GET dashboard/balanceinattik-backend/src/routes/dashboard.tsto apply company mode, per-inspector slot grouping, and inspector denominator override before returningtotalAvailable,usedSlots, andpercentFilled. - Slot helpers:
attik-backend/src/util/functions/slots/createSyntheticSlotArrayForDateRange.ts,calcAvailableSlots.ts,calcFilledSlots.ts. - Persist company-wide balance mode on the company document (or existing company settings pattern — decision needed on exact field location).
- Persist per-inspector slot-grouping preference and denominator override on
attik-backend/src/models/inspectorSchema.tsand inspector update routes.
Decisions left to implementation
- Exact rules for which slots merge into one window per inspector (contiguity, same day, gap tolerance, etc.).
- How events only vs inspections only maps onto
calcFilledSlotsevent filters (charge-backed events vs blocks, etc.).
References
- Attik-Field-Service-Solutions/attik-backend#499
- Attik-Field-Service-Solutions/attik-frontend#665
attik-frontend/src/components/dashboard/inspectorBalance/InspectorWorkBreakdown.tsxattik-backend/src/routes/dashboard.ts(GET /balance)attik-backend/src/util/functions/slots/calcFilledSlots.tsattik-backend/src/models/inspectorSchema.tsattik-frontend/src/app/tools/settings/inspectors/[id]/
Original description
Requested changes to the inspector balance widget to better support capacity planning, especially in larger markets:
- Add a gray bar showing total available capacity and fill in the scheduled portion so availability is visible even when nothing is scheduled in the selected date range.
- Add a daily view option. (done - last release)
- Show the total available count next to the inspector name or in a more visible manner (see notes below)
- Lower the team dropdown priority so a specific group of inspectors can be viewed instead of all inspectors at once.
Additional related context from duplicate reports:
- In narrow layouts, the Inspector Balance widget values become truncated or hard to read, and even after widening the window they may not fully re-render until the layout is much wider.
- At small sizes, text elements in the widget can overlap.
- A hover state or tooltip showing the full numeric value was suggested as a possible improvement.