mirror of
https://github.com/complexcaresolutions/dak.c2s.git
synced 2026-03-17 17:13:42 +00:00
fix: show admin dashboard cards even when no data exists for selected year
Previously the Abrechnungsstatus and Top 10 Gutachter cards were hidden when no data existed (e.g. gutachter field unpopulated in 2026). Now both cards render with a "no data" placeholder message instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
42fd1808c4
commit
7a372922e6
1 changed files with 35 additions and 29 deletions
|
|
@ -346,13 +346,13 @@ export function DashboardPage() {
|
||||||
{isAdmin && data && (
|
{isAdmin && data && (
|
||||||
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
|
<div className="grid grid-cols-1 gap-6 lg:grid-cols-3">
|
||||||
{/* Abrechnungsstatus Donut */}
|
{/* Abrechnungsstatus Donut */}
|
||||||
{abrechnungsData.length > 0 && (
|
<Card>
|
||||||
<Card>
|
<CardHeader>
|
||||||
<CardHeader>
|
<CardTitle>Abrechnungsstatus</CardTitle>
|
||||||
<CardTitle>Abrechnungsstatus</CardTitle>
|
<p className="text-xs text-muted-foreground">Gutachten: abgerechnet vs. offen</p>
|
||||||
<p className="text-xs text-muted-foreground">Gutachten: abgerechnet vs. offen</p>
|
</CardHeader>
|
||||||
</CardHeader>
|
<CardContent>
|
||||||
<CardContent>
|
{abrechnungsData.length > 0 ? (
|
||||||
<ResponsiveContainer width="100%" height={300}>
|
<ResponsiveContainer width="100%" height={300}>
|
||||||
<PieChart>
|
<PieChart>
|
||||||
<Pie
|
<Pie
|
||||||
|
|
@ -386,37 +386,43 @@ export function DashboardPage() {
|
||||||
/>
|
/>
|
||||||
</PieChart>
|
</PieChart>
|
||||||
</ResponsiveContainer>
|
</ResponsiveContainer>
|
||||||
</CardContent>
|
) : (
|
||||||
</Card>
|
<p className="text-sm text-muted-foreground py-8 text-center">Keine Gutachten für {jahr} vorhanden.</p>
|
||||||
)}
|
)}
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
{/* Gutachter-Verteilung */}
|
{/* Gutachter-Verteilung */}
|
||||||
{topGutachterData && topGutachterData.items.length > 0 && (
|
{topGutachterData && (
|
||||||
<Card className="lg:col-span-2">
|
<Card className="lg:col-span-2">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Top 10 Gutachter</CardTitle>
|
<CardTitle>Top 10 Gutachter</CardTitle>
|
||||||
<p className="text-xs text-muted-foreground">Gutachten pro Gutachter in {jahr}</p>
|
<p className="text-xs text-muted-foreground">Gutachten pro Gutachter in {jahr}</p>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<div className="space-y-3">
|
{topGutachterData.items.length > 0 ? (
|
||||||
{topGutachterData.items.map((item, idx) => (
|
<div className="space-y-3">
|
||||||
<div key={item.gutachter} className="space-y-1">
|
{topGutachterData.items.map((item, idx) => (
|
||||||
<div className="flex items-center justify-between text-sm">
|
<div key={item.gutachter} className="space-y-1">
|
||||||
<span className="font-medium truncate max-w-[200px]">{item.gutachter}</span>
|
<div className="flex items-center justify-between text-sm">
|
||||||
<span className="text-muted-foreground tabular-nums">{item.count}</span>
|
<span className="font-medium truncate max-w-[200px]">{item.gutachter}</span>
|
||||||
|
<span className="text-muted-foreground tabular-nums">{item.count}</span>
|
||||||
|
</div>
|
||||||
|
<div className="h-2 w-full rounded-full bg-muted overflow-hidden">
|
||||||
|
<div
|
||||||
|
className="h-full rounded-full transition-all duration-300"
|
||||||
|
style={{
|
||||||
|
width: `${(item.count / topGutachterMax) * 100}%`,
|
||||||
|
backgroundColor: CHART_COLORS[idx % CHART_COLORS.length],
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="h-2 w-full rounded-full bg-muted overflow-hidden">
|
))}
|
||||||
<div
|
</div>
|
||||||
className="h-full rounded-full transition-all duration-300"
|
) : (
|
||||||
style={{
|
<p className="text-sm text-muted-foreground py-8 text-center">Keine Gutachter-Zuordnungen für {jahr} vorhanden.</p>
|
||||||
width: `${(item.count / topGutachterMax) * 100}%`,
|
)}
|
||||||
backgroundColor: CHART_COLORS[idx % CHART_COLORS.length],
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue