Initial state for GitNexus analysis

This commit is contained in:
Zaid Marzguioui
2026-03-29 19:44:57 +02:00
parent 9d7c7f8030
commit 61ff48cb73
155 changed files with 23483 additions and 1722 deletions

View File

@@ -0,0 +1,157 @@
import Link from 'next/link';
import { ArrowLeft, FileDown } from 'lucide-react';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { Button } from '@kit/ui/button';
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from '@kit/ui/card';
import { Input } from '@kit/ui/input';
import { Label } from '@kit/ui/label';
import { CmsPageShell } from '~/components/cms-page-shell';
interface PageProps {
params: Promise<{ account: string }>;
searchParams: Promise<{ type?: string }>;
}
const DOCUMENT_LABELS: Record<string, string> = {
'member-card': 'Mitgliedsausweis',
invoice: 'Rechnung',
labels: 'Etiketten',
report: 'Bericht',
letter: 'Brief',
certificate: 'Zertifikat',
};
export default async function GenerateDocumentPage({
params,
searchParams,
}: PageProps) {
const { account } = await params;
const { type } = await searchParams;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <div>Konto nicht gefunden</div>;
const selectedType = type ?? 'member-card';
const selectedLabel = DOCUMENT_LABELS[selectedType] ?? 'Dokument';
return (
<CmsPageShell account={account} title="Dokument generieren">
<div className="flex w-full flex-col gap-6">
{/* Back link */}
<div>
<Link
href={`/home/${account}/documents`}
className="text-muted-foreground hover:text-foreground inline-flex items-center text-sm"
>
<ArrowLeft className="mr-1 h-4 w-4" />
Zurück zu Dokumente
</Link>
</div>
<Card className="max-w-2xl">
<CardHeader>
<CardTitle>{selectedLabel} generieren</CardTitle>
<CardDescription>
Wählen Sie den Dokumenttyp und die gewünschten Optionen.
</CardDescription>
</CardHeader>
<CardContent>
<form className="flex flex-col gap-5">
{/* Document Type */}
<div className="flex flex-col gap-2">
<Label htmlFor="documentType">Dokumenttyp</Label>
<select
id="documentType"
name="documentType"
defaultValue={selectedType}
className="border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2"
>
<option value="member-card">Mitgliedsausweis</option>
<option value="invoice">Rechnung</option>
<option value="labels">Etiketten</option>
<option value="report">Bericht</option>
<option value="letter">Brief</option>
<option value="certificate">Zertifikat</option>
</select>
</div>
{/* Title */}
<div className="flex flex-col gap-2">
<Label htmlFor="title">Titel / Bezeichnung</Label>
<Input
id="title"
name="title"
placeholder={`z.B. ${selectedLabel} für Max Mustermann`}
required
/>
</div>
{/* Format */}
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div className="flex flex-col gap-2">
<Label htmlFor="format">Format</Label>
<select
id="format"
name="format"
className="border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2"
>
<option value="A4">A4</option>
<option value="A5">A5</option>
<option value="letter">Letter</option>
</select>
</div>
<div className="flex flex-col gap-2">
<Label htmlFor="orientation">Ausrichtung</Label>
<select
id="orientation"
name="orientation"
className="border-input bg-background ring-offset-background placeholder:text-muted-foreground focus-visible:ring-ring flex h-10 w-full rounded-md border px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2"
>
<option value="portrait">Hochformat</option>
<option value="landscape">Querformat</option>
</select>
</div>
</div>
{/* Info */}
<div className="rounded-md bg-muted/50 p-4 text-sm text-muted-foreground">
<p>
<strong>Hinweis:</strong> Die Dokumentgenerierung verwendet
Ihre gespeicherten Vorlagen. Stellen Sie sicher, dass eine
passende Vorlage für den gewählten Dokumenttyp existiert.
</p>
</div>
</form>
</CardContent>
<CardFooter className="flex justify-between">
<Link href={`/home/${account}/documents`}>
<Button variant="outline">Abbrechen</Button>
</Link>
<Button type="submit">
<FileDown className="mr-2 h-4 w-4" />
Generieren
</Button>
</CardFooter>
</Card>
</div>
</CmsPageShell>
);
}

View File

