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, AdminSwitch, AdminTextarea } from "@/components/admin-form"; import { AdminActionButton, AdminActionLink, AdminActionNote, AdminBadge, AdminEmptyState, AdminPageHeader, AdminRowActions, } from "@/components/admin-list"; import { createHarvestAction, toggleHarvestPublishedAction, deleteHarvestAction } from "../actions"; import { getLocale } from "@/i18n/locale"; import { getDictionary } from "@/i18n/get-dictionary"; export default async function AdminHarvestsPage() { const t = getDictionary(await getLocale()); const harvests = await prisma.harvest.findMany({ orderBy: [{ year: "desc" }, { harvestDate: "desc" }], include: { _count: { select: { batches: true, products: true } } }, }); return (
| {t.adminHarvestsPage.colType} | {t.adminHarvestsPage.colYear} | {t.adminHarvestsPage.colHarvestDate} | {t.adminHarvestsPage.colLocation} | {t.adminHarvestsPage.colBatches} | {t.adminHarvestsPage.colProducts} | {t.adminHarvestsPage.colStatus} | |
|---|---|---|---|---|---|---|---|
| {harvest.type} | {harvest.year} | {formatDate(harvest.harvestDate)} | {harvest.location} | {harvest._count.batches} | {harvest._count.products} |
{harvest.isPublished ? (
|
|