Initial commit: Port Nimara CRM (Layers 0-4)
Full CRM rebuild with Next.js 15, TypeScript, Tailwind, Drizzle ORM,
PostgreSQL, Redis, BullMQ, MinIO, and Socket.io. Includes 461 source
files covering clients, berths, interests/pipeline, documents/EOI,
expenses/invoices, email, notifications, dashboard, admin, and
client portal. CI/CD via Gitea Actions with Docker builds.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:52:51 +01:00
|
|
|
'use client';
|
|
|
|
|
|
|
|
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
|
|
|
|
|
|
|
import { DetailLayout } from '@/components/shared/detail-layout';
|
|
|
|
|
import { ClientDetailHeader } from '@/components/clients/client-detail-header';
|
|
|
|
|
import { getClientTabs } from '@/components/clients/client-tabs';
|
|
|
|
|
import { useRealtimeInvalidation } from '@/hooks/use-realtime-invalidation';
|
|
|
|
|
import { apiFetch } from '@/lib/api/client';
|
|
|
|
|
|
|
|
|
|
interface ClientData {
|
|
|
|
|
id: string;
|
|
|
|
|
portId: string;
|
|
|
|
|
fullName: string;
|
|
|
|
|
nationality: string | null;
|
|
|
|
|
preferredContactMethod: string | null;
|
|
|
|
|
preferredLanguage: string | null;
|
|
|
|
|
timezone: string | null;
|
|
|
|
|
source: string | null;
|
|
|
|
|
sourceDetails: string | null;
|
|
|
|
|
archivedAt: string | null;
|
|
|
|
|
createdAt: string;
|
|
|
|
|
updatedAt: string;
|
|
|
|
|
contacts: Array<{
|
|
|
|
|
id: string;
|
|
|
|
|
channel: string;
|
|
|
|
|
value: string;
|
|
|
|
|
label: string | null;
|
|
|
|
|
isPrimary: boolean;
|
|
|
|
|
notes: string | null;
|
|
|
|
|
}>;
|
|
|
|
|
tags: Array<{
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
color: string;
|
|
|
|
|
}>;
|
2026-04-24 14:36:34 +02:00
|
|
|
yachts: Array<{
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
hullNumber: string | null;
|
|
|
|
|
registration: string | null;
|
|
|
|
|
lengthFt: string | null;
|
|
|
|
|
widthFt: string | null;
|
|
|
|
|
status: string;
|
|
|
|
|
}>;
|
|
|
|
|
companies: Array<{
|
|
|
|
|
membershipId: string;
|
|
|
|
|
role: string;
|
|
|
|
|
isPrimary: boolean;
|
|
|
|
|
startDate: string | Date;
|
|
|
|
|
company: {
|
|
|
|
|
id: string;
|
|
|
|
|
name: string;
|
|
|
|
|
legalName: string | null;
|
|
|
|
|
status: string;
|
|
|
|
|
};
|
|
|
|
|
}>;
|
|
|
|
|
activeReservations: Array<{
|
|
|
|
|
id: string;
|
|
|
|
|
berthId: string;
|
|
|
|
|
yachtId: string;
|
|
|
|
|
startDate: string | Date;
|
|
|
|
|
tenureType: string;
|
|
|
|
|
status: string;
|
|
|
|
|
}>;
|
Initial commit: Port Nimara CRM (Layers 0-4)
Full CRM rebuild with Next.js 15, TypeScript, Tailwind, Drizzle ORM,
PostgreSQL, Redis, BullMQ, MinIO, and Socket.io. Includes 461 source
files covering clients, berths, interests/pipeline, documents/EOI,
expenses/invoices, email, notifications, dashboard, admin, and
client portal. CI/CD via Gitea Actions with Docker builds.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:52:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface ClientDetailProps {
|
|
|
|
|
clientId: string;
|
|
|
|
|
currentUserId?: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function ClientDetail({ clientId, currentUserId }: ClientDetailProps) {
|
|
|
|
|
const { data, isLoading } = useQuery<ClientData>({
|
|
|
|
|
queryKey: ['clients', clientId],
|
|
|
|
|
queryFn: () =>
|
|
|
|
|
apiFetch<{ data: ClientData }>(`/api/v1/clients/${clientId}`).then((r) => r.data),
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
useRealtimeInvalidation({
|
|
|
|
|
'client:updated': [['clients', clientId]],
|
|
|
|
|
'client:archived': [['clients', clientId]],
|
|
|
|
|
'client:restored': [['clients', clientId]],
|
2026-04-24 14:36:34 +02:00
|
|
|
'yacht:ownership_transferred': [['clients', clientId]],
|
|
|
|
|
'company_membership:added': [['clients', clientId]],
|
|
|
|
|
'company_membership:ended': [['clients', clientId]],
|
|
|
|
|
'berth_reservation:activated': [['clients', clientId]],
|
|
|
|
|
'berth_reservation:ended': [['clients', clientId]],
|
|
|
|
|
'berth_reservation:cancelled': [['clients', clientId]],
|
Initial commit: Port Nimara CRM (Layers 0-4)
Full CRM rebuild with Next.js 15, TypeScript, Tailwind, Drizzle ORM,
PostgreSQL, Redis, BullMQ, MinIO, and Socket.io. Includes 461 source
files covering clients, berths, interests/pipeline, documents/EOI,
expenses/invoices, email, notifications, dashboard, admin, and
client portal. CI/CD via Gitea Actions with Docker builds.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:52:51 +01:00
|
|
|
});
|
|
|
|
|
|
2026-04-24 14:36:34 +02:00
|
|
|
const tabs = data ? getClientTabs({ clientId, currentUserId, client: data }) : [];
|
Initial commit: Port Nimara CRM (Layers 0-4)
Full CRM rebuild with Next.js 15, TypeScript, Tailwind, Drizzle ORM,
PostgreSQL, Redis, BullMQ, MinIO, and Socket.io. Includes 461 source
files covering clients, berths, interests/pipeline, documents/EOI,
expenses/invoices, email, notifications, dashboard, admin, and
client portal. CI/CD via Gitea Actions with Docker builds.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:52:51 +01:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<DetailLayout
|
|
|
|
|
header={data ? <ClientDetailHeader client={data} /> : null}
|
|
|
|
|
tabs={tabs}
|
|
|
|
|
defaultTab="overview"
|
|
|
|
|
isLoading={isLoading}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|