feat: Patenschafts-Honig automatisch waehlen (nie cremig, neueste Ernte)
Docker Image bauen und veroeffentlichen / typecheck (push) Successful in 2m18s
Docker Image bauen und veroeffentlichen / test (push) Successful in 5m32s
Docker Image bauen und veroeffentlichen / lint (push) Successful in 3m41s
Docker Image bauen und veroeffentlichen / build-and-push (push) Canceled after 20m38s

Pakete, Abo-Reservierung und Abo-Lieferungen nehmen immer den aktiven,
nicht cremigen Honig der neuesten Ernte mit genug freiem Bestand, bei
gleichem Jahrgang den mit dem meisten Bestand. Feste Honig-Zuordnung
im Admin entfaellt (Spalte bleibt, wird nicht mehr genutzt).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick.RosenloecherandClaude Opus 5.5 committed 2026-10-16 18:35:04 +02:00
1 parent 3ddf0bfa73
commit 1d88bac52e
30 files changed
+1152 -394

No files matched your search

@@ -7,16 +7,17 @@ import { getLocale } from "@/i18n/locale";
import { getSponsorshipAdminStrings } from "@/i18n/sponsorship/admin";
import { updateSponsorshipOfferAction } from "@/app/admin/actions";
import { OfferForm } from "../../_components/offer-form";
import { getHoneyProductOptions, getOfferOverview } from "../../_lib/offer-overview";
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 [row] = await getOfferOverview(id);
const {
rows: [row],
} = await getOfferOverview(id);
if (!row) notFound();
const { offer, isAvailable, honeyStock, activeSubscriptions } = row;
const honeyOptions = await getHoneyProductOptions(offer.honeyProductId);
const { offer, isAvailable, currentHoney, activeSubscriptions } = row;
return (
<div className="max-w-3xl">
@@ -30,8 +31,12 @@ export default async function AdminSponsorshipOfferEditPage(props: PageProps<"/a
<AdminBadge tone={isAvailable ? "positive" : "pending"}>{isAvailable ? t.offers.available : t.offers.unavailable}</AdminBadge>
<span className="text-sm text-ink/75">{isAvailable ? tf.availableNow : tf.unavailableNow}</span>
</div>
{honeyStock ? (
<p className="mt-3 text-sm tabular-nums text-ink/75">{tf.stockLine(honeyStock.stock, honeyStock.reserved, honeyStock.free)}</p>
{currentHoney ? (
<p className="mt-3 text-sm tabular-nums text-ink/75">
{tf.stockLine(currentHoney.label, currentHoney.stock, currentHoney.reserved, currentHoney.free)}
</p>
) : offer.honeyJars > 0 ? (
<p className="mt-3 text-sm text-ink/75">{tf.noEligibleHoney}</p>
) : null}
{offer.kind === "ABO" ? (
<p className="mt-1 text-sm tabular-nums text-ink/75">{tf.activeSubscriptions(activeSubscriptions, offer.maxActiveSubscriptions)}</p>
@@ -45,7 +50,7 @@ export default async function AdminSponsorshipOfferEditPage(props: PageProps<"/a
<OfferForm
isNew={false}
honeyOptions={honeyOptions}
currentHoneyLabel={currentHoney?.label ?? null}
action={updateSponsorshipOfferAction}
t={t}
defaults={{
@@ -64,7 +69,6 @@ export default async function AdminSponsorshipOfferEditPage(props: PageProps<"/a
isActive: offer.isActive,
isPhysical: offer.isPhysical,
sortOrder: offer.sortOrder,
honeyProductId: offer.honeyProductId,
honeyJars: offer.honeyJars,
cycle: offer.cycle,
maxActiveSubscriptions: offer.maxActiveSubscriptions,