Add account hierarchy framework with migrations, RLS policies, and UI components
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { createFischereiApi } from '@kit/fischerei/api';
|
||||
import { FischereiTabNavigation } from '@kit/fischerei/components';
|
||||
|
||||
import { CmsPageShell } from '~/components/cms-page-shell';
|
||||
import { LEASE_PAYMENT_LABELS } from '@kit/fischerei/lib/fischerei-constants';
|
||||
import { formatDate } from '@kit/shared/dates';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { Badge } from '@kit/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
|
||||
|
||||
import { LEASE_PAYMENT_LABELS } from '@kit/fischerei/lib/fischerei-constants';
|
||||
import { AccountNotFound } from '~/components/account-not-found';
|
||||
import { CmsPageShell } from '~/components/cms-page-shell';
|
||||
|
||||
interface Props {
|
||||
params: Promise<{ account: string }>;
|
||||
@@ -54,7 +54,7 @@ export default async function LeasesPage({ params, searchParams }: Props) {
|
||||
<h3 className="text-lg font-semibold">
|
||||
Keine Pachten vorhanden
|
||||
</h3>
|
||||
<p className="mt-1 max-w-sm text-sm text-muted-foreground">
|
||||
<p className="text-muted-foreground mt-1 max-w-sm text-sm">
|
||||
Erstellen Sie Ihren ersten Pachtvertrag.
|
||||
</p>
|
||||
</div>
|
||||
@@ -62,22 +62,32 @@ export default async function LeasesPage({ params, searchParams }: Props) {
|
||||
<div className="rounded-md border">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b bg-muted/50">
|
||||
<tr className="bg-muted/50 border-b">
|
||||
<th className="p-3 text-left font-medium">Verpächter</th>
|
||||
<th className="p-3 text-left font-medium">Gewässer</th>
|
||||
<th className="p-3 text-left font-medium">Beginn</th>
|
||||
<th className="p-3 text-left font-medium">Ende</th>
|
||||
<th className="p-3 text-right font-medium">Jahresbetrag (€)</th>
|
||||
<th className="p-3 text-right font-medium">
|
||||
Jahresbetrag (€)
|
||||
</th>
|
||||
<th className="p-3 text-left font-medium">Zahlungsart</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{result.data.map((lease: Record<string, unknown>) => {
|
||||
const waters = lease.waters as Record<string, unknown> | null;
|
||||
const paymentMethod = String(lease.payment_method ?? 'ueberweisung');
|
||||
const waters = lease.waters as Record<
|
||||
string,
|
||||
unknown
|
||||
> | null;
|
||||
const paymentMethod = String(
|
||||
lease.payment_method ?? 'ueberweisung',
|
||||
);
|
||||
|
||||
return (
|
||||
<tr key={String(lease.id)} className="border-b hover:bg-muted/30">
|
||||
<tr
|
||||
key={String(lease.id)}
|
||||
className="hover:bg-muted/30 border-b"
|
||||
>
|
||||
<td className="p-3 font-medium">
|
||||
{String(lease.lessor_name)}
|
||||
</td>
|
||||
@@ -85,13 +95,11 @@ export default async function LeasesPage({ params, searchParams }: Props) {
|
||||
{waters ? String(waters.name) : '—'}
|
||||
</td>
|
||||
<td className="p-3">
|
||||
{lease.start_date
|
||||
? new Date(String(lease.start_date)).toLocaleDateString('de-DE')
|
||||
: '—'}
|
||||
{formatDate(lease.start_date)}
|
||||
</td>
|
||||
<td className="p-3">
|
||||
{lease.end_date
|
||||
? new Date(String(lease.end_date)).toLocaleDateString('de-DE')
|
||||
? formatDate(lease.end_date)
|
||||
: 'unbefristet'}
|
||||
</td>
|
||||
<td className="p-3 text-right">
|
||||
@@ -101,7 +109,8 @@ export default async function LeasesPage({ params, searchParams }: Props) {
|
||||
</td>
|
||||
<td className="p-3">
|
||||
<Badge variant="outline">
|
||||
{LEASE_PAYMENT_LABELS[paymentMethod] ?? paymentMethod}
|
||||
{LEASE_PAYMENT_LABELS[paymentMethod] ??
|
||||
paymentMethod}
|
||||
</Badge>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user