Commit Graph

75 Commits

Author SHA1 Message Date
AI Assistant b4338571cc 3.05 Email Signature Automatizare si Branding
- AD prefill: 'Din cont' button pre-fills name + company from Authentik session
- Logo size slider: 50%-200% scale control in Stil & Aranjare section
- Promotional banner: configurable image+link below signature with preview
- US/SDT custom graphics: dedicated dash (US) and dot (SDT) decorative icons
  replacing Beletage's grey/accent slashes for company-specific branding
2026-02-28 02:02:04 +02:00
AI Assistant 0a939417d8 ROADMAP: mark 3.12 Mini Utilities as done 2026-02-28 01:55:12 +02:00
AI Assistant 989a9908ba 3.12 Mini Utilities Extindere si Fix-uri
- NumberToText: Romanian number-to-words converter (lei/bani, compact, spaced)
- ColorPaletteExtractor: image upload -> top 8 color swatches with hex copy
- AreaConverter: bidirectional (mp, ari, ha, km2, sq ft)
- UValueConverter: bidirectional U->R and R->U toggle
- MDLPA: replaced broken iframe with 3 styled external link cards
- PdfReducer: drag-and-drop, simplified to 2 levels, Deblocare PDF + PDF/A links
- DWG-to-DXF skipped (needs backend service)
2026-02-28 01:54:40 +02:00
AI Assistant 6535c8ce7f docs: mark 3.07 Digital Signatures as done 2026-02-28 00:18:57 +02:00
AI Assistant 7774a3b622 feat(digital-signatures): simplify form, add TIFF support, subcategories, download options
- Remove 'initials' type, expirationDate, legalStatus, usageNotes fields
- Add subcategory field with creatable input + 6 default categories
- Add TIFF upload support with client-side utif2 decode for preview
- Store original TIFF data separately for faithful downloads
- Add download dropdown: Original file, Word (.docx), PDF (.pdf)
- Group assets by subcategory in list view
- Add subcategory filter in search bar
- Install docx, jspdf, utif2 packages
- Closes 3.07
2026-02-28 00:18:29 +02:00
AI Assistant a0ec4aed3f fix: move blob migration server-side, restore lightweight list loading
The client-side migration was downloading 25-50MB of base64 data to the
browser before showing anything. getAllEntries also lost its lightweight flag.

Fix:
- New POST /api/storage/migrate-blobs endpoint runs entirely server-side
  (loads entries one-at-a-time from PostgreSQL, never sends heavy data to browser)
- Restore lightweight:true on getAllEntries (strips remaining base64 in API)
- Migration fires on mount (fire-and-forget) while list loads independently
- Remove client-side migrateEntryBlobs function
2026-02-28 00:03:26 +02:00
AI Assistant 578f6580a4 fix: remove raw SQL query that may cause Docker build/runtime issues
Replace complex prisma.\ with simple Prisma findMany + JS stripping.
Now that entries are inherently small (base64 in separate blob namespace),
JS-based stripping is instant. Also fix migration to check flag before loading.
2026-02-27 23:53:37 +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 8385041bb0 perf: strip heavy base64 data at PostgreSQL level using raw SQL
Previous fix stripped data in Node.js AFTER Prisma loaded the full JSON
from PostgreSQL. For 5 entries with PDF attachments, this still meant
25-50MB transferring from DB to Node.js on every page load.

Now uses prisma.\ with nested jsonb_each/jsonb_object_agg to
strip data/fileData/imageUrl strings >1KB inside the database itself.
Heavy base64 never leaves PostgreSQL when lightweight=true.
2026-02-27 23:23:38 +02:00
AI Assistant 962d2a0229 docs: add base64 payload finding to SESSION-LOG and CLAUDE.md rules 2026-02-27 22:38:33 +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 db9bcd7192 docs: document N+1 performance bug findings and prevention rules 2026-02-27 22:27:07 +02:00
AI Assistant c45a30ec14 perf: fix N+1 query pattern across all modules + rack numbering
CRITICAL PERF BUG: Every hook did storage.list() (1 HTTP call fetching ALL
items with values, discarding values, returning only keys) then storage.get()
for EACH key (N individual HTTP calls re-fetching values one by one).

With 6 entries + contacts + tags, Registratura page fired ~40 sequential
HTTP requests on load, where 3 would suffice.

Fix: Replace list()+N*get() with single exportAll() call in ALL hooks:
- registratura/registry-service.ts (added exportAll to RegistryStorage interface)
- address-book/use-contacts.ts
- it-inventory/use-inventory.ts
- password-vault/use-vault.ts
- word-templates/use-templates.ts
- prompt-generator/use-prompt-generator.ts
- hot-desk/use-reservations.ts
- email-signature/use-saved-signatures.ts
- digital-signatures/use-signatures.ts
- ai-chat/use-chat.ts
- core/tagging/tag-service.ts (uses storage.export())

Additional fixes:
- registratura/use-registry.ts: addEntry uses optimistic local state update
  instead of double-refresh; closeEntry batches saves with Promise.all +
  single refresh
