Skip to content

Scheduler & Calendar Module

Scheduler & Calendar Module

The Scheduler & Calendar module (lib/features/scheduler/) provides an end-to-end appointment booking and team calendar management ecosystem. It combines internal multi-user scheduling with public booking pages, custom white-label branding, and external calendar integrations.


Component Overview

graph TD
    UnifiedCal[UnifiedCalendarScreen] --> CalService[CalendarService]
    CalService --> SupaCal[(Supabase 'events' Table)]
    CalService -.-> GoogleCal[Google Calendar Sync]

    SchedList[ListOfSchedulersScreen] --> SchedAPI[SchedulerApiService]
    SchedAPI --> PublicLink[Public Booking Link Generator]
    
    Bookings[SchedulerBookingsScreen] --> SchedAPI
    NewTask[NoweZadanieScreen] --> CalService
    Branding[KonfiguracjeBrandingScreen] --> SchedAPI

Screen Reference

1. Unified Calendar (unified_calendar_screen.dart)

  • Purpose: Centralized multi-view schedule aggregating member appointments, cooperative general assemblies, field technician assignments, and personal reminders.
  • Views: Powered by table_calendar with Month, Two-Week, Single Week, and Agenda day layouts.
  • Filtering: Filter events by category (e.g. energy_maintenance, client_meeting, governance_vote, general).

2. Schedulers & Booking Engine (list_of_schedulers_screen.dart & scheduler_bookings_screen.dart)

  • Purpose: Allows team members to define availability rules (e.g., “Monday - Thursday 09:00 - 16:00, 45-minute slots with 15-minute buffers”).
  • Public Booking URLs: Generates unique public URLs that clients or cooperative applicants can visit without requiring an account.
  • Automatic Conflict Detection: Intersects booking requests with active calendar entries to prevent double-booking.

3. White-Label Branding (konfiguracjebranding_screen.dart)

  • Purpose: Enables organizations and cooperatives to customize the aesthetic appearance of their public booking pages.
  • Configurable Attributes:
    • Brand logo upload (stored in Supabase Storage bucket branding-assets).
    • Primary and accent hex color palettes.
    • Custom welcome headline, company description, and cancellation policy text.
    • Custom subdomain or embed code.

4. Task / Appointment Creation (nowe_zadanie_screen.dart)

  • Purpose: Comprehensive modal dialog for creating events with participant invitations, reminders, recurrent schedules, and location coordinates.

Edge Function & Automated Reminders

The Scheduler coordinates with two serverless edge functions:

  1. run-scheduler: Triggered via cron to process upcoming booking transitions and clean up expired pending reservations.
  2. reminder-scheduler: Scans for appointments within notification thresholds (e.g. 24 hours and 1 hour before scheduled time) and dispatches email/push reminders.