feat: add linear booking workflow — Новая → Связались → Подтверждено/Отказ

- Add status + confirmed_date columns to group_bookings (migration #10)
- Linear flow: Новая shows "Связались →", Связались shows date picker + "Отказ"
- Date picker for confirmation allows only today and future dates
- Confirmed bookings show the scheduled date
- Filter chips: Все / Новая / Связались / Подтверждено / Отказ with counts
- Declined bookings sorted to bottom of list
- "Сбросить" button on confirmed/declined to restart flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-19 17:14:51 +03:00
parent e4a9b71bfe
commit 0ec2361a16
3 changed files with 190 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from "next/server";
import { getGroupBookings, toggleGroupBookingNotification, deleteGroupBooking } from "@/lib/db";
import { getGroupBookings, toggleGroupBookingNotification, deleteGroupBooking, setGroupBookingStatus } from "@/lib/db";
import type { BookingStatus } from "@/lib/db";
export async function GET() {
const bookings = getGroupBookings();
@@ -22,6 +23,15 @@ export async function PUT(request: NextRequest) {
toggleGroupBookingNotification(id, field, value);
return NextResponse.json({ ok: true });
}
if (body.action === "set-status") {
const { id, status, confirmedDate } = body;
const valid: BookingStatus[] = ["new", "contacted", "confirmed", "declined"];
if (!id || !valid.includes(status)) {
return NextResponse.json({ error: "id and valid status are required" }, { status: 400 });
}
setGroupBookingStatus(id, status, confirmedDate);
return NextResponse.json({ ok: true });
}
return NextResponse.json({ error: "Unknown action" }, { status: 400 });
} catch (err) {
console.error("[admin/group-bookings] error:", err);