import Link from "next/link"; import { redirect } from "next/navigation"; import { getServerSession } from "next-auth"; import { CalendarDays, MapPin } from "lucide-react"; import { authOptions } from "@/lib/auth"; import { isAdminEmail } from "@/lib/admin"; import { tripRepo } from "@/server/repositories/trip.repo"; import { formatRupiah } from "@/lib/utils"; import { formatTripCalendarDateRangeLong } from "@/lib/trip-dates"; import { categoryMeta } from "@/lib/activity-category"; type Tab = "ALL" | "OPEN" | "FULL" | "CLOSED" | "COMPLETED"; const TABS: { key: Tab; label: string }[] = [ { key: "ALL", label: "Semua" }, { key: "OPEN", label: "Open" }, { key: "FULL", label: "Penuh" }, { key: "CLOSED", label: "Dibatalkan" }, { key: "COMPLETED", label: "Selesai" }, ]; interface PageProps { searchParams: Promise<{ tab?: string; q?: string }>; } export default async function AdminTripsPage({ searchParams }: PageProps) { const session = await getServerSession(authOptions); if (!session?.user) redirect("/login?callbackUrl=/admin/trips"); if (!isAdminEmail(session.user.email)) { return (
Halaman ini hanya untuk admin SeTrip.
Cari trip, lihat detail, dan intervensi (cancel + auto-refund) saat organizer unreachable.
{q ? `Tidak ada trip yang cocok dengan "${q}".` : "Tidak ada trip pada status ini."}
Organizer:{" "} {t.organizer.name} {" "} ({t.organizer.email})
{formatRupiah(t.price)}
{t._count.participants}/{t.maxParticipants} peserta
{t._count.bookings} PAID