@@ -0,0 +1,137 @@
import Link from 'next/link';
import {
CreditCard,
FileText,
Tag,
BarChart3,
Mail,
Award,
} from 'lucide-react';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { Button } from '@kit/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
import { CmsPageShell } from '~/components/cms-page-shell';
interface PageProps {
params: Promise<{ account: string }>;
}
const DOCUMENT_TYPES = [
{
id: 'member-card',
title: 'Mitgliedsausweis',
description:
'Mitgliedsausweise mit Foto, Name und Mitgliedsnummer generieren.',
icon: CreditCard,
color: 'text-blue-600 bg-blue-50',
},
{
id: 'invoice',
title: 'Rechnung',
description:
'Professionelle Rechnungen im PDF-Format mit Logo und Positionen.',
icon: FileText,
color: 'text-green-600 bg-green-50',
},
{
id: 'labels',
title: 'Etiketten',
description:
'Adressetiketten für Serienbriefe im Avery-Format drucken.',
icon: Tag,
color: 'text-orange-600 bg-orange-50',
},
{
id: 'report',
title: 'Bericht',
description:
'Statistische Auswertungen und Berichte als PDF oder Excel.',
icon: BarChart3,
color: 'text-purple-600 bg-purple-50',
},
{
id: 'letter',
title: 'Brief',
description:
'Serienbriefe mit personalisierten Platzhaltern erstellen.',
icon: Mail,
color: 'text-rose-600 bg-rose-50',
},
{
id: 'certificate',
title: 'Zertifikat',
description:
'Teilnahmebescheinigungen und Zertifikate mit Unterschrift.',
icon: Award,
color: 'text-amber-600 bg-amber-50',
},
] as const;
export default async function DocumentsPage({ params }: PageProps) {
const { account } = await params;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <div>Konto nicht gefunden</div>;
return (
<CmsPageShell account={account} title="Dokumente">
<div className="flex w-full flex-col gap-6">
{/* Header */}
<div className="flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold">Dokumente</h1>
<p className="text-muted-foreground">
Dokumente erstellen und verwalten
</p>
</div>
<div className="flex gap-2">
<Link href={`/home/${account}/documents/templates`}>
<Button variant="outline">Vorlagen</Button>
</Link>
</div>
</div>
{/* Document Type Grid */}
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3">
{DOCUMENT_TYPES.map((docType) => {
const Icon = docType.icon;
return (
<Card key={docType.id} className="flex flex-col">
<CardHeader className="flex flex-row items-start gap-4 space-y-0">
<div className={`rounded-lg p-3 ${docType.color}`}>
<Icon className="h-6 w-6" />
</div>
<div className="flex-1">
<CardTitle className="text-base">{docType.title}</CardTitle>
</div>
</CardHeader>
<CardContent className="flex flex-1 flex-col justify-between gap-4">
<p className="text-sm text-muted-foreground">
{docType.description}
</p>
<Link
href={`/home/${account}/documents/generate?type=${docType.id}`}
>
<Button variant="outline" size="sm" className="w-full">
Erstellen
</Button>
</Link>
</CardContent>
</Card>
);
})}
</div>
</div>
</CmsPageShell>
);
}

View File

@@ -0,0 +1,101 @@
import Link from 'next/link';
import { FileText, Plus } from 'lucide-react';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { Button } from '@kit/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
import { CmsPageShell } from '~/components/cms-page-shell';
import { EmptyState } from '~/components/empty-state';
interface PageProps {
params: Promise<{ account: string }>;
}
export default async function DocumentTemplatesPage({ params }: PageProps) {
const { account } = await params;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <div>Konto nicht gefunden</div>;
// Document templates are stored locally for now — placeholder for future DB integration
const templates: Array<{
id: string;
name: string;
type: string;
description: string;
}> = [];
return (
<CmsPageShell account={account} title="Dokumentvorlagen">
<div className="flex w-full flex-col gap-6">
{/* Header */}
<div className="flex items-center justify-between">
<div>
<h1 className="text-2xl font-bold">Dokumentvorlagen</h1>
<p className="text-muted-foreground">
Vorlagen für Mitgliedsausweise, Rechnungen, Etiketten und mehr
</p>
</div>
<Button>
<Plus className="mr-2 h-4 w-4" />
Neue Vorlage
</Button>
</div>
{/* Table or Empty State */}
{templates.length === 0 ? (
<EmptyState
icon={<FileText className="h-8 w-8" />}
title="Keine Vorlagen vorhanden"
description="Erstellen Sie Ihre erste Dokumentvorlage, um Mitgliedsausweise, Rechnungen und mehr zu generieren."
actionLabel="Neue Vorlage"
/>
) : (
<Card>
<CardHeader>
<CardTitle>Alle Vorlagen ({templates.length})</CardTitle>
</CardHeader>
<CardContent>
<div className="rounded-md border">
<table className="w-full text-sm">
<thead>
<tr className="border-b bg-muted/50">
<th className="p-3 text-left font-medium">Name</th>
<th className="p-3 text-left font-medium">Typ</th>
<th className="p-3 text-left font-medium">
Beschreibung
</th>
</tr>
</thead>
<tbody>
{templates.map((template) => (
<tr
key={template.id}
className="border-b hover:bg-muted/30"
>
<td className="p-3 font-medium">{template.name}</td>
<td className="p-3">{template.type}</td>
<td className="p-3 text-muted-foreground">
{template.description}
</td>
</tr>
))}
</tbody>
</table>
</div>
</CardContent>
</Card>
)}
</div>
</CmsPageShell>
);
}