"use client"; import { useState, useEffect, useMemo, useCallback, useRef } from "react"; import { Plus, X, Loader2, Calendar, Trash2, Ban, CheckCircle2, RotateCcw, Sparkles, } from "lucide-react"; import { adminFetch } from "@/lib/csrf"; import { ParticipantLimits, SelectField } from "../_components/FormField"; // --- Types --- interface OpenDayEvent { id: number; date: string; title: string; description?: string; pricePerClass: number; discountPrice: number; discountThreshold: number; minBookings: number; maxParticipants: number; active: boolean; } interface OpenDayClass { id: number; eventId: number; hall: string; startTime: string; endTime: string; trainer: string; style: string; cancelled: boolean; sortOrder: number; bookingCount: number; maxParticipants: number; } // --- Helpers --- function generateTimeSlots(startHour: number, endHour: number): string[] { const slots: string[] = []; for (let h = startHour; h < endHour; h++) { slots.push(`${h.toString().padStart(2, "0")}:00`); } return slots; } function addHour(time: string): string { const [h, m] = time.split(":").map(Number); return `${(h + 1).toString().padStart(2, "0")}:${m.toString().padStart(2, "0")}`; } // --- Event Settings --- function EventSettings({ event, onChange, }: { event: OpenDayEvent; onChange: (patch: Partial) => void; }) { return (

Настройки мероприятия

onChange({ title: e.target.value })} className="w-full rounded-lg border border-white/10 bg-neutral-800 px-4 py-2.5 text-white placeholder-neutral-500 outline-none focus:border-gold transition-colors" />
onChange({ date: e.target.value })} className="w-full rounded-lg border border-white/10 bg-neutral-800 px-4 py-2.5 text-white outline-none focus:border-gold transition-colors [color-scheme:dark]" />