4 Commits (f450c83c4e14d523ddfd715aa76b3244027eaad5)

Author SHA1 Message Date
Guillermo Pages f450c83c4e revert: restore preset field name (Backend reverted breaking change)
continuous-integration/drone/push Build is passing Details
Backend Brooke reverted the breaking change from BUILD:347. The generate
endpoint continues to use "preset" field name, not "pattern_type".

This reverts commit 834e1a8 and restores the original API contract.

Changes:
- Reverted GenerateSlotDefinitionsRequest: pattern_type → preset
- Reverted GenerateSlotDefinitionsModal to send preset in request body

Backend BUILD:348 has restored the original "preset" field.
1 month ago
Guillermo Pages 834e1a8195 fix: rename preset to pattern_type in generate request (BREAKING CHANGE)
continuous-integration/drone/push Build is passing Details
Backend API changed field name from "preset" to "pattern_type" in the
generate slot definitions endpoint (BUILD:347).

Changes:
- Updated GenerateSlotDefinitionsRequest interface: preset → pattern_type
- Updated GenerateSlotDefinitionsModal to send pattern_type in request body

This fixes compatibility with the updated backend API contract.
1 month ago
Guillermo Pages 9c802ea2aa feat: migrate admin API clients to send locale/timezone headers
continuous-integration/drone/push Build is passing Details
Migrated all admin API clients to automatically send X-Locale and X-Timezone headers
with every request for proper internationalization and timezone-aware operations.

Changes:
- Migrated slot-definitions.ts, materialisation.ts, courts.ts, booking-admin.ts to use apiFetch utility
- Added getLocaleHeaders() helper to admin-clubs.ts for SSR compatibility
- Added getSlotDefinitionPresets() endpoint to fetch localized preset metadata
- Updated slot-definitions types to support API-based preset loading
- Refactored GenerateSlotDefinitionsModal to fetch presets from API with localized titles/descriptions

Benefits:
- All API requests now include user's locale (e.g., en-US, fr-CH) for i18n
- Timezone-aware operations use browser's Intl.DateTimeFormat timezone
- Preset titles and descriptions are localized per user language
- Consistent header management across all admin endpoints

Technical Details:
- apiFetch extracts locale from URL pathname via getPathnameLocale()
- apiFetch automatically adds credentials: 'include' for session auth
- admin-clubs.ts uses manual headers for SSR cookie forwarding compatibility
- GenerateSlotDefinitionsModal shows loading state while fetching presets
1 month ago
Guillermo Pages 1ebe61fa40 feat: add Generate and Clone UI for slot definitions
continuous-integration/drone/push Build is passing Details
Built complete bulk operations UI for slot definitions based on Backend Brooke's spec (BUILD:345).

New Components:
- GenerateSlotDefinitionsModal (380 lines)
  - Preset selector with 4 options (workday_standard, weekend_extended, all_week_uniform, hourly_daytime)
  - Court multi-select with Select All
  - Validity date pickers (optional)
  - Advanced pattern overrides (collapsible): custom days, time range, duration, interval, capacity
  - Real-time validation and error handling

- CloneSlotDefinitionModal (280 lines)
  - Source definition display with full details
  - Target courts multi-select
  - Target days multi-select (pre-selected source day)
  - Validity date overrides (optional)
  - Preview of estimated clone count

Integration:
- Added Generate button (blue, magic wand icon) to page header
- Added Clone button (blue copy icon) to each table row
- Wired up modals with success callbacks to reload data
- Success callbacks trigger table refresh

Features:
- All modals use professional slate theme
- Loading states with spinners
- Error display with user-friendly messages
- Form validation before submission
- Modal backdrop dismissal

Ready for testing against staging (BUILD:345).
1 month ago