Skip to content

Owner-facing calendar booking with fixed time slots #66

Description

@robert197

Context

First customer feedback (2026-04-01): Owners need a calendar to book inspection appointments themselves. Currently scheduling is admin-only via Django Admin.

Customer requirement: "Ich brauche auch einen Kalender, dass die die Termine buchen kann — von 8 bis 16:00 Uhr, drei Termine pro Tag, sieben Tage die Woche."

Current State

  • Scheduling is admin-driven only (Django Admin form)
  • Business hours: 8:00-18:00 (model constant)
  • No owner-facing booking UI
  • Inspector schedule view exists (list-based)
  • Issue Build inspection scheduling system #27 covers admin scheduling (mostly complete)

Requirements

Time Slot System

  • Business hours: 08:00–16:00 (changed from 18:00)
  • 3 fixed slots per day:
    • Vormittag: 08:00–10:30
    • Mittag: 10:30–13:00
    • Nachmittag: 13:30–16:00
  • 7 days/week (including weekends)
  • Each slot can hold one inspection per inspector

Owner Booking Flow (Dashboard)

  1. Owner navigates to "Termin buchen" in dashboard
  2. Sees a weekly calendar view with available slots
  3. Selects apartment (if multiple)
  4. Picks an available slot (green = available, gray = full, red = past)
  5. Confirms booking → Inspection created with status SCHEDULED
  6. Admin assigns inspector (or auto-assign in v2)
  7. Owner sees confirmation + upcoming inspections

Calendar UI

  • HTMX-powered weekly calendar (no heavy JS calendar library)
  • Mobile-first (owners may book from phone)
  • Week navigation (previous/next week)
  • Slot availability shown per day
  • Subscription limit indicator ("2/4 Inspektionen diesen Monat gebucht")

Availability Logic

  • Slot is "available" if at least one inspector is free during that window
  • Slot is "full" if all inspectors are booked
  • Past slots are not bookable
  • Subscription limit prevents booking beyond plan allowance
  • Same apartment cannot have two inspections on the same day

Backend Changes

Model Updates (apps/inspections/models.py)

  • Change BUSINESS_HOURS_END from 18 to 16
  • Add TimeSlot choices or helper (MORNING, MIDDAY, AFTERNOON)
  • Add time_slot field to Inspection (optional, for slot-based bookings)

New View (apps/dashboard/views.py)

  • booking_calendar — renders weekly calendar with slot availability
  • book_slot — HTMX endpoint to create inspection from slot selection
  • Enforce subscription limits in view

Templates

  • templates/dashboard/booking_calendar.html — weekly grid
  • templates/dashboard/_calendar_week.html — HTMX partial for week navigation
  • templates/dashboard/_slot.html — individual slot component

URL Routes

  • /dashboard/buchen/ — calendar view
  • /dashboard/buchen/slot/ — HTMX book slot endpoint

Validation

  • Subscription monthly limit enforced
  • No double-booking same apartment same day
  • Cannot book in the past
  • Cannot book without active subscription

Tests

  • Slot availability calculation
  • Booking within subscription limits
  • Booking past date rejection
  • Same-day duplicate rejection
  • Week navigation
  • Integration test: full booking flow

Dependencies

Out of Scope (v2)

Source

Customer feedback, 2026-04-01

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions