Commit Graph

53 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 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 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 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 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 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 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 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 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 da33dc9b81 feat(address-book): vCard export and Registratura reverse lookup 2026-02-19 06:57:40 +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 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 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
AI Assistant 7a5206e771 feat(mini-utilities): add 5 new tools - U/R converter, AI cleaner, MDLPA, PDF reducer, OCR 2026-02-19 00:22:17 +02:00
AI Assistant 81cfdd6aa8 feat(tag-manager): add US/SDT project seeds + mandatory validation (task 1.04)
- Add 10 Urban Switch projects (US-001 to US-010, color #345476)
- Add 10 Studii de Teren projects (SDT-001 to SDT-010, color #0182A1)
- Enforce mandatory project code + company scope for project category tags
- Show inline validation errors on create form
- Add hint text for project/phase mandatory categories
- Update seed import dialog to mention all 3 companies
2026-02-18 23:43:50 +02:00
AI Assistant b8b9c7cf97 feat(prompt-generator): add 10 architecture/professional templates (task 1.03)
New builtin templates:
- Architectural rendering: massing-to-detail (materials, terrain, camera)
- Sketch to professional render (preserve design intent)
- Photorealism refinement (fix AI rendering issues, camera settings)
- Technical compliance checker (Romanian norms P100, P118, C107)
- Legal/formal document review (contracts, permits, contestations)
- Contract text cleanup (rewrite, standardize, remove redundancy)
- GIS/survey data interpretation (Stereo70, cadastral, DTM)
- BIM coordination (clash detection, EIR, BEP, ISO 19650)
- Technical report rewriting (audience adaptation)
- Structured technical Q&A (multi-domain, variable complexity)

Total builtin templates: 4 -> 14
2026-02-18 23:33:34 +02:00
AI Assistant 42260a17a4 fix(email-signature): correct addresses, add Albac, fix logo sizing, update US/SDT colors from logos, fix hydration error
- Fix all 3 address constants: Christescu (nr. 12, 400416), Unirii (nr. 3 sc. 3 ap. 26, 400432), Albac (nr. 2 ap. 1, 400459)
- Add 3rd address option (Albac) to all company address selectors
- Default address changed to Christescu for all companies
- Update US brand colors to logo blue (#345476), SDT to logo teal (#0182A1)
- Fix slashAccent for US/SDT (was pointing to logo files instead of slash assets)
- Add logoDimensions to CompanyBranding type for per-company logo sizing
- Set US logo to 140x24 and SDT to 71x24 (matching SVG aspect ratios)
- Fix sidebar hydration error: remove unused useTheme() hook call
- Update color palettes in configurator to match logo-derived colors

Tasks: 1.01 (verified), 1.02 (address toggle + fixes)
2026-02-18 23:09:10 +02:00
AI Assistant 1db61d87f4 feat(email-signature): add address toggles for Urban Switch and Studii de Teren 2026-02-18 21:58:00 +02:00
Marius Tarau bb01268bcb feat(registratura): add legal deadline tracking system (Termene Legale)
Full deadline tracking engine for Romanian construction permitting:
- 16 deadline types across 5 categories (Avize, Completări, Analiză, Autorizare, Publicitate)
- Working days vs calendar days with Romanian public holidays (Orthodox Easter via Meeus)
- Backward deadlines (AC extension: 45 working days BEFORE expiry)
- Chain deadlines (resolving one prompts adding the next)
- Tacit approval auto-detection (overdue + applicable type)
- Tabbed UI: Registru + Termene legale dashboard with stats/filters/table
- Inline deadline cards in entry form with add/resolve/remove
- Clock icon + count badge on registry table for entries with deadlines

Also adds CLAUDE.md with full project context for AI assistant handoff.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:27:34 +02:00
Marius Tarau f0b878cf00 fix: guard against undefined fields when loading old localStorage data
Old entries in localStorage lack new fields (department, role, contactPersons,
linkedEntryIds, attachments, versions, placeholders, ipAddress, vendor, model).
Add null-coalescing guards to prevent client-side crashes on property access.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:49:08 +02:00
Marius Tarau 2c9f0bc6b7 feat(word-templates): add company pools, template cloning, typed categories, and placeholder display
- TemplateCategory union type (8 values) replacing plain string
- Company-specific filtering in template list
- Template cloning with clone badge indicator
- Placeholder display ({{VARIABLE}} markers) in card and form
- Delete confirmation dialog
- updatedAt timestamp support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:35:47 +02:00
Marius Tarau 455d95a8c6 feat(digital-signatures): add version history, expiration tracking, and metadata fields
- Version history with add-version dialog and history display
- Expiration date with expired/expiring-soon visual indicators
- Legal status and usage notes fields
- Delete confirmation dialog
- updatedAt timestamp support
- Image preview in version history

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:35:42 +02:00
Marius Tarau c3abbf1c4b feat(password-vault): add password generator, custom fields, and delete confirmation
- Password generator with configurable length and character types (upper/lower/digits/symbols)
- Custom fields support (key-value pairs per entry)
- Delete confirmation dialog
- Custom fields displayed as badges in list view

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:35:38 +02:00
Marius Tarau f7e6cbbc65 feat(it-inventory): add IP/MAC/warranty/cost/rack/vendor/model fields and delete confirmation
- New fields: ipAddress, macAddress, warrantyExpiry, purchaseCost, rackLocation, vendor, model
- Delete confirmation dialog
- Expanded table columns for vendor/model and IP
- Search includes IP, vendor, and model
- Form layout with organized field groups

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:35:33 +02:00
Marius Tarau 93cf6feae2 feat(email-signature): wire SDT/US branding, address selector, color palettes, improved preview
- Per-company branding for Urban Switch and Studii de Teren (logos, websites, mottos)
- Beletage address selector (Str. Unirii vs Str. G-ral Eremia Grigorescu)
- Company-specific color palettes in configurator
- Scrollable preview with multi-level zoom (0.75x to 2.5x)
- Address override support in signature config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:35:28 +02:00
Marius Tarau 98eda56035 feat(registratura): rework with company-prefixed numbering, directions, deadlines, attachments
- Company-specific numbering (B-0001/2026, US-0001/2026, SDT-0001/2026)
- Direction: Intrat/Ieșit replaces old 3-way type
- 9 document types: Contract, Ofertă, Factură, Scrisoare, etc.
- Status simplified to Deschis/Închis with cascade close for linked entries
- Address Book autocomplete for sender/recipient
- Deadline tracking with overdue day counter
- File attachment support (base64 encoding)
- Linked entries system

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:35:23 +02:00
Marius Tarau 84d9db4515 feat(address-book): rebuild with multi-contact, project links, and extended fields
- Add ContactPerson sub-entities for multi-contact per company
- Add department, role, website, secondary email/phone, projectIds fields
- Add internal contact type alongside client/supplier/institution/collaborator
- Project tag picker using core TagService project tags
- Updated search to include department and role

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 06:35:17 +02:00