feat: booking panel upgrade — refactor, notes, search, manual add, polling

Phase 1 — Refactor:
- Split monolith _shared.tsx into types.ts, BookingComponents, InlineNotes,
  GenericBookingsList, AddBookingModal, SearchBar (no more _ prefix)
- All 3 tabs use GenericBookingsList — shared status workflow, filters, archive

Phase 2 — Features:
- DB migration 13: add notes column to all booking tables
- Inline notes with amber highlight, auto-save 800ms debounce
- Confirm modal comment saves to notes field
- Manual add: 2 tabs (Занятие / Мероприятие), filters expired MCs, Open Day support
- Search bar: cross-table search by name/phone
- 10s polling for real-time updates (bookings page + sidebar badge)
- Status change marks booking as seen (fixes unread count on reset)
- Confirm modal stores human-readable group label instead of raw groupId
- Confirmed group bookings appear in Reminders tab

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-24 13:34:16 +03:00
parent 87f488e2c1
commit c87c63bc4f
18 changed files with 1055 additions and 664 deletions

View File

@@ -4,6 +4,7 @@ import {
toggleOpenDayNotification,
deleteOpenDayBooking,
setOpenDayBookingStatus,
updateBookingNotes,
} from "@/lib/db";
export async function GET(request: NextRequest) {
@@ -26,6 +27,12 @@ export async function PUT(request: NextRequest) {
setOpenDayBookingStatus(id, status);
return NextResponse.json({ ok: true });
}
if (body.action === "set-notes") {
const { id, notes } = body;
if (!id) return NextResponse.json({ error: "id is required" }, { status: 400 });
updateBookingNotes("open_day_bookings", id, notes ?? "");
return NextResponse.json({ ok: true });
}
if (body.action === "toggle-notify") {
const { id, field, value } = body;
if (!id || !field || typeof value !== "boolean") {