Add account hierarchy framework with migrations, RLS policies, and UI components
This commit is contained in:
@@ -2,17 +2,17 @@ import Link from 'next/link';
|
||||
|
||||
import { Landmark, FileText, Euro, ArrowRight, Plus } from 'lucide-react';
|
||||
|
||||
import { createFinanceApi } from '@kit/finance/api';
|
||||
import { formatDate } from '@kit/shared/dates';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
import { Badge } from '@kit/ui/badge';
|
||||
import { Button } from '@kit/ui/button';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
|
||||
|
||||
import { createFinanceApi } from '@kit/finance/api';
|
||||
|
||||
import { AccountNotFound } from '~/components/account-not-found';
|
||||
import { CmsPageShell } from '~/components/cms-page-shell';
|
||||
import { EmptyState } from '~/components/empty-state';
|
||||
import { StatsCard } from '~/components/stats-card';
|
||||
import { AccountNotFound } from '~/components/account-not-found';
|
||||
import {
|
||||
BATCH_STATUS_VARIANT,
|
||||
BATCH_STATUS_LABEL,
|
||||
@@ -61,9 +61,7 @@ export default async function FinancePage({ params }: PageProps) {
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold">Finanzen</h1>
|
||||
<p className="text-muted-foreground">
|
||||
SEPA-Einzüge und Rechnungen
|
||||
</p>
|
||||
<p className="text-muted-foreground">SEPA-Einzüge und Rechnungen</p>
|
||||
</div>
|
||||
<div className="flex gap-2">
|
||||
<Link href={`/home/${account}/finance/invoices/new`}>
|
||||
@@ -124,7 +122,7 @@ export default async function FinancePage({ params }: PageProps) {
|
||||
<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">Status</th>
|
||||
<th className="p-3 text-left font-medium">Typ</th>
|
||||
<th className="p-3 text-right font-medium">Betrag</th>
|
||||
@@ -135,15 +133,17 @@ export default async function FinancePage({ params }: PageProps) {
|
||||
{batches.map((batch: Record<string, unknown>) => (
|
||||
<tr
|
||||
key={String(batch.id)}
|
||||
className="border-b hover:bg-muted/30"
|
||||
className="hover:bg-muted/30 border-b"
|
||||
>
|
||||
<td className="p-3">
|
||||
<Badge
|
||||
variant={
|
||||
BATCH_STATUS_VARIANT[String(batch.status)] ?? 'secondary'
|
||||
BATCH_STATUS_VARIANT[String(batch.status)] ??
|
||||
'secondary'
|
||||
}
|
||||
>
|
||||
{BATCH_STATUS_LABEL[String(batch.status)] ?? String(batch.status)}
|
||||
{BATCH_STATUS_LABEL[String(batch.status)] ??
|
||||
String(batch.status)}
|
||||
</Badge>
|
||||
</td>
|
||||
<td className="p-3">
|
||||
@@ -157,11 +157,7 @@ export default async function FinancePage({ params }: PageProps) {
|
||||
: '—'}
|
||||
</td>
|
||||
<td className="p-3">
|
||||
{batch.execution_date
|
||||
? new Date(String(batch.execution_date)).toLocaleDateString('de-DE')
|
||||
: batch.created_at
|
||||
? new Date(String(batch.created_at)).toLocaleDateString('de-DE')
|
||||
: '—'}
|
||||
{formatDate(batch.execution_date ?? batch.created_at)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
@@ -196,7 +192,7 @@ export default async function FinancePage({ params }: PageProps) {
|
||||
<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">Nr.</th>
|
||||
<th className="p-3 text-left font-medium">Empfänger</th>
|
||||
<th className="p-3 text-right font-medium">Betrag</th>
|
||||
@@ -207,7 +203,7 @@ export default async function FinancePage({ params }: PageProps) {
|
||||
{invoices.map((invoice: Record<string, unknown>) => (
|
||||
<tr
|
||||
key={String(invoice.id)}
|
||||
className="border-b hover:bg-muted/30"
|
||||
className="hover:bg-muted/30 border-b"
|
||||
>
|
||||
<td className="p-3 font-mono text-xs">
|
||||
<Link
|
||||
|
||||
Reference in New Issue
Block a user