feat: add update and delete functionality for courses, events, and species; enhance attendance tracking and category creation
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
@@ -63,6 +63,7 @@ export default async function SpeciesPage({ params, searchParams }: Props) {
|
||||
page={page}
|
||||
pageSize={50}
|
||||
account={account}
|
||||
accountId={acct.id}
|
||||
/>
|
||||
</CmsPageShell>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user