refactor: move status filter from per-tab pills to global search bar

- Remove FilterTabs from inside each booking tab
- Add compact status chips (Все/Новая/Связались/Подтверждено/Отказ)
  below the search bar — one global filter for all tabs
- Filter chips hidden during active text search
- Status filter toggles on click (click again to deselect)
- GenericBookingsList accepts filter as prop instead of managing internally
This commit is contained in:
2026-03-24 17:15:47 +03:00
parent 057f1ff1ee
commit 49d710b2e7
5 changed files with 77 additions and 49 deletions

View File

@@ -2,7 +2,7 @@
import { useState, useEffect, useMemo } from "react";
import { adminFetch } from "@/lib/csrf";
import { type BaseBooking, type BookingGroup } from "./types";
import { type BookingFilter, type BaseBooking, type BookingGroup } from "./types";
import { LoadingSpinner } from "./BookingComponents";
import { GenericBookingsList } from "./GenericBookingsList";
@@ -13,7 +13,7 @@ interface McRegistration extends BaseBooking {
interface McSlot { date: string; startTime: string }
interface McItem { title: string; slots: McSlot[] }
export function McRegistrationsTab() {
export function McRegistrationsTab({ filter }: { filter: BookingFilter }) {
const [regs, setRegs] = useState<McRegistration[]>([]);
const [mcDates, setMcDates] = useState<Record<string, string>>({});
const [loading, setLoading] = useState(true);
@@ -73,6 +73,7 @@ export function McRegistrationsTab() {
<GenericBookingsList<McRegistration>
items={regs}
endpoint="/api/admin/mc-registrations"
filter={filter}
onItemsChange={setRegs}
groups={groups}
/>