feat: add update and delete functionality for courses, events, and species; enhance attendance tracking and category creation
Some checks failed
Workflow / ʦ TypeScript (push) Failing after 4m53s
Workflow / ⚫️ Test (push) Has been skipped

This commit is contained in:
T. Zehetbauer
2026-04-01 16:03:50 +02:00
parent 7b078f298b
commit c6b2824da8
48 changed files with 2036 additions and 390 deletions

View File

@@ -0,0 +1,49 @@
import { notFound } from 'next/navigation';
import { createFischereiApi } from '@kit/fischerei/api';
import {
FischereiTabNavigation,
CreateSpeciesForm,
} from '@kit/fischerei/components';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { AccountNotFound } from '~/components/account-not-found';
import { CmsPageShell } from '~/components/cms-page-shell';
interface Props {
params: Promise<{ account: string; speciesId: string }>;
}
export default async function EditSpeciesPage({ params }: Props) {
const { account, speciesId } = await params;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <AccountNotFound />;
const api = createFischereiApi(client);
let species;
try {
species = await api.getSpecies(speciesId);
} catch {
notFound();
}
return (
<CmsPageShell account={account} title="Fischart bearbeiten">
<FischereiTabNavigation account={account} activeTab="species" />
<CreateSpeciesForm
accountId={acct.id}
account={account}
species={species}
/>
</CmsPageShell>
);
}

View File

@@ -63,6 +63,7 @@ export default async function SpeciesPage({ params, searchParams }: Props) {
page={page}
pageSize={50}
account={account}
accountId={acct.id}
/>
</CmsPageShell>
);

View File

@@ -0,0 +1,67 @@
import { notFound } from 'next/navigation';
import { createFischereiApi } from '@kit/fischerei/api';
import {
FischereiTabNavigation,
CreateStockingForm,
} from '@kit/fischerei/components';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { AccountNotFound } from '~/components/account-not-found';
import { CmsPageShell } from '~/components/cms-page-shell';
interface Props {
params: Promise<{ account: string; stockingId: string }>;
}
export default async function EditStockingPage({ params }: Props) {
const { account, stockingId } = await params;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <AccountNotFound />;
const api = createFischereiApi(client);
let stocking;
try {
stocking = await api.getStocking(stockingId);
} catch {
notFound();
}
// Load waters and species lists for form dropdowns
const [watersResult, speciesResult] = await Promise.all([
api.listWaters(acct.id, { pageSize: 200 }),
api.listSpecies(acct.id, { pageSize: 200 }),
]);
const waters = watersResult.data.map((w: Record<string, unknown>) => ({
id: String(w.id),
name: String(w.name),
}));
const speciesList = speciesResult.data.map((s: Record<string, unknown>) => ({
id: String(s.id),
name: String(s.name),
}));
return (
<CmsPageShell account={account} title="Besatz bearbeiten">
<FischereiTabNavigation account={account} activeTab="stocking" />
<CreateStockingForm
accountId={acct.id}
account={account}
waters={waters}
species={speciesList}
stocking={stocking}
/>
</CmsPageShell>
);
}

View File

@@ -87,6 +87,7 @@ export default async function StockingPage({ params, searchParams }: Props) {
page={page}
pageSize={25}
account={account}
accountId={acct.id}
/>
</CmsPageShell>
);

View File

@@ -0,0 +1,45 @@
import { notFound } from 'next/navigation';
import { createFischereiApi } from '@kit/fischerei/api';
import {
FischereiTabNavigation,
CreateWaterForm,
} from '@kit/fischerei/components';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { AccountNotFound } from '~/components/account-not-found';
import { CmsPageShell } from '~/components/cms-page-shell';
interface Props {
params: Promise<{ account: string; waterId: string }>;
}
export default async function EditWaterPage({ params }: Props) {
const { account, waterId } = await params;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <AccountNotFound />;
const api = createFischereiApi(client);
let water;
try {
water = await api.getWater(waterId);
} catch {
notFound();
}
return (
<CmsPageShell account={account} title="Gewässer bearbeiten">
<FischereiTabNavigation account={account} activeTab="waters" />
<CreateWaterForm accountId={acct.id} account={account} water={water} />
</CmsPageShell>
);
}

View File

@@ -44,6 +44,7 @@ export default async function WatersPage({ params, searchParams }: Props) {
page={page}
pageSize={25}
account={account}
accountId={acct.id}
/>
</CmsPageShell>
);