refactor(clients): rebuild detail tabs + columns for new data model
- ClientData in client-detail.tsx now reflects the stripped shape from Task 8.2 (drop companyName/isProxy/proxy*/yacht*/berthSizeDesired) and gains yachts / companies / activeReservations arrays. - client-tabs.tsx: Overview trimmed (personal, contacts, source, tags); three new count-badged tabs (Yachts, Companies, Reservations). - New client-yachts-tab.tsx renders owned yachts + Add yacht CTA (TODO: YachtForm preset-owner wiring for v2). - New client-companies-tab.tsx renders memberships with Primary badge and since-date; management still lives on the company detail page. - New client-reservations-tab.tsx maps activeReservations into ReservationRow shape and delegates to <ReservationList showBerth />. - client-columns.tsx drops companyName column (TODO: add Yachts count + Primary company once list endpoint joins those). - client-filters.tsx drops isProxy filter. - Wire realtime invalidations for yacht:ownership_transferred, company_membership:added/ended, and berth_reservation:*.
This commit is contained in:
@@ -12,19 +12,7 @@ interface ClientData {
|
||||
id: string;
|
||||
portId: string;
|
||||
fullName: string;
|
||||
companyName: string | null;
|
||||
nationality: string | null;
|
||||
isProxy: boolean;
|
||||
proxyType: string | null;
|
||||
actualOwnerName: string | null;
|
||||
yachtName: string | null;
|
||||
yachtLengthFt: string | null;
|
||||
yachtWidthFt: string | null;
|
||||
yachtDraftFt: string | null;
|
||||
yachtLengthM: string | null;
|
||||
yachtWidthM: string | null;
|
||||
yachtDraftM: string | null;
|
||||
berthSizeDesired: string | null;
|
||||
preferredContactMethod: string | null;
|
||||
preferredLanguage: string | null;
|
||||
timezone: string | null;
|
||||
@@ -46,6 +34,35 @@ interface ClientData {
|
||||
name: string;
|
||||
color: string;
|
||||
}>;
|
||||
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;
|
||||
}>;
|
||||
}
|
||||
|
||||
interface ClientDetailProps {
|
||||
@@ -64,11 +81,15 @@ export function ClientDetail({ clientId, currentUserId }: ClientDetailProps) {
|
||||
'client:updated': [['clients', clientId]],
|
||||
'client:archived': [['clients', clientId]],
|
||||
'client:restored': [['clients', clientId]],
|
||||
'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]],
|
||||
});
|
||||
|
||||
const tabs = data
|
||||
? getClientTabs({ clientId, currentUserId, client: data })
|
||||
: [];
|
||||
const tabs = data ? getClientTabs({ clientId, currentUserId, client: data }) : [];
|
||||
|
||||
return (
|
||||
<DetailLayout
|
||||
|
||||
Reference in New Issue
Block a user