feat: add delete functionality for leases, catch books, and permits; implement newsletter update feature
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { createVerbandApi } from '@kit/verbandsverwaltung/api';
|
||||
import {
|
||||
VerbandTabNavigation,
|
||||
CreateClubForm,
|
||||
} from '@kit/verbandsverwaltung/components';
|
||||
|
||||
import { AccountNotFound } from '~/components/account-not-found';
|
||||
import { CmsPageShell } from '~/components/cms-page-shell';
|
||||
|
||||
interface Props {
|
||||
params: Promise<{ account: string; clubId: string }>;
|
||||
}
|
||||
|
||||
export default async function EditClubPage({ params }: Props) {
|
||||
const { account, clubId } = await params;
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const { data: acct } = await client
|
||||
.from('accounts')
|
||||
.select('id')
|
||||
.eq('slug', account)
|
||||
.single();
|
||||
|
||||
if (!acct) return <AccountNotFound />;
|
||||
|
||||
const api = createVerbandApi(client);
|
||||
const [club, types] = await Promise.all([
|
||||
api.getClub(clubId),
|
||||
api.listTypes(acct.id),
|
||||
]);
|
||||
|
||||
if (!club) return <AccountNotFound />;
|
||||
|
||||
return (
|
||||
<CmsPageShell
|
||||
account={account}
|
||||
title={`${String((club as Record<string, unknown>).name)} — Bearbeiten`}
|
||||
>
|
||||
<VerbandTabNavigation account={account} activeTab="clubs" />
|
||||
<CreateClubForm
|
||||
accountId={acct.id}
|
||||
account={account}
|
||||
types={types.map((t) => ({ id: t.id, name: t.name }))}
|
||||
club={club as Record<string, unknown>}
|
||||
/>
|
||||
</CmsPageShell>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,9 @@
|
||||
import Link from 'next/link';
|
||||
|
||||
import { Pencil } from 'lucide-react';
|
||||
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { Button } from '@kit/ui/button';
|
||||
import { createVerbandApi } from '@kit/verbandsverwaltung/api';
|
||||
import {
|
||||
VerbandTabNavigation,
|
||||
@@ -64,6 +69,12 @@ export default async function ClubDetailPage({ params }: Props) {
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<Button asChild variant="outline" size="sm">
|
||||
<Link href={`/home/${account}/verband/clubs/${clubId}/edit`}>
|
||||
<Pencil className="mr-2 h-4 w-4" />
|
||||
Bearbeiten
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Contacts */}
|
||||
|
||||
Reference in New Issue
Block a user