import Link from "next/link"; import { notFound } from "next/navigation"; import { BackLink } from "@/components/back-link"; import { AdminBadge } from "@/components/admin-list"; import { asStringArray } from "@/lib/json-array"; import { getLocale } from "@/i18n/locale"; import { getSponsorshipAdminStrings } from "@/i18n/sponsorship/admin"; import { updateSponsorshipOfferAction } from "@/app/admin/actions"; import { OfferForm } from "../../_components/offer-form"; import { getOfferOverview } from "../../_lib/offer-overview"; export default async function AdminSponsorshipOfferEditPage(props: PageProps<"/admin/patenschaften/angebote/[id]">) { const t = getSponsorshipAdminStrings(await getLocale()); const tf = t.offerForm; const { id } = await props.params; const { rows: [row], } = await getOfferOverview(id); if (!row) notFound(); const { offer, isAvailable, currentHoney, activeSubscriptions } = row; return (
{tf.stockLine(currentHoney.label, currentHoney.stock, currentHoney.reserved, currentHoney.free)}
) : offer.honeyJars > 0 ? ({tf.noEligibleHoney}
) : null} {offer.kind === "ABO" ? ({tf.activeSubscriptions(activeSubscriptions, offer.maxActiveSubscriptions)}
) : null} {offer.kind === "ABO" && offer.cycle === "ERNTE" ? ( {t.offers.harvestWindows} → ) : null}