diff --git a/ondeck/src/components/clients/client-detail.tsx b/ondeck/src/components/clients/client-detail.tsx index 0ca5377..94bbacb 100644 --- a/ondeck/src/components/clients/client-detail.tsx +++ b/ondeck/src/components/clients/client-detail.tsx @@ -14,7 +14,7 @@ import { SelectValue, } from '@/components/ui/select' import { Textarea } from '@/components/ui/textarea' -import { Building2, MapPin, Phone, Mail, FileText, CheckSquare, CalendarRange, Users, X, Plus, UserCheck, StickyNote, Pencil, Trash2 } from 'lucide-react' +import { Building2, MapPin, Phone, Mail, FileText, CheckSquare, CalendarRange, Users, X, Plus, UserCheck, StickyNote, Pencil, Trash2, ChevronDown, ChevronUp } from 'lucide-react' import { Combobox } from '@/components/ui/combobox' import { formatDate, formatRenewalDate } from '@/lib/utils' import { PolicyGroupManager } from '@/components/clients/policy-group-manager' @@ -53,6 +53,7 @@ export function ClientDetail({ client, designations, policyGroups = [], allPolic const [parentOptions, setParentOptions] = useState<{id:string;name:string}[]>([]) const [parentLinking, setParentLinking] = useState(false) const [showArchivedTasks, setShowArchivedTasks] = useState(false) + const [notesExpanded, setNotesExpanded] = useState(!!(client.notes)) const [additionalServiceOpen, setAdditionalServiceOpen] = useState(false) const [sessionUserId, setSessionUserId] = useState('') @@ -318,220 +319,43 @@ export function ClientDetail({ client, designations, policyGroups = [], allPolic - {/* Claims Assignments */} - - - - - Claims Assignment - - - - {/* Advocate */} - - Claims Advocate - - ({ value: u.id, label: u.displayName || u.email }))} - value={advocateId} - onChange={setAdvocateId} - placeholder="Select advocate (Claims dept)" - emptyText="No Claims staff found" - /> - - {advocateSaving ? 'Saving...' : 'Save'} - - - - - {/* Team Members */} - - Team Members - - {members.length === 0 && ( - No members assigned - )} - {members.map((m: any) => ( - - - - {m.user?.displayName || m.user?.email} - - handleRemoveMember(m.userId)} - > - - - - ))} - - !members.some((m: any) => m.userId === u.id)) - .map((u) => ({ value: u.id, label: u.displayName || u.email }))} - value={addMemberId} - onChange={setAddMemberId} - placeholder="Add member..." - /> - - - Add - - - - - - - - {/* Related Companies */} - - - - - Related Companies - - - - {/* Parent Company */} - - Parent Company - {parentClient ? ( - - - {parentClient.name} - - - - - - ) : ( - - - setParentSearch(e.target.value)} - /> - - {parentOptions.length > 0 && ( - - {parentOptions.map((opt) => ( - handleLinkParent(opt.id, opt.name)} - disabled={parentLinking} - > - {opt.name} - - ))} - - )} - + {/* Client Notes — collapsible */} + + setNotesExpanded((v) => !v)} + > + + + Client Notes + {notes && !notesExpanded && ( + {notes.slice(0, 80)}{notes.length > 80 ? '…' : ''} + )} + {!notes && !notesExpanded && ( + No notes )} - - {/* Subsidiaries */} - {subsidiaries.length > 0 && ( - - Subsidiaries ({subsidiaries.length}) - - {subsidiaries.map((sub: any) => ( - - - {sub.name} - - - {sub._count?.policies ?? 0} policies - {sub._count?.tasks ?? 0} tasks - - - ))} - - - )} - - - - {/* Client Notes */} - - - - - Client Notes - - - - setNotes(e.target.value)} - rows={4} - /> - - {notesSaving ? 'Saving...' : 'Save Notes'} - - - - - {/* Designation Assignment */} - - - Designations - - - - - Primary Designation - - - - - - {designations.map((designation) => ( - - {designation.name} - - ))} - - - - - Secondary Designation - - - - - - {designations.map((designation) => ( - - {designation.name} - - ))} - - - + {notesExpanded ? : } + + {notesExpanded && ( + + setNotes(e.target.value)} + rows={4} + /> + + {notesSaving ? 'Saving...' : 'Save Notes'} + - - {saving ? 'Saving...' : 'Update Designations'} - - - + )} + {/* Tabs */} - + Active Policies ({client.policies.length}) @@ -548,6 +372,10 @@ export function ClientDetail({ client, designations, policyGroups = [], allPolic Contacts ({contacts.length}) + + + Assignment + @@ -859,6 +687,190 @@ export function ClientDetail({ client, designations, policyGroups = [], allPolic )} + + + {/* Claims Advocate */} + + + + + Claims Advocate + + + + + ({ value: u.id, label: u.displayName || u.email }))} + value={advocateId} + onChange={setAdvocateId} + placeholder="Select advocate (Claims dept)" + emptyText="No Claims staff found" + /> + + {advocateSaving ? 'Saving...' : 'Save'} + + + + + + {/* Designations */} + + + Designations + + + + + Primary Designation + + + + + + {designations.map((designation) => ( + + {designation.name} + + ))} + + + + + Secondary Designation + + + + + + {designations.map((designation) => ( + + {designation.name} + + ))} + + + + + + {saving ? 'Saving...' : 'Update Designations'} + + + + + {/* Team Members */} + + + + + Team Members + + + + + {members.length === 0 && ( + No members assigned + )} + {members.map((m: any) => ( + + + + {m.user?.displayName || m.user?.email} + + handleRemoveMember(m.userId)}> + + + + ))} + + !members.some((m: any) => m.userId === u.id)) + .map((u) => ({ value: u.id, label: u.displayName || u.email }))} + value={addMemberId} + onChange={setAddMemberId} + placeholder="Add member..." + /> + + + Add + + + + + + + {/* Related Companies */} + + + + + Related Companies + + + + + Parent Company + {parentClient ? ( + + + {parentClient.name} + + + + + + ) : ( + + setParentSearch(e.target.value)} + /> + {parentOptions.length > 0 && ( + + {parentOptions.map((opt) => ( + handleLinkParent(opt.id, opt.name)} + disabled={parentLinking} + > + {opt.name} + + ))} + + )} + + )} + + {subsidiaries.length > 0 && ( + + Subsidiaries ({subsidiaries.length}) + + {subsidiaries.map((sub: any) => ( + + + {sub.name} + + + {sub._count?.policies ?? 0} policies + {sub._count?.tasks ?? 0} tasks + + + ))} + + + )} + + + )
No members assigned
Parent Company
Subsidiaries ({subsidiaries.length})