import { prisma } from "@/lib/prisma";
import CustomOrdersTabs from "@/components/admin/CustomOrdersTabs";
import CustomOrderTable from "@/components/admin/CustomOrderTable";

export default async function AdminReadyToDispatchPage() {
  const requests = await prisma.customOrderRequest.findMany({
    where: { status: "ready_to_dispatch" },
    orderBy: { createdAt: "asc" },
  });

  return (
    <div>
      <h1 className="font-[family-name:var(--font-heading)] text-2xl font-bold text-stone-800">Ready to Dispatch</h1>
      <p className="mt-1 text-sm text-stone-500">Finished custom orders waiting to be shipped.</p>

      <CustomOrdersTabs active="/iv-manage-84x2/custom-orders/ready-to-dispatch" />

      <CustomOrderTable requests={requests} returnTo="/iv-manage-84x2/custom-orders/ready-to-dispatch" />
    </div>
  );
}
