Commit Graph

55 Commits

Author SHA1 Message Date
AI Assistant 5b18cce5a3 feat: simplify deadline dashboard + add flow diagrams for document chains
Major UX overhaul of the "Termene legale" and thread tabs:

Deadline dashboard:
- Replace 6 KPI cards with simple summary bar (active/urgent/overdue)
- Replace flat table with grouped list by entry (cards with progress bars)
- Chain deadlines collapsed by default with expand toggle
- Auto-tracked/background deadlines hidden from main list

Flow diagram (new component):
- CSS-only horizontal flow diagram showing document chains
- Nodes with direction bar (blue=intrat, orange=iesit), number, subject, status
- Solid arrows for thread links, dashed for conex/linked entries
- Used in both "Dosare" tab (full) and detail panel (compact, max 5 nodes)

Thread explorer → Dosare:
- Renamed tab "Fire conversatie" → "Dosare"
- Each thread shown as a card with flow diagram inside
- Simplified stats (just active/finalized count)

Background tracking:
- comunicare-aviz-beneficiar marked as backgroundOnly (not shown in dashboard)
- Transmission status computed and shown in detail panel (on-time/late)

Auto-resolution:
- When closing entry via reply, matching parent deadlines auto-resolve
- Resolution note includes the reply entry number

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 23:25:08 +02:00
AI Assistant 34024404a5 fix: prevent deleting registry entries that would create sequence gaps
Only the last entry in a company+year sequence can be deleted. Trying
to delete an earlier number (e.g. #2 when #3 exists) returns a 409
error with a Romanian message explaining the restriction.

Also routes UI deletes through the API (like create/update) so they
get proper audit logging and sequence recalculation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 22:38:51 +02:00
AI Assistant 0f555c55ee feat: simplify registry number format to B-2026-00001
New format: single-letter prefix + year + 5-digit sequence.
No direction code (IN/OUT) in the number — shown via arrow icon.
Sequence is shared across directions within the same company+year.

Changes:
- REGISTRY_COMPANY_PREFIX: BTG→B, USW→U, SDT→S, GRP→G
- OLD_COMPANY_PREFIX map for backward compat with existing entries
- allocateSequenceNumber: searches both old and new format entries
  to find the actual max sequence (backward compat)
- recalculateSequence: same dual-format search
- parseRegistryNumber: supports 3 formats (current, v1, legacy)
- isNewFormat: updated regex for B-2026-00001
- CompactNumber: already used single-letter badges, just updated comment
- debug-sequences endpoint: updated for new format
- Notification test data: updated to new format
- RegistrySequence.type: now "SEQ" (shared) instead of "IN"/"OUT"

After deploy: POST /api/registratura/debug-sequences to clean up
old counters, then recreate test entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 21:49:35 +02:00
AI Assistant 8e56aa7b89 fix: detail panel scroll and missing TooltipProvider in status badge
- Add min-h-0 + overflow-hidden on ScrollArea to enable scrolling
  in the detail side panel (flex child needs bounded height)
- Wrap external status badge Tooltip in TooltipProvider to fix
  "Tooltip must be used within TooltipProvider" runtime crash

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:55:15 +02:00
AI Assistant d7bd1a7f5d feat: external status monitor for registratura (Primaria Cluj-Napoca)
- Add ExternalStatusTracking types + ExternalDocStatus semantic states
- Authority catalog with Primaria Cluj-Napoca (POST scraper + HTML parser)
- Status check service: batch + single entry, change detection via hash
- API routes: cron-triggered batch (/api/registratura/status-check) +
  user-triggered single (/api/registratura/status-check/single)
- Add "status-change" notification type with instant email on change
- Table badge: Radio icon color-coded by status (amber/blue/green/red)
- Detail panel: full monitoring section with status, history, manual check
- Auto-detection: prompt when recipient matches known authority
- Activation dialog: configure petitioner name + confirm registration data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:42:21 +02:00
AI Assistant dff0bbe97c Shorten company badges to single letters and remove intern direction
Company badges: US→U, SDT→S (B and G already single letter).
Direction: only intrat (↓ green) and iesit (↑ orange), removed intern since no longer used.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 09:10:50 +02:00
AI Assistant 98c6fcb619 ui: compact registry numbers with company badge + direction icon
Replace full "BTG-0042/2026" with compact [B] ↓ 0042/2026 format:
- Colored company badge (B=blue, US=violet, SDT=green, G=gray)
- Direction arrow icon (↓ green=intrat, ↑ orange=iesit, ↔ gray=intern)
- Plain number without prefix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 09:07:12 +02:00
AI Assistant f10a112de6 ui: make toolbar buttons icon-only with title tooltip (Bune practici, Notificari)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 08:52:12 +02:00
AI Assistant 974d06fff8 feat: add email notification system (Brevo SMTP + N8N daily digest)
- Add core notification service: types, email-service (nodemailer/Brevo SMTP), notification-service (digest builder, preference CRUD, HTML renderer)
- Add API routes: POST /api/notifications/digest (N8N cron, Bearer auth), GET/PUT /api/notifications/preferences (session auth)
- Add NotificationPreferences UI component (Bell button + dialog with per-type toggles) in Registratura toolbar
- Add 7 Brevo SMTP env vars to docker-compose.yml
- Update CLAUDE.md, ROADMAP.md, DATA-MODEL.md, SYSTEM-ARCHITECTURE.md, CONFIGURATION.md, DOCKER-DEPLOYMENT.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 01:12:36 +02:00
AI Assistant 6941074106 fix: copy button uses plain number format (nr. 42 din 11.03.2026)
Strips company prefix and leading zeros from registry number.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:37:53 +02:00
AI Assistant 8e9753fd29 feat: add copy button next to registry number in table
Copies "nr. BTG-0042/2026 din 11.03.2026" to clipboard on click.
Small icon, subtle until hover, green check feedback on copy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:35:12 +02:00
AI Assistant 7094114c36 fix: hooks order violation in DeadlineResolveDialog causing crash
useMemo was called after early return (when deadline=null), violating
React Rules of Hooks. Moved all hooks before the conditional return.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:30:38 +02:00
AI Assistant 1c5ad7c988 feat: restructure Completari + rename Contestatie → Litigii + remove ac-prelungire
- Remove ac-prelungire backward deadline (redundant with AC validity tracker)
- Completari: now 2 beneficiary reminders (L350=60z, L50=3luni) instead of 4 mixed entries
- Rename contestatie → litigii ("Litigii / Sanctiuni / Contestatii")
- Add new litigii deadlines: prescriptie contraventie (3 ani), plangere PV (15z), CNSC (10z)
- Update existing: plangere prealabila, actiune instanta, atacare urbanism labels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 00:08:24 +02:00
AI Assistant a2b9ff75b5 feat(registratura): restructure Autorizare deadlines — no tacit approval
- ac-verificare (5z lucr.) now auto-track, created automatically with
  any AC emitere type. Informational: authority notifies if incomplete.
- ac-emitere (30z cal.) now chains to ac-emitere-dupa-completari when
  interrupted — term recalculates from completion submission date.
- ac-emitere-urgenta (7z lucr.) and ac-emitere-anexe (15z cal.) kept.
- New: ac-prelungire-emitere (15z lucr.) — authority communicates
  decision on AC extension within 15 working days.
- Info box in DeadlineAddDialog for autorizare category explaining
  auto-tracked verification + interruption mechanism.
- None of the autorizare deadlines have tacit approval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 23:55:39 +02:00
AI Assistant 4467e70973 fix: tooltip {proiect} hint visibility — use amber-300 on dark tooltip bg
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 23:00:10 +02:00
AI Assistant f50ad5e020 feat(registratura): auto-detect {proiect} placeholder in subject and switch to template mode
Typing {proiect}, {nr}, {an}, {detalii} or {text} in the subject field
now auto-transforms to template mode with the appropriate input widgets
(project dropdown, number fields, etc.).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 22:52:31 +02:00
AI Assistant 442a1565fd feat: avize deadline restructure with interruption mechanism + comisie toggle
- Add "Necesita analiza in comisie" toggle for avize category (mirrors CJ toggle)
  - When OFF: auto-creates 5-day working limit for completari requests
  - When ON: no limit (institution can request completions anytime)
- Add interruption mechanism: resolve aviz as "intrerupt" when institution
  requests completions → auto-creates new 15-day deadline from completions date
- New resolution type "intrerupt" with yellow badge + chain support
- Restructure avize catalog entries:
  - aviz-ac-15 (L50) and aviz-urbanism-30 (L350) now have chain to
    aviz-emitere-dupa-completari for interruption flow
  - aviz-mediu: updated hints about procedure closure prerequisite
  - aviz-cultura-comisie: 2-phase with auto-track depunere la comisie (30 days)
  - aeronautica, ISU, transport-eu: all get interruption chain
- 3 new auto-track entries: aviz-completari-limit (5zl), aviz-emitere-dupa-completari
  (15zc), aviz-cultura-depunere-comisie (30zc)
- New document type: "Convocare sedinta"
- Info boxes in dialog explaining auto-track behavior + interruption mechanism

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 22:41:14 +02:00
AI Assistant 31565b418a fix: doc type persistence on edit + filter deadlines by document type
- Fix doc type showing "altele" after edit: preserve initial documentType
  in allDocTypes map even if not in defaults or Tag Manager
- Filter deadline categories by document type: only cerere/aviz unlock
  full permitting categories (CU, avize, urbanism, autorizare)
- Other doc types (scrisoare, notificare, etc.) only get completari +
  contestatie as deadline categories
- Add completari to intrat direction (was missing)
- Pass documentType to DeadlineAddDialog for category filtering

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:58:06 +02:00
AI Assistant 4ac4a48cad fix: differentiate Conex (linkedEntryIds) vs Inchide (threadParentId) semantics
- Conex button now adds to linkedEntryIds (for clarificari/solicitari)
  instead of setting threadParentId
- Inchide button sets threadParentId (direct reply) + auto-closes parent
- Fix Sterge button persistence bug: threadParentId now saves as empty
  string instead of undefined (which was stripped in JSON serialization)
- Card headers: "Conex cu X" (amber) vs "Raspuns la X" (blue + green)
- Add conexTo prop to RegistryEntryForm for linked entry pre-fill

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:29:56 +02:00
AI Assistant 85077251f3 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>
2026-03-10 21:15:40 +02:00
AI Assistant f5e19ce3d1 feat(registratura): add Conex (reply) + Inchide buttons, reorder completari last
- 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 <noreply@anthropic.com>
2026-03-10 20:40:12 +02:00
AI Assistant f01fe47af4 feat(registratura): remove publicitate category, auto-track comunicare, late receipt badge, AC validity conditional
- Remove publicitate/comunicare category entirely (AC publicity handled by AC validity tracker)
- comunicare-aviz-beneficiar moved to auto-track: created alongside any iesit deadline
- Late receipt badge on incoming aviz entries: shows "Primit cu X zile intarziere" when document date < today
- Valabilitate document + AC Validity Tracker visible only when documentType is "aviz" (act administrativ)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 19:26:05 +02:00
AI Assistant b2519a3b9c feat(registratura): redesign CU deadline tracking — direction filtering, CJ toggle, auto-track, verification badge
- CU has NO tacit approval on any entry
- Direction-dependent categories: iesiri (CU, Avize, Completari, Urbanism, Autorizare), intrari (Contestatie)
- Rename: Analiza → Urbanism (PUD/PUZ/PUG), Autorizare (AC) → Autorizare (AD/AC)
- Auto-track deadlines: cu-verificare (10zl) created automatically with CU emitere
- CJ toggle: auto-creates arhitect-sef solicita aviz (3zc) + primar emite aviz (5zc)
- Verification badge: after 10 days shows "Nu mai pot returna documentatia"
- Prelungire helper: CU issue date + 6/12/24 month calculator
- cu-prelungire-emitere changed to 30zc (practica administrativa)
- New DeadlineTypeDef fields: autoTrack, directionFilter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 18:58:50 +02:00
AI Assistant f5ffce2e23 feat(registratura): restructure legal deadline catalog — 35 deadlines from Legea 50/1991 & 350/2001
Complete rewrite of deadline-catalog.ts based on comprehensive legislative extracts:

Certificat de Urbanism (6): verificare 10zl, emitere L50 15zl, emitere L350 30zc,
  suport tehnic 10zl, prelungire depunere 15zc backward, prelungire emitere 15zc

Avize (15): AC standard 15zc, urbanism 30zc, Mediu 15zc, Cultura comisie 30zc,
  Min.Culturii 30zl, Aeronautica 30zc, ISU 15zc, transport EU 10zc, comisie
  agenda 30zc, comisie emitere 15zc, oportunitate analiza/emitere (fara tacit!),
  reconfirmare 5zl, primar 5zc, monument fara AC 30zc

Completari (4): notificare 5zl, beneficiar 60zc, emitere 15zc, AC beneficiar 90zc

Autorizare (5): verificare 5zl, emitere 30zc, urgenta 7zl, agricol 15zc,
  prelungire 45zl backward

Publicitate (2): AC 30zc, comunicare aviz 1zc

Contestatie (4): plangere prealabila 30zc, contestare AC 60zc,
  contestare urbanism 5 ani, plangere contraventionala 15zc

Each deadline now includes legalReference field displayed in the dialog.
Dialog shows legal reference, scroll for long lists, contestatie category added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 14:24:02 +02:00
AI Assistant eb7c28ca14 feat(registratura): smart defaults per direction, new doc types, expanded cerere templates
- Default doc type: aviz (intrat) / cerere (iesit); auto-switches on direction toggle
- New default doc types: Proces verbal, Notificare, Comunicare (with full seed templates)
- Cerere templates rewritten: emiterea CU/AC, prelungirea valabilitatii, completare
  documentatie, indreptarea erorilor materiale, inaintare dispozitie de santier,
  eliberarea certificatului, aviz, racordare
- Aviz label renamed to "Aviz / Act administrativ"
- Scrisoare label renamed to "Scrisoare / Adresa", raport to "Raport / Studiu"
- Moved PV/notificare/comunicare templates from scrisoare/altele to their own types
- Cleaned up duplicate templates across categories

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 14:02:46 +02:00
AI Assistant 8cec9646c3 feat(registratura): add administrative acts seed templates (CU, AC, avize concrete)
- Add CU/AC/Prelungire CU/AC templates under aviz type for received acts
- Add Aviz ISU/DSP/Mediu/APM concrete templates
- Add PV receptie, Proces verbal, Referat verificare, Expertiza tehnica, RTE, Memoriu tehnic
- Add Cerere completari, Raspuns completari, Somatie templates
- Update dynamic placeholders for intrat (CU/AC examples) and iesit (Cerere CU)
- Update tooltip examples: intrat shows CU/AC/Aviz, iesit shows Cerere/Solicitare

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:05:45 +02:00
AI Assistant e30b437dce feat(registratura): smart subject autocomplete v2 — seed templates, project linking, dynamic placeholders
- Add SEED_TEMPLATES catalog (11 doc types x 2-4 templates = ~30 predefined patterns)
- Add {proiect} field type with mini-autocomplete from Tag Manager projects
- Pre-fill {an} fields with current year on template selection
- Dynamic placeholder changes based on documentType + direction (22 combinations)
- Dropdown on empty focus: "Sabloane recomandate" + "Recente" sections
- Direction-aware tooltip on Subiect field (intrat vs iesit examples)
- getRecommendedTemplates() merges seeds + DB-learned, DB takes priority

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 12:46:05 +02:00
AI Assistant b3b585e7c8 feat(registratura): subject autocomplete with inline template fields
- New subject-template-service: extracts reusable templates from existing
  subjects by detecting variable parts (numbers, years, text after separators)
- Template input component: inline editable fields within static text
  (e.g., "Cerere CU nr. [___]/[____] — [___________]")
- Two-tier autocomplete dropdown: templates sorted by frequency (top) +
  matching existing subjects (bottom)
- Learns from database: more entries = better suggestions
- Follows existing contact autocomplete pattern (focus/blur, onMouseDown)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 08:40:37 +02:00
AI Assistant eb96af3e4b feat(registratura): add best practices popover + contextual tooltips on form fields
- "Bune practici" button in registry header opens a popover with internal rules
  (numerotare, completare, termene, atașamente, închidere)
- Info tooltips on form labels: Direcție, Tip document, Subiect, Expeditor,
  Destinatar, Atașamente (consistent with existing pattern on Data document)
- Install shadcn/ui Popover component

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 08:21:54 +02:00
AI Assistant 6786ac07d1 fix(registratura): remove intern direction — only intrat/iesit are valid
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 08:01:29 +02:00
AI Assistant a0dd35a066 feat(registratura): atomic numbering, reserved slots, audit trail, API endpoints + theme toggle animation
Registratura module:
- Atomic sequence numbering (BTG-2026-IN-00125 format) via PostgreSQL upsert
- Reserved monthly slots (2/company/month) for late registrations
- Append-only audit trail with diff tracking
- REST API: /api/registratura (CRUD), /api/registratura/reserved, /api/registratura/audit
- Auth: NextAuth session + Bearer API key support
- New "intern" direction type with UI support (form, filters, table, detail panel)
- Prisma models: RegistrySequence, RegistryAudit

Theme toggle:
- SVG mask-based sun/moon morph with 360° spin animation
- Inverted logic (sun in dark mode, moon in light mode)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 07:54:32 +02:00
AI Assistant 5ca276fb26 docs: update CLAUDE.md, ROADMAP.md, SESSION-LOG.md
- Registratura v0.4.0 with QuickLook preview description
- New task 3.03d: QuickLook + bug fixes (NAS links, overflow, vault filter)
- Session log updated with all fixes and new features
- attachment-preview.tsx added to key files list
2026-02-28 19:47:28 +02:00
AI Assistant dcce341b8a feat(registratura): QuickLook-style attachment preview
New fullscreen preview modal for document attachments:
- Images: zoomable (scroll wheel + buttons), pannable when zoomed,
  zoom percentage display, reset with '0' key
- PDFs: native browser PDF viewer via blob URL iframe
- Navigation: left/right arrows (keyboard + buttons), bottom
  thumbnail strip when multiple attachments
- Actions: download, print, close (Esc)
- Dark overlay with smooth animations
- Preview button (eye icon) shown for images AND PDFs
- Replaced old inline image-only preview with new QuickLook modal

New file: attachment-preview.tsx (~450 lines)
Modified: registry-entry-detail.tsx (integrated preview)
2026-02-28 19:33:40 +02:00
AI Assistant 08b7485646 fix(registratura): redesign NAS attachment card to prevent overflow
Replaced two-row layout (short path + full UNC path) with compact
single-row: filename only + NAS badge + Copiaza/Copiat badge.
Full path shown in native tooltip on hover, copied on click.
Uses <button> instead of <div> for proper block formatting.
Removed font-mono (caused no-break overflow), removed shortDisplayPath
import, added pathFileName import, removed unused FolderOpen icon.
2026-02-28 19:20:13 +02:00
AI Assistant ea4f245467 fix(registratura): disable horizontal scroll on detail sheet ScrollArea
Radix ScrollArea Viewport allows horizontal scroll by default, causing
NAS attachment cards to extend beyond the sheet edge. Override viewport
overflow-x to hidden and move px-6 padding inside the content div so
the viewport constrains content width properly.
2026-02-28 19:07:27 +02:00
AI Assistant 26f0033c60 fix: NAS attachment overflow in detail sheet + vault filter reset
- Detail sheet: add overflow-hidden to ScrollArea content wrapper so
  NAS attachment cards with long paths don't push badges/copy icon
  beyond the sheet boundary
- Password vault: reset category filter to 'all' and clear search
  after adding/editing an entry so user sees the new entry immediately
  instead of landing on a filtered empty view
2026-02-28 18:55:04 +02:00
AI Assistant 7a1aee15fd fix(registratura): NAS attachment card overflow in detail sheet
Add overflow-hidden to card container, min-w-0 to flex row, and
truncate to path text div so long NAS paths don't push badges
and copy icon outside the visible area.
2026-02-28 18:04:54 +02:00
AI Assistant 05efd525e3 fix(registratura): NAS links copy to clipboard instead of broken file:///
Browsers block file:/// URLs from web pages for security. Changed:
- Detail sheet: click on NAS attachment copies path to clipboard with
  'Copiat!' green badge feedback. Full UNC path shown below.
- Entry form: NAS link click = copy path (removed window.open fallback)
- Removed unused toFileUrl/toFileUrlByIp imports from form
- User pastes in Explorer address bar to open the file
2026-02-28 17:55:27 +02:00
AI Assistant 4dae06be44 feat(registratura): detail sheet side panel + configurable column visibility
- New registry-entry-detail.tsx: full entry visualization in Sheet (side panel)
  - Status badges, document info, parties, dates, thread links
  - Attachment preview: images inline, NAS paths with IP fallback
  - Legal deadlines, external tracking, tags, notes sections
  - Action buttons: Editează, Închide, Șterge
- Registry table rewrite:
  - 10 column defs with Romanian tooltip explanations on each header
  - Column visibility dropdown (Settings icon) with checkboxes
  - Default: Nr/Data/Dir/Subiect/Exped./Dest./Status (7/10)
  - Persisted in localStorage (registratura:visible-columns)
  - Row click opens detail sheet, actions reduced to Eye + Pencil
- Docs updated: CLAUDE.md, ROADMAP.md (3.03c), SESSION-LOG.md
2026-02-28 17:45:18 +02:00
AI Assistant f4b1d4b8dd feat(registratura): all 4 NAS drives (A/O/P/T) + hostnameIP fallback
- nas-paths.ts: A:\=Arhiva, O:\=Organizare, P:\=Proiecte, T:\=Transfer
- toUncPathByIp() / toFileUrlByIp() helpers for DNS failure fallback
- shareLabelFor() returns human-readable share name for badges
- UI: 'IP' fallback link on hover, badge shows share label
- Validation hints updated to show all 4 drive letters
- Docs updated: CLAUDE.md, ROADMAP.md, SESSION-LOG.md
2026-02-28 17:23:38 +02:00
AI Assistant 4f00cb2de8 feat(registratura): NAS network path attachments (\\newamun / P:\)
- New nas-paths.ts config: drive mappings, UNC normalization, file:/// URL builder
- RegistryAttachment type extended with optional networkPath field
- 'Link NAS' button in attachment section opens inline path input
- Network path entries shown with blue HardDrive icon + NAS badge
- Click opens in Explorer via file:/// URL, copy path button on hover
- P:\ auto-converted to \\newamun\Proiecte UNC path
- Short display path shows share + last 2 segments
- Validation: warns if path doesn't match known NAS mappings
2026-02-28 17:13:26 +02:00
AI Assistant 3abf0d189c feat: Registratura thread explorer, AC validity tracker, interactive I/O toggle + Password Vault rework
Registratura improvements:
- Thread Explorer: new 'Fire conversatie' tab with timeline view, search, stats, gap tracking (la noi/la institutie), export to text report
- Interactive I/O toggle: replaced direction dropdown with visual blue/orange button group (Intrat/Iesit with icons)
- Doc type UX: alphabetical sort + immediate selection after adding custom type
- AC Validity Tracker: full Autorizatie de Construire lifecycle workflow (12mo validity, execution phases, extension request, required docs checklist, monthly reminders, abandonment/expiry tracking)

Password Vault rework (renamed to 'Parole Uzuale' v0.3.0):
- New categories: WiFi, Portale Primarii, Avize Online, PIN Semnatura, Software, Hardware (replaced server/database/api)
- Category icons (lucide-react) throughout list and form
- WiFi QR code dialog with connection string copy
- Context-aware form (PIN vs password label, hide email for WiFi/PIN, hide URL for WiFi, hide generator for PIN)
- Dynamic stat cards showing top 3 categories by count
- Removed encryption banner
- Updated i18n, flags, config
2026-02-28 16:33:36 +02:00
AI Assistant 99fbdddb68 3.03 Registratura Termene Legale recipient registration, audit log, expiry tracking
- Added recipientRegNumber/recipientRegDate fields for outgoing docs (deadline triggers from recipient registration date)
- Added prelungire-CU deadline type in catalog (15 calendar days, tacit approval)
- CU category already first in catalog  verified
- DeadlineAuditEntry interface + audit log on TrackedDeadline (created/resolved entries)
- Document expiry tracking: expiryDate + expiryAlertDays with live countdown
- Web scraping prep fields: externalStatusUrl + externalTrackingId
- Dashboard: 6 stat cards (added missing recipient + expiring soon)
- Alert banners for missing recipient data and expiring documents
- Version bump to 0.2.0
2026-02-28 04:31:32 +02:00
AI Assistant f8c19bb5b4 perf: separate blob storage for registratura attachments
Root cause: even with SQL-level stripping, PostgreSQL must TOAST-decompress
entire multi-MB JSONB values from disk before any processing. For 5 entries
with PDF attachments (25-50MB total), this takes several seconds.

Fix: store base64 attachment data in separate namespace 'registratura-blobs'.
Main entries are inherently small (~1-2KB). List queries never touch heavy data.

Changes:
- registry-service.ts: extractBlobs/mergeBlobs split base64 on save/load,
  migrateEntryBlobs() one-time migration for existing entries
- use-registry.ts: dual namespace (registratura + registratura-blobs),
  migration runs on first mount
- registratura-module.tsx: removed useContacts/useTags hooks that triggered
  2 unnecessary API fetches on page load (write-only ops use direct storage)

Before: 3 API calls on mount, one reading 25-50MB from PostgreSQL
After: 1 API call on mount, reading ~5-10KB total
2026-02-27 23:35:04 +02:00
AI Assistant c22848b471 perf(registratura): lightweight API mode strips base64 attachments from list
ROOT CAUSE: RegistryEntry stores file attachments as base64 strings in JSON.
A single 5MB PDF becomes ~6.7MB of base64. With 6 entries, the exportAll()
endpoint was sending 30-60MB of JSON on every page load  taking 2+ minutes.

Fix: Added ?lightweight=true parameter to /api/storage GET endpoint.
When enabled, stripHeavyFields() recursively removes large 'data' and
'fileData' string fields (>1KB) from JSON values, replacing with '__stripped__'.

Changes:
- /api/storage route.ts: stripHeavyFields() + lightweight query param
- StorageService.export(): accepts { lightweight?: boolean } option
- DatabaseStorageAdapter.export(): passes lightweight flag to API
- LocalStorageAdapter.export(): accepts option (no-op, localStorage is fast)
- useStorage.exportAll(): passes options through
- registry-service.ts: getAllEntries() uses lightweight=true by default
- registry-service.ts: new getFullEntry() loads single entry with full data
- use-registry.ts: exports loadFullEntry() for on-demand full loading
- registratura-module.tsx: handleEdit/handleNavigateEntry load full entry

Result: List loading transfers ~100KB instead of 30-60MB. Editing loads
full data for a single entry on demand (~5-10MB for one entry vs all).
2026-02-27 22:37:39 +02:00
AI Assistant 8042df481f 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
2026-02-27 21:56:47 +02:00
AI Assistant db6662be39 feat(registratura): structured ClosureInfo who/when/why/attachment for every close
- Added ClosureInfo type with reason, closedBy, closedAt, linkedEntry, hadActiveDeadlines, attachment
- Rewrote close-guard-dialog into universal close dialog (always shown on close)
  - Reason field (always required)
  - Optional continuation entry search+link
  - Optional closing document attachment (file upload)
  - Active deadlines shown as warning banner when present
- Created ClosureBanner component (read-only, shown at top of closed entry edit)
  - Shows who, when, why, linked entry (clickable), attached doc (downloadable)
- All closes now go through the dialog  no more silent closeEntry
- Linked-entries sub-dialog preserved as second step
2026-02-27 17:06:03 +02:00
AI Assistant 5b99ad0400 fix(registratura): add 'certificat' to deadline-add-dialog CATEGORIES array 2026-02-27 16:53:06 +02:00
AI Assistant 80e41d4842 fix(registratura): 5 post-3.02 fixes - QuickContact pre-fill (useEffect sync), form close on contact create (stopPropagation), Switch label 'Inchis' -> 'Status', CU moved from Avize to own category, close guard for active deadlines 2026-02-27 16:02:10 +02:00
AI Assistant 2be0462e0d feat(registratura): 3.02 bidirectional integration, simplified status, threads
- Dynamic document types: string-based DocumentType synced with Tag Manager
  (new types auto-create tags under 'document-type' category)
- Added default types: 'Apel telefonic', 'Videoconferinta'
- Bidirectional Address Book: quick-create contacts from sender/recipient/
  assignee fields via QuickContactDialog popup
- Simplified status: Switch toggle replaces dropdown (default open)
- Responsabil (Assignee) field with contact autocomplete (ERP-ready)
- Entry threads: threadParentId links entries as replies, ThreadView shows
  parent/current/children tree with branching support
- Info tooltips on deadline, status, and assignee fields
- New Resp. column and thread icon in registry table
- All changes backward-compatible with existing data
2026-02-27 15:33:29 +02:00