Show remaining inspection slots per day on calendar

Objective

  • Show a day-level count of remaining inspection slots directly in the master calendar header so schedulers and client care leaders can assess daily capacity without leaving the calendar.
  • Keep the count aligned with the way the calendar currently determines slot availability, not with the separate Inspector Balance widget calculation.
  • Surface a single remaining-slot total per visible day column for the current filtered calendar view, not a per-inspector breakdown.

Background

  • Schedulers and client care leaders want to see remaining inspection capacity where they are already making scheduling decisions: the master calendar.
  • The preferred output is a lightweight daily tally at the top of each day/date column so teams can quickly judge whether to open more slots, shift coverage, or push to fill remaining availability.
  • The current calendar and Inspector Balance widget do not calculate availability the same way, so this work needs to explicitly choose one source of truth.
  • Product direction from this chat is that the new calendar tally should follow calendar slot availability rules, not Inspector Balance rules.
  • Current backend review confirms a real behavior gap:
  • GET /calendar in attik-backend/src/routes/calendar.ts builds visible slot availability from historic slots + synthetic slots and removes availability based on the calendar availability path.
  • GET /dashboard/balance in attik-backend/src/routes/dashboard.ts uses a different capacity model built from calcAvailableSlots.ts and calcFilledSlots.ts.
  • Those two paths diverge in important ways today:
  • the calendar path applies recurring calendar events
  • the Inspector Balance path currently does not
  • the Inspector Balance path counts inspections and events with a _chargeId as consumed capacity
  • the calendar path is the closer match for “what is actually available to schedule in this view”
  • For this feature, the day header count should represent the number of remaining inspection slots using the same calendar slot availability rules as the visible calendar, so users do not see one number in the header and a contradictory view in the schedule below.
  • Product decisions confirmed in this chat:
  • the count should respect exact active calendar filters
  • it should represent capacity in the filtered view, not a company-wide total outside the current view
  • temporary slots should count
  • events-only technicians should only contribute if they have qualifying slot-based capacity
  • overbooked / negative results should use a zero floor

Scope

Frontend

The master calendar entry points live in attik-frontend/src/app/tools/calendar/MasterCalendar.tsx and attik-frontend/src/components/calendar/CalendarBase.tsx, which fetch calendar data for the visible range and active filters. The day-column header UI is rendered in attik-frontend/src/components/calendar/CalendarHeader.tsx, which is the natural place to display a remaining-slot total for each visible day.

This work should:

  • show one remaining-slot total per visible day column
  • update that total when the visible date range changes
  • update that total when the active calendar filters change
  • keep the output lightweight and header-level only

The count should follow the same filtered view the user is looking at. If the calendar is narrowed by team, service, or other supported filters, the daily total should narrow with it rather than showing a broader company-wide number.

Out of scope for this first version:

  • per-inspector breakdowns in the calendar header
  • turning the calendar header into a second Inspector Balance widget
  • mobile-specific work unless it is already required by the master calendar surface

Backend

Calendar availability currently comes from attik-backend/src/routes/calendar.ts. That path builds slot availability from historic and synthetic slots and applies the calendar-specific availability logic. Inspector Balance logic lives separately in attik-backend/src/routes/dashboard.ts using attik-backend/src/util/functions/slots/calcAvailableSlots.ts and attik-backend/src/util/functions/slots/calcFilledSlots.ts.

This feature should use calendar slot availability rules as the source of truth for the day totals.

In practical terms, the daily tally should be based on the slots that remain available in the calendar path after the current calendar availability rules are applied, rather than reusing the Inspector Balance calculation. That matters because the two systems currently diverge, especially around recurring calendar events and the way consumed capacity is modeled.

The implementation may either:

  1. aggregate the existing calendar slot availability data into per-day remaining totals, or
  2. extend the calendar API response to provide those per-day totals directly

The implementation should preserve these product rules:

  • count only capacity represented in the current filtered calendar view
  • include temporary/manual historic slots
  • include events-only technicians only when they have qualifying slot-based capacity
  • floor the displayed daily total at zero

Definition of remaining slot for this feature

For this issue, a “remaining inspection slot” means a slot that is still available according to the calendar availability path, not according to the Inspector Balance widget’s utilization/capacity math.

This is an intentional product choice for consistency with the calendar surface.

Done when

  • Each visible day column on the master calendar shows a remaining inspection slot count in the header area.
  • The count follows the same calendar slot availability rules as the visible calendar.
  • The count respects exact active calendar filters.
  • Temporary slots are included.
  • Events-only technicians contribute only when they have qualifying slot-based capacity.
  • Displayed totals floor at zero rather than showing negative availability.
  • Users can assess daily scheduling capacity directly from the calendar without opening the Inspector Balance widget.

References

  • attik-frontend/src/app/tools/calendar/MasterCalendar.tsx
  • attik-frontend/src/components/calendar/CalendarBase.tsx
  • attik-frontend/src/components/calendar/CalendarHeader.tsx
  • attik-frontend/src/components/calendar/CalendarFilterPopover.tsx
  • attik-backend/src/routes/calendar.ts
  • attik-backend/src/routes/dashboard.ts
  • attik-backend/src/util/functions/slots/calcAvailableSlots.ts
  • attik-backend/src/util/functions/slots/calcFilledSlots.ts
  • attik-backend/src/util/functions/slots/createSyntheticSlotArrayForDateRange.ts

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
🏠

Main App

Date

1 day ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.