feat: KPI-cards klikbaar met SPA-navigatie naar detailpagina
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { X, Loader2 } from 'lucide-react';
|
import { X, Loader2 } from 'lucide-react';
|
||||||
|
|
||||||
// ---- Kleurmapping voor statussen ----
|
// ---- Kleurmapping voor statussen ----
|
||||||
@@ -58,6 +59,7 @@ export function Card({ title, subtitle, actions, children, className = '', paddi
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function KpiCard({ icon: Icon, label, value, sub, color = 'accent', to, iconColor: iconCol }) {
|
export function KpiCard({ icon: Icon, label, value, sub, color = 'accent', to, iconColor: iconCol }) {
|
||||||
|
const navigate = useNavigate();
|
||||||
const colors = {
|
const colors = {
|
||||||
accent: 'text-accent bg-accent-soft',
|
accent: 'text-accent bg-accent-soft',
|
||||||
green: 'text-green bg-green/15',
|
green: 'text-green bg-green/15',
|
||||||
@@ -66,8 +68,11 @@ export function KpiCard({ icon: Icon, label, value, sub, color = 'accent', to, i
|
|||||||
blue: 'text-blue bg-blue/15',
|
blue: 'text-blue bg-blue/15',
|
||||||
purple: 'text-purple bg-purple/15'
|
purple: 'text-purple bg-purple/15'
|
||||||
};
|
};
|
||||||
const inner = (
|
return (
|
||||||
<div className="bg-card border border-border-soft rounded-xl p-4 card-hover h-full">
|
<div
|
||||||
|
onClick={to ? () => navigate(to) : undefined}
|
||||||
|
className={`bg-card border border-border-soft rounded-xl p-4 card-hover h-full ${to ? 'cursor-pointer' : ''}`}
|
||||||
|
>
|
||||||
<div className="flex items-start justify-between">
|
<div className="flex items-start justify-between">
|
||||||
<div>
|
<div>
|
||||||
<div className="text-[12px] text-muted mb-1">{label}</div>
|
<div className="text-[12px] text-muted mb-1">{label}</div>
|
||||||
@@ -82,7 +87,6 @@ export function KpiCard({ icon: Icon, label, value, sub, color = 'accent', to, i
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
return to ? <a href={to} className="block">{inner}</a> : inner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const BTN_VARIANTS = {
|
const BTN_VARIANTS = {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
Users, Briefcase, CheckCircle2, Clock, Receipt, Wallet,
|
Users, Briefcase, CheckCircle2, Clock, Receipt, Wallet,
|
||||||
AlertTriangle, Lightbulb, Activity, ArrowRight
|
AlertTriangle, Lightbulb, Activity, ArrowRight
|
||||||
} from 'lucide-react';
|
} from 'lucide-react';
|
||||||
import { useSettings, iconColor } from '../settings';
|
import { useSettings } from '../settings';
|
||||||
import {
|
import {
|
||||||
ResponsiveContainer, BarChart, Bar, XAxis, YAxis, Tooltip, CartesianGrid,
|
ResponsiveContainer, BarChart, Bar, XAxis, YAxis, Tooltip, CartesianGrid,
|
||||||
PieChart, Pie, Cell, Legend
|
PieChart, Pie, Cell, Legend
|
||||||
@@ -64,12 +64,12 @@ export default function Dashboard() {
|
|||||||
|
|
||||||
{/* KPI's */}
|
{/* KPI's */}
|
||||||
<div className="grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3">
|
<div className="grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3">
|
||||||
<KpiCard icon={Users} label="Cliënten" value={stats.totalClients} sub={`${stats.activeClients} actief · ${stats.leads} leads`} color="accent" iconColor={iconColor('users', settings)} />
|
<KpiCard icon={Users} label="Cliënten" value={stats.totalClients} sub={`${stats.activeClients} actief · ${stats.leads} leads`} color="accent" to="/clients" />
|
||||||
<KpiCard icon={Briefcase} label="Lopende engagements" value={stats.activeEngagements} color="blue" iconColor={iconColor('briefcase', settings)} />
|
<KpiCard icon={Briefcase} label="Lopende engagements" value={stats.activeEngagements} color="blue" to="/engagements" />
|
||||||
<KpiCard icon={CheckCircle2} label="Open taken" value={stats.totalTasks - stats.completedTasks} sub={stats.overdueTasks > 0 ? `${stats.overdueTasks} te laat` : undefined} color={stats.overdueTasks > 0 ? 'red' : 'green'} iconColor={iconColor('check-circle', settings)} />
|
<KpiCard icon={CheckCircle2} label="Open taken" value={stats.totalTasks - stats.completedTasks} sub={stats.overdueTasks > 0 ? `${stats.overdueTasks} te laat` : undefined} color={stats.overdueTasks > 0 ? 'red' : 'green'} to="/tasks" />
|
||||||
<KpiCard icon={Clock} label="Uren totaal" value={fmt.hours(stats.totalHours)} sub={`${fmt.hours(stats.billableHours)} facturabel`} color="purple" iconColor={iconColor('clock', settings)} />
|
<KpiCard icon={Clock} label="Uren totaal" value={fmt.hours(stats.totalHours)} sub={`${fmt.hours(stats.billableHours)} facturabel`} color="purple" to="/time" />
|
||||||
<KpiCard icon={Receipt} label="Openstaand" value={fmt.euro(stats.totalOutstanding)} color="yellow" iconColor={iconColor('receipt', settings)} />
|
<KpiCard icon={Receipt} label="Openstaand" value={fmt.euro(stats.totalOutstanding)} color="yellow" to="/invoices" />
|
||||||
<KpiCard icon={Wallet} label="Betaald" value={fmt.euro(stats.totalPaid)} color="green" iconColor={iconColor('wallet', settings)} />
|
<KpiCard icon={Wallet} label="Betaald" value={fmt.euro(stats.totalPaid)} color="green" to="/finance" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Grafieken */}
|
{/* Grafieken */}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Mek-Tech — Consultancy Platform</title>
|
<title>Mek-Tech — Consultancy Platform</title>
|
||||||
<script type="module" crossorigin src="/app/assets/index-ChJCS-Nd.js"></script>
|
<script type="module" crossorigin src="/app/assets/index-CzYZ2WD_.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/app/assets/index-Cmof3-vz.css">
|
<link rel="stylesheet" crossorigin href="/app/assets/index-Cmof3-vz.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Reference in New Issue
Block a user