From f5e19ce3d1c6466b39818737a1f68bd7e0ce524d Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Tue, 10 Mar 2026 20:40:12 +0200 Subject: [PATCH] feat(registratura): add Conex (reply) + Inchide buttons, reorder completari last MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Conex button on table rows (Reply icon, blue) — opens new entry with threadParentId pre-set + flipped direction - Conex button on detail panel — same behavior - Inchide button on table rows (CheckCircle2 icon, green) — only for open entries - replyTo prop on RegistryEntryForm: pre-sets threadParentId + direction flip (intrat→iesit, iesit→intrat) - Card header shows "Conex la BTG-0042/2026" with blue badge when replying - Completari moved to last position in deadline category order Co-Authored-By: Claude Opus 4.6 --- .../components/registratura-module.tsx | 33 ++++++++++++++--- .../components/registry-entry-detail.tsx | 19 +++++++++- .../components/registry-entry-form.tsx | 11 ++++-- .../components/registry-table.tsx | 35 ++++++++++++++++++- .../registratura/services/deadline-catalog.ts | 2 +- 5 files changed, 91 insertions(+), 9 deletions(-) diff --git a/src/modules/registratura/components/registratura-module.tsx b/src/modules/registratura/components/registratura-module.tsx index a1a7067..1924111 100644 --- a/src/modules/registratura/components/registratura-module.tsx +++ b/src/modules/registratura/components/registratura-module.tsx @@ -70,6 +70,8 @@ export function RegistraturaModule() { const [viewMode, setViewMode] = useState("list"); const [editingEntry, setEditingEntry] = useState(null); const [viewingEntry, setViewingEntry] = useState(null); + /** Entry to reply to (conex) — pre-sets threadParentId in new form */ + const [replyToEntry, setReplyToEntry] = useState(null); const [closingId, setClosingId] = useState(null); const [linkCheckId, setLinkCheckId] = useState(null); @@ -136,6 +138,7 @@ export function RegistraturaModule() { data: Omit, ) => { await addEntry(data); + setReplyToEntry(null); setViewMode("list"); }; @@ -152,6 +155,13 @@ export function RegistraturaModule() { setViewingEntry(full ?? entry); }; + const handleReply = (entry: RegistryEntry) => { + setReplyToEntry(entry); + setViewingEntry(null); + setEditingEntry(null); + setViewMode("add"); + }; + const handleNavigateEntry = async (entry: RegistryEntry) => { const full = await loadFullEntry(entry.id); setEditingEntry(full ?? entry); @@ -206,6 +216,7 @@ export function RegistraturaModule() { const handleCancel = () => { setViewMode("list"); setEditingEntry(null); + setReplyToEntry(null); }; // ── Dashboard deadline resolve/chain handlers ── @@ -384,6 +395,7 @@ export function RegistraturaModule() { onEdit={handleEdit} onDelete={handleDelete} onClose={handleCloseRequest} + onReply={handleReply} /> {!loading && ( @@ -398,15 +410,27 @@ export function RegistraturaModule() { - Înregistrare nouă - - Nr. auto - + {replyToEntry ? ( + <> + Conex la {replyToEntry.number} + + Raspuns + + + ) : ( + <> + Inregistrare noua + + Nr. auto + + + )} diff --git a/src/modules/registratura/components/registry-entry-detail.tsx b/src/modules/registratura/components/registry-entry-detail.tsx index f0259d3..3cde49b 100644 --- a/src/modules/registratura/components/registry-entry-detail.tsx +++ b/src/modules/registratura/components/registry-entry-detail.tsx @@ -19,6 +19,7 @@ import { User, X, Image as ImageIcon, + Reply, } from "lucide-react"; import { Button } from "@/shared/components/ui/button"; import { Badge } from "@/shared/components/ui/badge"; @@ -49,6 +50,8 @@ interface RegistryEntryDetailProps { onEdit: (entry: RegistryEntry) => void; onClose: (id: string) => void; onDelete: (id: string) => void; + /** Create a new entry linked as reply (conex) to this entry */ + onReply?: (entry: RegistryEntry) => void; allEntries: RegistryEntry[]; } @@ -137,6 +140,7 @@ export function RegistryEntryDetail({ onEdit, onClose, onDelete, + onReply, allEntries, }: RegistryEntryDetailProps) { const [previewIndex, setPreviewIndex] = useState(null); @@ -200,6 +204,19 @@ export function RegistryEntryDetail({ > Editează + {onReply && ( + + )} {entry.status === "deschis" && ( )} + {onReply && ( + + )} + {entry.status === "deschis" && ( + + )} diff --git a/src/modules/registratura/services/deadline-catalog.ts b/src/modules/registratura/services/deadline-catalog.ts index 9165417..2766839 100644 --- a/src/modules/registratura/services/deadline-catalog.ts +++ b/src/modules/registratura/services/deadline-catalog.ts @@ -639,7 +639,7 @@ export const DIRECTION_CATEGORIES: Record< RegistryDirection, DeadlineCategory[] > = { - iesit: ["certificat", "avize", "completari", "urbanism", "autorizare"], + iesit: ["certificat", "avize", "urbanism", "autorizare", "completari"], intrat: ["contestatie"], };