feat(registratura): fix thread clear, close via conex entry

- Fix threadParentId clear: always show "Sterge" button even when parent not found in allEntries
- Bigger clear button with text label instead of tiny X icon
- Fallback display when parent not in current list (shows truncated ID)
- Close via conex: table/detail "Inchide" now creates a new reply entry that closes the original
- Header shows "Conex la BTG-XXX" + "Inchide originala" badge when closing via conex
- After saving the new conex entry, parent is auto-closed with resolution "finalizat"
- onClose signature changed from (id: string) to (entry: RegistryEntry) across table + detail

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-10 21:15:40 +02:00
parent f5e19ce3d1
commit 85077251f3
4 changed files with 68 additions and 21 deletions
@@ -1311,28 +1311,38 @@ export function RegistryEntryForm({
</Tooltip>
</TooltipProvider>
</Label>
{threadParent && (
{threadParentId && (
<div className="mt-1.5 flex items-center gap-2 rounded border border-primary/30 bg-primary/5 px-2 py-1.5 text-sm">
<Badge
variant={
threadParent.direction === "intrat" ? "default" : "secondary"
}
className="text-[10px]"
>
{threadParent.direction === "intrat" ? "↓" : "↑"}
</Badge>
<span className="font-mono text-xs">{threadParent.number}</span>
<span className="truncate text-muted-foreground text-xs">
{threadParent.subject}
</span>
{threadParent ? (
<>
<Badge
variant={
threadParent.direction === "intrat" ? "default" : "secondary"
}
className="text-[10px]"
>
{threadParent.direction === "intrat" ? "\u2193" : "\u2191"}
</Badge>
<span className="font-mono text-xs">{threadParent.number}</span>
<span className="truncate text-muted-foreground text-xs">
{threadParent.subject}
</span>
</>
) : (
<span className="text-xs text-muted-foreground italic">
Legat de o inregistrare (ID: {threadParentId.slice(0, 8)}...)
</span>
)}
<Button
type="button"
variant="ghost"
size="sm"
className="ml-auto h-6 w-6 p-0"
className="ml-auto h-7 px-2 text-xs text-destructive hover:text-destructive"
onClick={() => setThreadParentId("")}
title="Sterge legatura"
>
<X className="h-3.5 w-3.5" />
<X className="h-3.5 w-3.5 mr-0.5" />
Sterge
</Button>
</div>
)}