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,56 @@
import { createEventManagementApi } from '@kit/event-management/api';
import { CreateEventForm } from '@kit/event-management/components';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { AccountNotFound } from '~/components/account-not-found';
import { CmsPageShell } from '~/components/cms-page-shell';
interface PageProps {
params: Promise<{ account: string; eventId: string }>;
}
export default async function EditEventPage({ params }: PageProps) {
const { account, eventId } = await params;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <AccountNotFound />;
const api = createEventManagementApi(client);
const event = await api.getEvent(eventId);
if (!event) return <AccountNotFound />;
const e = event as Record<string, unknown>;
return (
<CmsPageShell account={account} title={`${String(e.name)} — Bearbeiten`}>
<CreateEventForm
accountId={acct.id}
account={account}
eventId={eventId}
initialData={{
name: String(e.name ?? ''),
description: String(e.description ?? ''),
eventDate: String(e.event_date ?? ''),
eventTime: String(e.event_time ?? ''),
endDate: String(e.end_date ?? ''),
location: String(e.location ?? ''),
capacity: e.capacity != null ? Number(e.capacity) : undefined,
minAge: e.min_age != null ? Number(e.min_age) : undefined,
maxAge: e.max_age != null ? Number(e.max_age) : undefined,
fee: Number(e.fee ?? 0),
status: String(e.status ?? 'planned'),
registrationDeadline: String(e.registration_deadline ?? ''),
contactName: String(e.contact_name ?? ''),
contactEmail: String(e.contact_email ?? ''),
contactPhone: String(e.contact_phone ?? ''),
}}
/>
</CmsPageShell>
);
}