fix(registratura): prevent duplicate numbers, add upload progress, submission lock, unified close/resolve, backdating support

- generateRegistryNumber: parse max existing number instead of counting entries
- addEntry: fetch fresh entries before generating number (race condition fix)
- Form: isSubmitting lock prevents double-click submission
- Form: uploadingCount tracks FileReader progress, blocks submit while uploading
- Form: submit button shows Loader2 spinner during save/upload
- CloseGuardDialog: added ClosureResolution selector (finalizat/aprobat-tacit/respins/retras/altele)
- ClosureBanner: displays resolution badge
- Types: ClosureResolution type, registrationDate field on RegistryEntry
- Date field renamed 'Data document' with tooltip explaining backdating
- Registry table shows '(înr. DATE)' when registrationDate differs from document date
This commit is contained in:
AI Assistant
2026-02-27 21:56:47 +02:00
parent db6662be39
commit 8042df481f
7 changed files with 403 additions and 185 deletions
@@ -21,6 +21,14 @@ interface ClosureBannerProps {
allEntries?: RegistryEntry[];
}
const RESOLUTION_LABELS: Record<string, string> = {
finalizat: "Finalizat",
"aprobat-tacit": "Aprobat tacit",
respins: "Respins / Negativ",
retras: "Retras",
altele: "Altele",
};
/**
* Read-only banner displayed at the top of a closed entry,
* showing who closed it, when, why, linked entry, and attachment.
@@ -53,6 +61,12 @@ export function ClosureBanner({
<div className="flex items-center gap-2">
<Lock className="h-4 w-4 text-muted-foreground" />
<span className="text-sm font-semibold">Înregistrare închisă</span>
{closureInfo.resolution && (
<Badge variant="secondary" className="text-[10px]">
{RESOLUTION_LABELS[closureInfo.resolution] ??
closureInfo.resolution}
</Badge>
)}
{closureInfo.hadActiveDeadlines && (
<Badge
variant="outline"