"use client"; import type { BillingReport } from "@/lib/types"; import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Legend, LineChart, Line, } from "recharts"; import { Receipt, TrendingUp, FolderOpen } from "lucide-react"; function formatMonth(period: string): string { const [year, month] = period.split("-"); const months = [ "Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez", ]; return `${months[parseInt(month, 10) - 1]} ${year.slice(2)}`; } export function BillingTab({ data }: { data: BillingReport }) { const chartData = data.monthly.map((m) => ({ ...m, name: formatMonth(m.period), })); const totalNew = data.monthly.reduce((sum, m) => sum + m.cases_new, 0); const totalClosed = data.monthly.reduce((sum, m) => sum + m.cases_closed, 0); const totalByType = data.by_type.reduce((sum, t) => sum + t.total, 0); return (
{/* Summary cards */}
Neue Mandate

{totalNew}

im Zeitraum

Abgeschlossen

{totalClosed}

abrechenbar

Verfahrensarten

{data.by_type.length}

{totalByType} Akten gesamt

{/* New cases trend */}

Umsatzentwicklung (Mandate)

{chartData.length === 0 ? (

Keine Daten im gewählten Zeitraum

) : ( )}
{/* By type breakdown */}

Mandate nach Verfahrensart

{data.by_type.length === 0 ? (

Keine Daten

) : ( )}
{/* Summary table */}

Zusammenfassung

{data.by_type.length === 0 ? (

Keine Daten

) : (
{data.by_type.map((t) => ( ))}
Verfahrensart Aktiv Geschlossen Gesamt
{t.case_type} {t.active} {t.closed} {t.total}
)}
); }