mirror of
https://github.com/renee-png/acmcc.git
synced 2026-06-21 01:40:01 +00:00
Unit ledger: list all active owners, not just the primary
The Owner card on the unit account dashboard showed only the primary owner. List every active owner (primary first, tagged), with each owner's email and account number; label becomes 'Owners' when >1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -513,11 +513,27 @@ export default function UnitLedgerView({ unitId, associationId }: Props) {
|
|||||||
<Card className="shadow-md border">
|
<Card className="shadow-md border">
|
||||||
<CardContent className="p-6 flex items-start gap-3">
|
<CardContent className="p-6 flex items-start gap-3">
|
||||||
<div className="p-2.5 bg-muted rounded-lg"><User className="w-5 h-5" /></div>
|
<div className="p-2.5 bg-muted rounded-lg"><User className="w-5 h-5" /></div>
|
||||||
<div>
|
<div className="min-w-0">
|
||||||
<p className="text-sm text-muted-foreground font-medium uppercase tracking-wider">Owner</p>
|
<p className="text-sm text-muted-foreground font-medium uppercase tracking-wider">{owners.length > 1 ? "Owners" : "Owner"}</p>
|
||||||
<p className="text-lg font-semibold mt-1">{primaryOwner ? `${primaryOwner.first_name} ${primaryOwner.last_name}` : "Unassigned"}</p>
|
{owners.length === 0 ? (
|
||||||
{primaryOwner?.email && <p className="text-sm text-primary mt-0.5">{primaryOwner.email}</p>}
|
<p className="text-lg font-semibold mt-1">Unassigned</p>
|
||||||
{primaryOwner?.account_number && <p className="text-sm text-muted-foreground">Acc: {primaryOwner.account_number}</p>}
|
) : (
|
||||||
|
// List every active owner on the unit (primary first), not just the primary.
|
||||||
|
[...owners]
|
||||||
|
.sort((a, b) => (b.is_primary ? 1 : 0) - (a.is_primary ? 1 : 0))
|
||||||
|
.map((o, i) => (
|
||||||
|
<div key={o.id ?? i} className={i > 0 ? "mt-3 pt-3 border-t" : "mt-1"}>
|
||||||
|
<p className="text-lg font-semibold flex items-center gap-2">
|
||||||
|
{o.first_name} {o.last_name}
|
||||||
|
{o.is_primary && owners.length > 1 && (
|
||||||
|
<span className="text-[10px] font-medium uppercase tracking-wide text-primary bg-primary/10 px-1.5 py-0.5 rounded">Primary</span>
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
{o.email && <p className="text-sm text-primary mt-0.5 truncate">{o.email}</p>}
|
||||||
|
{o.account_number && <p className="text-sm text-muted-foreground">Acc: {o.account_number}</p>}
|
||||||
|
</div>
|
||||||
|
))
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
Reference in New Issue
Block a user