Admin slots: a slot held in a basket reads 'In a basket', not 'Full'

'Full' is now only for a group session filled by paid bookings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VaXE9U7AmW3dfD2w6cbLfk
This commit is contained in:
agent 2026-10-24 09:32:56 +00:00
parent 214db95186
commit 28773f2599

View file

@ -5,7 +5,7 @@
// the site's timezone; they become UTC instants only at the very end, via // the site's timezone; they become UTC instants only at the very end, via
// zonedInputToIso, so a run across a DST change still starts at 09:00. // zonedInputToIso, so a run across a DST change still starts at 09:00.
import { toZonedDatetimeInput, zonedInputToIso } from './calendar'; import { DISPLAY_LOCALE, toZonedDatetimeInput, zonedInputToIso } from './calendar';
/** A stretch of the day in which appointments may start and end, e.g. 09:00–12:00. */ /** A stretch of the day in which appointments may start and end, e.g. 09:00–12:00. */
export type TimeWindow = { from: string; to: string }; export type TimeWindow = { from: string; to: string };
@ -69,8 +69,13 @@ export const SLOT_STATE_LABELS: Record<SlotState, string> = {
blocked: 'Blocked' blocked: 'Blocked'
}; };
/**
* `full` only when paid bookings fill a group; a slot whose last places are
* in baskets reads `held`, since it frees up again if those holds lapse.
*/
export function slotState(slot: Pick<SlotDetail, 'booked' | 'held' | 'capacity' | 'blockedBy'>): SlotState { export function slotState(slot: Pick<SlotDetail, 'booked' | 'held' | 'capacity' | 'blockedBy'>): SlotState {
if (slot.booked + slot.held >= slot.capacity) return 'full'; if (slot.booked >= slot.capacity) return slot.capacity > 1 ? 'full' : 'booked';
if (slot.held && slot.booked + slot.held >= slot.capacity) return 'held';
if (slot.booked) return 'booked'; if (slot.booked) return 'booked';
if (slot.held) return 'held'; if (slot.held) return 'held';
return slot.blockedBy ? 'blocked' : 'free'; return slot.blockedBy ? 'blocked' : 'free';
@ -143,7 +148,7 @@ export function addMonthsToKey(month: string, months: number) {
/** Format a date key with fixed locale (SSR and browser agree), e.g. "Tuesday 3 November". */ /** Format a date key with fixed locale (SSR and browser agree), e.g. "Tuesday 3 November". */
export function formatDateKey(key: string, options: Intl.DateTimeFormatOptions) { export function formatDateKey(key: string, options: Intl.DateTimeFormatOptions) {
const ms = keyToUtcMs(key); const ms = keyToUtcMs(key);
return ms === null ? '' : new Intl.DateTimeFormat('en-GB', { ...options, timeZone: 'UTC' }).format(ms); return ms === null ? '' : new Intl.DateTimeFormat(DISPLAY_LOCALE, { ...options, timeZone: 'UTC' }).format(ms);
} }
/** `09:30` → 570, or null. */ /** `09:30` → 570, or null. */