From 82c6d1e2cb46607ceb071549cb583483a27de6d7 Mon Sep 17 00:00:00 2001 From: Linas Date: Mon, 24 Aug 2026 19:06:04 +0300 Subject: [PATCH] Show and make editable the NAS folder number Prefixes the association name with "#" in the list table and the detail page title, and adds an editable field for it in the edit dialog - needed since some associations are missing it (NAS folders that were never numbered), which is what silently blanks their ratification code on the attestato. Verified live: table and detail title show "#2 ENCAP ODV", the edit field reflects the current value, and saving a new value updates both immediately. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_017hQcuUQFue2bFvrYw2UQhK --- app/dashboard/[id]/page.tsx | 2 +- components/associations/association-table.tsx | 7 ++++++- .../associations/edit-association-dialog.tsx | 14 ++++++++++++++ lib/models.ts | 1 + 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/dashboard/[id]/page.tsx b/app/dashboard/[id]/page.tsx index 2e58e46..99cda0f 100644 --- a/app/dashboard/[id]/page.tsx +++ b/app/dashboard/[id]/page.tsx @@ -147,7 +147,7 @@ export default function AssociationDetailPage() { Torna alle associazioni diff --git a/components/associations/association-table.tsx b/components/associations/association-table.tsx index b348e19..6c8d197 100644 --- a/components/associations/association-table.tsx +++ b/components/associations/association-table.tsx @@ -44,7 +44,12 @@ export function AssociationTable({ associations }: { associations: Association[] className="cursor-pointer" onClick={() => router.push(`/dashboard/${association.id}`)} > - {association.name} + + {association.nasFolderNumber != null && ( + #{association.nasFolderNumber} + )} + {association.name} + {association.address} diff --git a/components/associations/edit-association-dialog.tsx b/components/associations/edit-association-dialog.tsx index cbbe149..dd0a07c 100644 --- a/components/associations/edit-association-dialog.tsx +++ b/components/associations/edit-association-dialog.tsx @@ -31,6 +31,7 @@ export function EditAssociationDialog({ const [vatNumber, setVatNumber] = useState(association.vatNumber ?? ""); const [runtsId, setRuntsId] = useState(association.runtsId ?? ""); const [ratificationCode, setRatificationCode] = useState(association.ratificationCode ?? ""); + const [nasFolderNumber, setNasFolderNumber] = useState(association.nasFolderNumber?.toString() ?? ""); const [isShown, setIsShown] = useState(association.isShown ?? true); useEffect(() => { @@ -40,6 +41,7 @@ export function EditAssociationDialog({ setVatNumber(association.vatNumber ?? ""); setRuntsId(association.runtsId ?? ""); setRatificationCode(association.ratificationCode ?? ""); + setNasFolderNumber(association.nasFolderNumber?.toString() ?? ""); setIsShown(association.isShown ?? true); } }, [open, association]); @@ -55,6 +57,7 @@ export function EditAssociationDialog({ vatNumber, runtsId, ratificationCode, + nasFolderNumber: nasFolderNumber.trim() === "" ? undefined : Number(nasFolderNumber), isShown, }); onSaved(updated); @@ -111,6 +114,17 @@ export function EditAssociationDialog({ /> +
+ + setNasFolderNumber(e.target.value)} + placeholder="Usato per generare il codice di ratifica" + /> +
+
diff --git a/lib/models.ts b/lib/models.ts index 7db35b1..b03b84a 100644 --- a/lib/models.ts +++ b/lib/models.ts @@ -28,6 +28,7 @@ export interface Association { associates?: Associate[]; users?: User[]; ratificationCode?: string; + nasFolderNumber?: number; } export interface LoginResponse {