48 lines
1.4 KiB
TypeScript
48 lines
1.4 KiB
TypeScript
import { createFischereiApi } from '@kit/fischerei/api';
|
|
import {
|
|
FischereiTabNavigation,
|
|
PermitsDataTable,
|
|
} 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 }>;
|
|
}
|
|
|
|
export default async function PermitsPage({ params }: Props) {
|
|
const { account } = 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);
|
|
const permits = await api.listPermits(acct.id);
|
|
|
|
return (
|
|
<CmsPageShell account={account} title="Fischerei - Erlaubnisscheine">
|
|
<FischereiTabNavigation account={account} activeTab="permits" />
|
|
<div className="flex w-full flex-col gap-6">
|
|
<div>
|
|
<h1 className="text-2xl font-bold">Erlaubnisscheine</h1>
|
|
<p className="text-muted-foreground">
|
|
Erlaubnisscheine und Gewässerkarten verwalten
|
|
</p>
|
|
</div>
|
|
<PermitsDataTable
|
|
data={permits as Array<Record<string, unknown>>}
|
|
accountId={acct.id}
|
|
/>
|
|
</div>
|
|
</CmsPageShell>
|
|
);
|
|
}
|