diff --git a/ondeck/src/app/(dashboard)/clients/page.tsx b/ondeck/src/app/(dashboard)/clients/page.tsx index c53024f..1fe29b3 100644 --- a/ondeck/src/app/(dashboard)/clients/page.tsx +++ b/ondeck/src/app/(dashboard)/clients/page.tsx @@ -49,10 +49,12 @@ export default async function ClientsPage() { premiumAmount: true, }, }, + parentClient: { select: { id: true, name: true } }, _count: { select: { policies: true, tasks: true, + subsidiaries: true, }, }, }, diff --git a/ondeck/src/app/api/clients/route.ts b/ondeck/src/app/api/clients/route.ts index 512d1fa..aa9ca9d 100644 --- a/ondeck/src/app/api/clients/route.ts +++ b/ondeck/src/app/api/clients/route.ts @@ -143,10 +143,12 @@ export async function GET(request: NextRequest) { }, take: 1, }, + parentClient: { select: { id: true, name: true } }, _count: { select: { policies: true, tasks: true, + subsidiaries: true, }, }, }, diff --git a/ondeck/src/components/clients/client-card.tsx b/ondeck/src/components/clients/client-card.tsx index 2e364f6..a6bade2 100644 --- a/ondeck/src/components/clients/client-card.tsx +++ b/ondeck/src/components/clients/client-card.tsx @@ -3,7 +3,8 @@ import Link from 'next/link' import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card' import { Badge } from '@/components/ui/badge' -import { Building2, Calendar, FileText, CheckSquare } from 'lucide-react' +import { Building2, Calendar, FileText, CheckSquare, GitBranch, CornerLeftUp } from 'lucide-react' +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' import { formatDate, daysUntil } from '@/lib/utils' interface ClientCardProps { @@ -32,9 +33,11 @@ interface ClientCardProps { csrName: string | null status: string | null }> + parentClient?: { id: string; name: string } | null _count: { policies: number tasks: number + subsidiaries?: number } } } @@ -56,7 +59,34 @@ export function ClientCard({ client }: ClientCardProps) {

)} - +
+ {(client._count.subsidiaries ?? 0) > 0 && ( + + + +
+ + {client._count.subsidiaries} +
+
+

Parent · {client._count.subsidiaries} {client._count.subsidiaries === 1 ? 'subsidiary' : 'subsidiaries'}

+
+
+ )} + {client.parentClient && ( + + + +
+ +
+
+

Child of {client.parentClient.name}

+
+
+ )} + +
diff --git a/ondeck/src/components/clients/client-list.tsx b/ondeck/src/components/clients/client-list.tsx index 6e73c4c..3dd1828 100644 --- a/ondeck/src/components/clients/client-list.tsx +++ b/ondeck/src/components/clients/client-list.tsx @@ -28,9 +28,11 @@ interface ClientWithRelations extends Client { designation: Designation | null designation2: Designation | null policies: any[] + parentClient?: { id: string; name: string } | null _count: { policies: number tasks: number + subsidiaries?: number } } diff --git a/ondeck/src/components/clients/client-table.tsx b/ondeck/src/components/clients/client-table.tsx index efecb20..187f098 100644 --- a/ondeck/src/components/clients/client-table.tsx +++ b/ondeck/src/components/clients/client-table.tsx @@ -10,6 +10,8 @@ import { TableRow, } from '@/components/ui/table' import { Badge } from '@/components/ui/badge' +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' +import { GitBranch, CornerLeftUp } from 'lucide-react' import { formatDate, daysUntil } from '@/lib/utils' interface ClientTableProps { @@ -38,9 +40,11 @@ interface ClientTableProps { csrName: string | null status: string | null }> + parentClient?: { id: string; name: string } | null _count: { policies: number tasks: number + subsidiaries?: number } }> } @@ -72,12 +76,34 @@ export function ClientTable({ clients }: ClientTableProps) { return ( - - {client.name} - +
+ + {client.name} + + {(client._count.subsidiaries ?? 0) > 0 && ( + + + + + +

Parent · {client._count.subsidiaries} {client._count.subsidiaries === 1 ? 'subsidiary' : 'subsidiaries'}

+
+
+ )} + {client.parentClient && ( + + + + + +

Child of {client.parentClient.name}

+
+
+ )} +
{[client.city, client.state].filter(Boolean).join(', ') || '-'} diff --git a/ondeck/src/components/ui/tooltip.tsx b/ondeck/src/components/ui/tooltip.tsx new file mode 100644 index 0000000..ec65c1e --- /dev/null +++ b/ondeck/src/components/ui/tooltip.tsx @@ -0,0 +1,57 @@ +"use client" + +import * as React from "react" +import { Tooltip as TooltipPrimitive } from "radix-ui" + +import { cn } from "@/lib/utils" + +function TooltipProvider({ + delayDuration = 0, + ...props +}: React.ComponentProps) { + return ( + + ) +} + +function Tooltip({ + ...props +}: React.ComponentProps) { + return +} + +function TooltipTrigger({ + ...props +}: React.ComponentProps) { + return +} + +function TooltipContent({ + className, + sideOffset = 0, + children, + ...props +}: React.ComponentProps) { + return ( + + + {children} + + + + ) +} + +export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }