import { prisma } from "@/lib/prisma"; import { BackLink } from "@/components/back-link"; import { ConfirmForm } from "@/components/confirm-form"; import { formatDate } from "@/lib/format"; import { Button } from "@/components/ui"; import { AdminField, AdminSelect } from "@/components/admin-form"; import { AdminActionButton, AdminActionLink, AdminActionNote, AdminEmptyState, AdminPageHeader, AdminRowActions, } from "@/components/admin-list"; import { createBatchAction, deleteBatchAction } from "../actions"; import { getLocale } from "@/i18n/locale"; import { getDictionary } from "@/i18n/get-dictionary"; export default async function AdminBatchesPage() { const t = getDictionary(await getLocale()); const [batches, harvests] = await Promise.all([ prisma.batch.findMany({ orderBy: { fillDate: "desc" }, include: { harvest: true, _count: { select: { products: true, orderItems: true } } }, }), prisma.harvest.findMany({ orderBy: [{ year: "desc" }] }), ]); return (
| {t.adminBatchesPage.colBatch} | {t.adminBatchesPage.colHarvest} | {t.adminBatchesPage.colFillDate} | {t.adminBatchesPage.colBestBefore} | {t.adminBatchesPage.colTotalGlasses} | {t.adminBatchesPage.colRemaining} | |
|---|---|---|---|---|---|---|
| {batch.code} | {batch.harvest.type} {batch.harvest.year} | {formatDate(batch.fillDate)} | {formatDate(batch.bestBeforeDate)} | {batch.glassCount} | {batch.remainingGlasses} |
|