Show and make editable the NAS folder number
Prefixes the association name with "#<folder>" 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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017hQcuUQFue2bFvrYw2UQhK
This commit is contained in:
parent
9274377a3d
commit
82c6d1e2cb
@ -147,7 +147,7 @@ export default function AssociationDetailPage() {
|
||||
Torna alle associazioni
|
||||
</Button>
|
||||
<PageHeader
|
||||
title={association.name}
|
||||
title={association.nasFolderNumber != null ? `#${association.nasFolderNumber} ${association.name}` : association.name}
|
||||
description={`${association.associates?.length ?? 0} soci registrati`}
|
||||
actions={
|
||||
<>
|
||||
|
||||
@ -44,7 +44,12 @@ export function AssociationTable({ associations }: { associations: Association[]
|
||||
className="cursor-pointer"
|
||||
onClick={() => router.push(`/dashboard/${association.id}`)}
|
||||
>
|
||||
<TableCell className="font-medium">{association.name}</TableCell>
|
||||
<TableCell className="font-medium">
|
||||
{association.nasFolderNumber != null && (
|
||||
<span className="text-muted-foreground">#{association.nasFolderNumber} </span>
|
||||
)}
|
||||
{association.name}
|
||||
</TableCell>
|
||||
<TableCell className="hidden max-w-64 truncate text-muted-foreground md:table-cell">
|
||||
{association.address}
|
||||
</TableCell>
|
||||
|
||||
@ -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({
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="e-nasFolderNumber">Numero cartella NAS</Label>
|
||||
<Input
|
||||
id="e-nasFolderNumber"
|
||||
type="number"
|
||||
value={nasFolderNumber}
|
||||
onChange={(e) => setNasFolderNumber(e.target.value)}
|
||||
placeholder="Usato per generare il codice di ratifica"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between rounded-lg border p-3 sm:col-span-2">
|
||||
<div>
|
||||
<Label htmlFor="e-isShown">Associazione attiva</Label>
|
||||
|
||||
@ -28,6 +28,7 @@ export interface Association {
|
||||
associates?: Associate[];
|
||||
users?: User[];
|
||||
ratificationCode?: string;
|
||||
nasFolderNumber?: number;
|
||||
}
|
||||
|
||||
export interface LoginResponse {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user