diff --git a/app/epd/clients/[id]/dashboard/page.tsx b/app/epd/clients/[id]/dashboard/page.tsx index 74d2f0c..2b75eed 100644 --- a/app/epd/clients/[id]/dashboard/page.tsx +++ b/app/epd/clients/[id]/dashboard/page.tsx @@ -2,25 +2,99 @@ * Client Dashboard - Level 2 (Client Dossier) * * Overzicht van client voortgang, recente activiteit en belangrijke metrics. + * Dit is de hoofd-dashboard pagina die opent wanneer je een client selecteert. */ -export default function ClientDashboardPage({ params }: { params: Promise<{ id: string }> }) { - return ( -
-

- Dashboard -

+import { notFound } from 'next/navigation'; +import { ChevronLeft } from 'lucide-react'; +import Link from 'next/link'; +import { getClient } from '../../actions'; +import { transformClient } from '@/lib/types/client'; +import { ClientTabs } from '../components/client-tabs'; -
-

- Client Dashboard -

-

- Overzicht, recente activiteit, snelle acties -

-

- Placeholder - Not designed yet -

+interface ClientDashboardPageProps { + params: Promise<{ id: string }>; + searchParams: Promise<{ tab?: string }>; +} + +export default async function ClientDashboardPage({ + params, + searchParams, +}: ClientDashboardPageProps) { + const { id } = await params; + const { tab } = await searchParams; + + // Fetch client data + let client; + try { + client = await getClient(id); + } catch (error) { + notFound(); + } + + if (!client) { + notFound(); + } + + const clientWithAge = transformClient(client); + + return ( +
+ {/* Header */} +
+
+ {/* Breadcrumb */} + + + Terug naar cliënten + + + {/* Client Info */} +
+
+ {/* Avatar */} +
+ + {client.first_name[0]} + {client.last_name[0]} + +
+ + {/* Name & Info */} +
+

+ {clientWithAge.full_name} +

+
+ {clientWithAge.age} jaar + + + Geboren:{' '} + {new Date(client.birth_date).toLocaleDateString('nl-NL')} + +
+
+
+ + {/* Actions */} +
+ + Bewerken + +
+
+
+
+ + {/* Tab Content */} +
+
); diff --git a/app/epd/clients/[id]/page.tsx b/app/epd/clients/[id]/page.tsx index f0d8e5b..b922cc0 100644 --- a/app/epd/clients/[id]/page.tsx +++ b/app/epd/clients/[id]/page.tsx @@ -1,94 +1,18 @@ -import { notFound } from 'next/navigation'; -import { ChevronLeft } from 'lucide-react'; -import Link from 'next/link'; -import { getClient } from '../actions'; -import { transformClient } from '@/lib/types/client'; -import { ClientTabs } from './components/client-tabs'; +import { redirect } from 'next/navigation'; interface ClientDetailPageProps { params: Promise<{ id: string }>; - searchParams: Promise<{ tab?: string }>; } +/** + * Redirect route: /epd/clients/[id] -> /epd/clients/[id]/dashboard + * + * Wanneer een gebruiker direct naar /epd/clients/[id] navigeert, + * wordt deze automatisch doorgestuurd naar het dashboard. + */ export default async function ClientDetailPage({ params, - searchParams, }: ClientDetailPageProps) { const { id } = await params; - const { tab } = await searchParams; - - // Fetch client data - let client; - try { - client = await getClient(id); - } catch (error) { - notFound(); - } - - if (!client) { - notFound(); - } - - const clientWithAge = transformClient(client); - - return ( -
- {/* Header */} -
-
- {/* Breadcrumb */} - - - Terug naar cliënten - - - {/* Client Info */} -
-
- {/* Avatar */} -
- - {client.first_name[0]} - {client.last_name[0]} - -
- - {/* Name & Info */} -
-

- {clientWithAge.full_name} -

-
- {clientWithAge.age} jaar - - - Geboren:{' '} - {new Date(client.birth_date).toLocaleDateString('nl-NL')} - -
-
-
- - {/* Actions */} -
- - Bewerken - -
-
-
-
- - {/* Tab Content */} -
- -
-
- ); + redirect(`/epd/clients/${id}/dashboard`); } diff --git a/app/epd/clients/components/client-list.tsx b/app/epd/clients/components/client-list.tsx index 9deb275..68a95bc 100644 --- a/app/epd/clients/components/client-list.tsx +++ b/app/epd/clients/components/client-list.tsx @@ -124,7 +124,8 @@ export function ClientList({ initialClients }: ClientListProps) { {filteredClients.map((client) => ( router.push(`/epd/clients/${client.id}`)} + className="hover:bg-slate-50 transition-colors cursor-pointer" >
@@ -153,7 +154,10 @@ export function ClientList({ initialClients }: ClientListProps) { {new Date(client.created_at).toLocaleDateString('nl-NL')} -
+
e.stopPropagation()} + >