import Link from 'next/link'; import { Plus } from 'lucide-react'; import { getTranslations } from 'next-intl/server'; import { createFischereiApi } from '@kit/fischerei/api'; import { FischereiTabNavigation, LeasesDataTable, } from '@kit/fischerei/components'; import { getSupabaseServerClient } from '@kit/supabase/server-client'; import { Button } from '@kit/ui/button'; import { ListToolbar } from '@kit/ui/list-toolbar'; import { AccountNotFound } from '~/components/account-not-found'; import { CmsPageShell } from '~/components/cms-page-shell'; interface Props { params: Promise<{ account: string }>; searchParams: Promise>; } export default async function LeasesPage({ params, searchParams }: Props) { const { account } = await params; const search = await searchParams; const client = getSupabaseServerClient(); const t = await getTranslations('fischerei'); const { data: acct } = await client .from('accounts') .select('id') .eq('slug', account) .single(); if (!acct) return ; const api = createFischereiApi(client); const page = Number(search.page) || 1; const waterId = (search.waterId as string) || undefined; const activeParam = search.active as string | undefined; const active = activeParam === 'true' ? true : activeParam === 'false' ? false : undefined; const [result, watersResult] = await Promise.all([ api.listLeases(acct.id, { waterId, active, page, pageSize: 25, }), api.listWaters(acct.id, { pageSize: 200 }), ]); const waterOptions = [ { value: '', label: 'Alle Gewässer' }, ...watersResult.data.map((w) => ({ value: String(w.id), label: String(w.name), })), ]; return (

Gewässerpachtverträge verwalten

); }