- server-rack.tsx: reversed slot rendering so U1 is at bottom (standard
  rack numbering, per user's physical rack)

Performance impact: ~90% reduction in HTTP requests on page load for all modules
2026-02-27 22:26:11 +02:00
AI Assistant 4cd793fbbc docs: update ROADMAP.md and SESSION-LOG.md for task 3.08 2026-02-27 22:05:56 +02:00
AI Assistant 346e40d788 feat(it-inventory): dynamic types, rented status, rack visualization, simplified form
- Rewrite types.ts: dynamic InventoryItemType (string-based), DEFAULT_EQUIPMENT_TYPES with server/switch/ups/patch-panel, RACK_MOUNTABLE_TYPES set, new 'rented' status with STATUS_LABELS export
- Remove deprecated fields: assignedTo, assignedToContactId, purchaseDate, purchaseCost, warrantyExpiry
- Add rack fields: rackPosition (1-42), rackSize (1-4U) on InventoryItem
- New server-rack.tsx: 42U rack visualization with color-coded status slots, tooltips, occupied/empty rendering
- Rewrite it-inventory-module.tsx: tabbed UI (Inventar + Rack 42U), 5 stat cards with purple pulse for rented count, inline custom type creation, conditional rack position fields for mountable types, simplified form
- Fix search filter in use-inventory.ts: remove assignedTo reference, search rackLocation/location

Task 3.08 complete
2026-02-27 22:04:47 +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
AI Assistant b2618c041d docs: update CLAUDE.md, ROADMAP.md, SESSION-LOG.md with all session findings 2026-02-27 13:26:45 +02:00
AI Assistant f6f7cf5982 fix: logo hydration + overflow, redesign theme toggle with Sun/Moon icons 2026-02-27 12:49:45 +02:00
AI Assistant ed9bbfe60a feat: redesign sidebar logos (wider, theme-aware) + animated sun/moon theme toggle 2026-02-27 12:36:39 +02:00
AI Assistant daa38420f7 fix: dark mode logo variants + increase logo size to 40px 2026-02-27 12:20:54 +02:00
AI Assistant dafbc1c69a feat: add Beletage logo + interactive 3-logo mini-game with secret combo confetti 2026-02-27 12:12:49 +02:00
AI Assistant 042e4e1108 feat: 3.01 header logos+nav, 3.09 dynamic contact types, 3.10 hot-desk window, 3.11 vault email+link 2026-02-27 11:33:20 +02:00
AI Assistant 100e52222e fix(deploy): hardcode env vars in docker-compose to ensure they reach the container 2026-02-27 11:01:06 +02:00
AI Assistant 041e2f00cb chore: add stack.env for Portainer Git deployment 2026-02-27 10:48:16 +02:00
AI Assistant ccba14a05e fix(deploy): add env vars to docker-compose, prisma generate in Dockerfile, move @prisma/client to deps 2026-02-27 10:43:32 +02:00
AI Assistant 0ad7e835bd feat(core): setup postgres, minio, and authentik next-auth 2026-02-27 10:29:54 +02:00
AI Assistant 3b1ba589f0 feat: add Hot Desk module (Phase 2) 4-desk booking with 2-week window, room layout, calendar, subtle unbooked-day alerts 2026-02-19 08:10:50 +02:00
AI Assistant 6cb655a79f docs: mark Phase 1 tasks 1.12 and 1.13 complete 2026-02-19 07:12:53 +02:00
AI Assistant eaca24aa58 feat(word-xml): remove POT/CUT auto-calculation toggle 2026-02-19 07:12:21 +02:00
AI Assistant cd4b0de1e9 feat(registratura): linked-entry search filter, remove 20-item cap 2026-02-19 07:08:59 +02:00
AI Assistant 1f2af98f51 feat(dashboard): activity feed and KPI panels 2026-02-19 07:05:41 +02:00
AI Assistant 713a66bcd9 feat(word-templates): placeholder auto-detection from .docx via JSZip 2026-02-19 07:02:12 +02:00
AI Assistant 67fd88813a docs: mark task 1.09 complete in ROADMAP and SESSION-LOG 2026-02-19 06:58:11 +02:00
AI Assistant da33dc9b81 feat(address-book): vCard export and Registratura reverse lookup 2026-02-19 06:57:40 +02:00
AI Assistant 35305e4389 docs: update SESSION-LOG and ROADMAP for tasks 1.07 and 1.08 2026-02-19 06:44:21 +02:00
AI Assistant a49dbb2ced feat(it-inventory): link assignedTo to Address Book contacts with autocomplete 2026-02-19 06:43:42 +02:00
AI Assistant b96b004baf feat(password-vault): add company scope and password strength meter 2026-02-19 06:43:30 +02:00
AI Assistant 8b0ad5c2d7 docs(roadmap): mark 1.07 password vault as done 2026-02-19 01:40:19 +02:00
AI Assistant 4502a01aa1 feat(password-vault): add company scope + password strength meter + rename encryptedPassword to password (task 1.07) 2026-02-19 01:39:45 +02:00
AI Assistant c940fab4e9 feat(flags): enable password-vault, it-inventory, address-book, word-templates 2026-02-19 01:29:51 +02:00
AI Assistant d89db0fa3b feat(flags): enable digital-signatures module 2026-02-19 01:29:24 +02:00
AI Assistant 8a2c5fa298 docs(roadmap): mark 1.06 digital signatures as done 2026-02-19 01:28:07 +02:00
AI Assistant 0fe53a566b feat(digital-signatures): drag-and-drop image upload (base64) + tags chip input (task 1.06) 2026-02-19 01:27:41 +02:00
AI Assistant 41036db659 fix(mini-utilities): Stirling PDF API key auth, Tesseract.js OCR, emoji removal in cleaner 2026-02-19 00:43:05 +02:00
AI Assistant 3154eb7f4a fix(mini-utilities): proxy compress-pdf through Next.js API route to bypass CORS 2026-02-19 00:32:13 +02:00
AI Assistant 124887bee6 feat(flags): enable mini-utilities module 2026-02-19 00:26:52 +02:00