feat: add status workflow to MC and Open Day bookings, refactor into separate files

- DB migration v12: add status column to mc_registrations and open_day_bookings
- MC and Open Day tabs now have full status workflow (new → contacted → confirmed/declined)
- Filter tabs with counts, status badges, action buttons matching group bookings
- Extract shared components (_shared.tsx): FilterTabs, StatusBadge, StatusActions, BookingCard, ContactLinks
- Split monolith into _McRegistrationsTab.tsx, _OpenDayBookingsTab.tsx, _shared.tsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 19:05:44 +03:00
parent 575c684cc5
commit b906216317
7 changed files with 501 additions and 294 deletions

View File

@@ -3,6 +3,7 @@ import {
getOpenDayBookings,
toggleOpenDayNotification,
deleteOpenDayBooking,
setOpenDayBookingStatus,
} from "@/lib/db";
export async function GET(request: NextRequest) {
@@ -16,6 +17,15 @@ export async function GET(request: NextRequest) {
export async function PUT(request: NextRequest) {
try {
const body = await request.json();
if (body.action === "set-status") {
const { id, status } = body;
if (!id || !status) return NextResponse.json({ error: "id, status required" }, { status: 400 });
if (!["new", "contacted", "confirmed", "declined"].includes(status)) {
return NextResponse.json({ error: "Invalid status" }, { status: 400 });
}
setOpenDayBookingStatus(id, status);
return NextResponse.json({ ok: true });
}
if (body.action === "toggle-notify") {
const { id, field, value } = body;
if (!id || !field || typeof value !== "boolean") {