Files
ArchiTools/ROADMAP.md
T
2026-02-28 01:55:12 +02:00

715 lines
42 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ArchiTools — Complete Roadmap
> Step-by-step implementation plan. Every task from `app_modules_overview.xlsx` is tracked here.
> Modules are implemented in dependency order, tested by the AI, then submitted for user approval.
---
## Workflow
1. AI picks the next task from this file (top to bottom)
2. AI implements it, runs `npx next build` (zero errors required)
3. AI commits and pushes to `main` (Portainer auto-deploys)
4. AI notifies you: "Module X / Task Y is ready for review"
5. You test on `http://10.10.10.166:3000` and approve or request changes
6. AI moves to the next task
---
## AI Model Recommendations
| Tag | Claude | OpenAI | Google | Best For |
| ------------ | ---------- | ------------- | ---------------- | ---------------------------------------------------------------------- |
| `[HEAVY]` | Opus 4.6 | GPT-5.3-Codex | Gemini 3 Pro | Complex multi-file features, business logic, architecture, new modules |
| `[STANDARD]` | Sonnet 4.6 | GPT-5.2 | Gemini 3 Flash | Refactoring, moderate features, UI work, tests, documentation |
| `[LIGHT]` | Haiku 4.5 | GPT-4o-mini | Gemini 2.5 Flash | Quick fixes, small edits, config changes, build debugging |
**Default recommendation: Sonnet 4.6** — it matches Opus-class performance at Sonnet pricing ($3/$15 per M tokens). Use Opus only for tasks marked `[HEAVY]`. Use Haiku for tasks marked `[LIGHT]`.
---
## Current Module Status vs. XLSX Spec
| # | Module | Core Done | Gaps Remaining | New Features Needed |
| --- | ------------------ | ----------- | -------------------------------------------------------------------------------- | ------------------------------------------- |
| 1 | Registratura | YES | Linked-entry selector capped at 20 | Workflow automation, email integration, OCR |
| 2 | Email Signature | YES | US/SDT logo files may be missing from `/public/logos/`; US/SDT no address toggle | AD sync, branding packs |
| 3 | Word XML | YES | POT/CUT toggle exists (spec says remove) | Schema validator, visual mapper |
| 4 | Digital Signatures | YES | No file upload (URL only); tags not editable in form | Permission layers, document insertion |
| 5 | Password Vault | YES | Unencrypted storage; no strength meter; no company scope | Hardware key, rotation reminders |
| 6 | IT Inventory | YES | assignedTo not linked to contacts; no maintenance log | Network scan import |
| 7 | Address Book | YES | No vCard export; no reverse Registratura lookup | Email sync, deduplication |
| 8 | Prompt Generator | YES | Missing architecture viz templates (sketch→render, photorealism) | Prompt scoring |
| 9 | Word Templates | YES | No clause library; placeholders manual only; no Word generation | Diff compare, document generator |
| 10 | Tag Manager | YES | No US/SDT project seeds; no mandatory-category enforcement | Server tag sync, smart suggestions |
| 11 | Mini Utilities | PARTIAL | Missing: U→R value, AI artifact cleaner, MDLPA validator, PDF reducer, OCR | More converters |
| 12 | Dashboard | BASIC | No activity feed, no notifications, no KPI panels | Custom dashboards per role |
| 13 | AI Chat | DEMO ONLY | No API integration, no key config, no streaming | Conversation templates |
| 14 | Hot Desk | NOT STARTED | Entire module missing | — |
---
## PHASE 1 — Module Gap Fixes (close all xlsx gaps)
> Fix existing modules to match the xlsx spec. Ordered by impact and dependency.
### 1.01 ✅ `[LIGHT]` Verify Email Signature Logo Files (2026-02-18)
**What:** Check if `/public/logos/logo-us-dark.svg`, `logo-us-light.svg`, `logo-sdt-dark.svg`, `logo-sdt-light.svg` exist. If not, create placeholder SVGs or obtain real logos from the user.
**Files:** `public/logos/`
**Why first:** Broken images are the most visible bug.
**User action needed:** Provide actual logo files for Urban Switch and Studii de Teren if placeholders won't do.
**Status:** All logo files exist with valid SVG content. No action needed.
---
### 1.02 ✅ `[STANDARD]` Email Signature — Address Toggle for US/SDT (2026-02-18)
**What:** Urban Switch and Studii de Teren are hardcoded to Str. Unirii address. Add address toggle (like Beletage has) if these companies use different addresses.
**Files:** `src/modules/email-signature/components/signature-configurator.tsx`, `src/modules/email-signature/services/company-branding.ts`
**User action needed:** Confirm addresses for Urban Switch and Studii de Teren.
**Status:** Address toggle UI added for US and SDT companies. Currently configured with Str. Unirii address for both. User can update addresses in company-branding.ts when confirmed.
---
### 1.03 ✅ `[STANDARD]` Prompt Generator — Architecture Visualization Templates (2026-02-18)
**What:** Add 6+ new builtin templates per xlsx spec:
1. Architectural rendering prompt (basic massing to detailed)
2. Sketch → professional render prompt
3. Visualization refinement prompt (photorealism fine-tuning)
4. Technical compliance checking prompt
5. Legal/formal review prompt (extend existing)
6. Contract text cleanup prompt
7. GIS / survey interpretation prompt
8. BIM coordination prompt
9. Report rewriting prompt
10. Structured technical Q&A prompt
**Files to modify:** `src/modules/prompt-generator/services/builtin-templates.ts`
**Files to create:** Additional template definitions (can be in same file or split)
**Status:** 10 new templates added (total 14): arch-render-massing, sketch-to-render, photorealism-refinement, tech-compliance, legal-formal-review, contract-cleanup, gis-survey-interpretation, bim-coordination, report-rewrite, structured-qa.
---
### 1.04 ✅ `[STANDARD]` Tag Manager — US/SDT Project Seeds + Mandatory Categories (2026-02-18)
**What:**
1. Add Urban Switch and Studii de Teren project numbering to seed data (US-001, SDT-001 format)
2. Enforce mandatory 1st category (project) and 2nd category (phase) when creating tags — show validation error if missing
3. Import the full tag structure from `legacy/manicprojects/current manic time Tags.txt` in proper 1st→5th category hierarchy
**Files to modify:**
- `src/modules/tag-manager/services/seed-data.ts` — Add US/SDT projects
- `src/modules/tag-manager/components/tag-create-form.tsx` — Add mandatory validation
**Status:** US (10 projects, US-001→US-010, color #345476) and SDT (10 projects, SDT-001→SDT-010, color #0182A1) seed data added. Mandatory validation enforces project code + company scope for project tags. Validation errors shown inline. Legacy ManicTime import already covered all Beletage projects + phases + activities + doc types.
---
### ✅ 1.05 `[STANDARD]` Mini Utilities — Add Missing Tools
**What:** Add the 5 missing tools from xlsx:
1. **U-value → R-value converter** (R = 1/U, with material thickness input)
2. **AI artifact cleaner** (strip markdown formatting, fix encoding, remove prompt artifacts from pasted text)
3. **MDLPA date locale validator** (validate Romanian administrative dates against legal calendar)
4. **PDF reducer** (compress PDF via Stirling PDF API at http://10.10.10.166:8087, or client-side canvas compression for images)
5. **Quick OCR** (paste image → extract text; use Tesseract.js client-side or Stirling PDF OCR endpoint)
**Files to modify:** `src/modules/mini-utilities/components/mini-utilities-module.tsx`
**Dependencies:** `tesseract.js` (for OCR), possibly Stirling PDF API calls
**Status:** ✅ Done. All 5 tools implemented: U→R calculator (with Rsi/Rse/λ), AI artifact cleaner (markdown strip + encoding fix + typography normalise), MDLPA iframe embed, PDF reducer via Stirling PDF API with level selector, OCR via ocr.z.ai iframe. Build passes, pushed to main.
---
### ✅ 1.06 `[STANDARD]` Digital Signatures — File Upload + Tag Editing
**What:**
1. Add drag-and-drop / file picker for uploading signature/stamp images (convert to base64 on upload, like Registratura attachments)
2. Add tag input field to the asset form (tags field exists in type but form doesn't render it)
**Files to modify:**
- `src/modules/digital-signatures/components/` — asset form component
**Status:** ✅ Done. Drag-and-drop/click file picker cu preview base64 în `AssetForm` și `AddVersionForm`. Tags chip input (Enter/virgulă pentru adăugare, Backspace/X pentru ștergere). Build ok, pushat.
---
### ✅ 1.07 `[LIGHT]` Password Vault — Company Scope + Strength Meter
**What:**
1. Add `company` field to credential type and form (scope passwords to a company)
2. Add password strength indicator (visual bar: weak/medium/strong based on length + character diversity)
3. Rename `encryptedPassword``password` in the type (it's not encrypted, the name is misleading)
**Files to modify:**
- `src/modules/password-vault/types.ts`
- `src/modules/password-vault/components/` — form and list components
**Status:** ✅ Done. Renamed `encryptedPassword``password` in type. Added `company: CompanyId` field. Form now has company selector (Beletage/Urban Switch/Studii/Grup). Password strength meter with 4 levels (slabă/medie/puternică/foarte puternică) based on length + character diversity (upper/lower/digit/symbol). Meter updates live. Build ok, pushat.
### ✅ 1.08 `[LIGHT]` IT Inventory — Link assignedTo to Address Book
**What:** Change `assignedTo` from free text to an autocomplete that links to Address Book contacts (same pattern as Registratura sender/recipient).
**Files to modify:**
- `src/modules/it-inventory/components/` — equipment form
- `src/modules/it-inventory/types.ts` — Add `assignedToContactId?: string`
**Status:** ✅ Done. Added `assignedToContactId?: string` field to InventoryItem type. Form now shows autocomplete dropdown filtering Address Book contacts (searches by name or company). Up to 5 suggestions shown. Clicking a contact pre-fills both display name and contact ID. Placeholder "Caută după nume..." guides users. Build ok, pushed.
---
### ✅ 1.09 `[STANDARD]` Address Book — vCard Export + Registratura Reverse Lookup
**What:**
1. Add "Export vCard" button per contact (generate `.vcf` file download)
2. Add a section showing Registratura entries where this contact appears as sender or recipient
**Files to modify:**
- `src/modules/address-book/components/` — contact card/detail view
**Files to create:**
- `src/modules/address-book/services/vcard-export.ts`
**Status:** ✅ Done. Created `vcard-export.ts` generating vCard 3.0 (.vcf) with name, org, title, phones, emails, address, website, notes, contact persons. Added Download icon button on card hover. Added detail dialog (FileText icon) showing full contact info + scrollable table of all Registratura entries where this contact appears as sender or recipient (uses `allEntries` to bypass filters). Build ok, pushed.
### ✅ 1.10 `[STANDARD]` Word Templates — Placeholder Auto-Detection
**What:** When a template file URL points to a `.docx`, parse it client-side to extract `{{placeholder}}` patterns and auto-populate the `placeholders[]` field. Use JSZip (already installed) to read the docx XML.
**Files to modify:**
- `src/modules/word-templates/components/` — template form
**Files to create:**
- `src/modules/word-templates/services/placeholder-parser.ts`
**Status:** ✅ Done. `placeholder-parser.ts` uses JSZip to read all `word/*.xml` files from the .docx ZIP, searches for `{{...}}` patterns in both raw XML and stripped text (handles Words split-run encoding). Form now has: “Alege fișier .docx” button (local file picker, most reliable — no CORS) and a Wand icon on the URL field for URL-based detection (may fail on CORS). Parsing spinner shown during detection. Detected placeholders auto-populate the field. Build ok, pushed.
### ✅ 1.11 `[STANDARD]` Dashboard — Activity Feed + KPI Panels
**What:**
1. Add an activity feed showing recent actions across modules (last 20 creates/updates/deletes from localStorage timestamps)
2. Add KPI cards: entries this week, deadlines this week, overdue count, contacts added this month
3. Wire the `DashboardWidget` type that already exists in `types.ts`
**Files to modify:** `src/modules/dashboard/components/` or `src/app/(modules)/page.tsx`
**Status:** ✅ Done. Created `src/modules/dashboard/hooks/use-dashboard-data.ts` — scans all `architools:*` localStorage keys directly, extracts entities with timestamps, builds activity feed (last 20, sorted by `updatedAt`) and KPI counters. Updated `src/app/page.tsx`: KPI grid (6 cards: registratura this week, open dosare, deadlines this week, overdue in red, new contacts this month, active IT equipment), activity feed with module icon + label + action + relative time (Romanian locale). Build ok, pushed.
---
### ✅ 1.12 `[LIGHT]` Registratura — Increase Linked-Entry Selector Limit
**What:** Added search/filter input (by number, subject, sender) to the linked-entry selector. Removed `.slice(0, 20)` cap. Also improved chip labels to show truncated subject.
**Commit:** `cd4b0de`
**Status:** Done ✅
---
### ✅ 1.13 `[LIGHT]` Word XML — Remove POT/CUT Auto-Calculation
**What:** Removed `computeMetrics` entirely from `XmlGeneratorConfig`, `generateCategoryXml`, `generateAllCategories`, `downloadZipAll`, `useXmlConfig`, `XmlSettings`, and `WordXmlModule`. Fields kept; auto-injection removed.
**Commit:** `eaca24a`
**Status:** Done ✅
---
## PHASE 2 — New Module: Hot Desk Management ✅
> Module 14 from xlsx. Entirely new.
### 2.01 ✅ `[HEAVY]` Hot Desk Module — Full Implementation (2026-02-26)
**What:** Build Module 14 from scratch per xlsx spec.
**Status:** ✅ Done. Full implementation: 4 desks, week-ahead calendar, reserve/cancel, room layout with window (left) + door (right) landmarks, history. Registered in modules/navigation/flags.
---
## PHASE 3 — Replanificare Detaliată (Ideation & Requirements)
> Fază adăugată pentru rafinarea cerințelor, UX și logicii de business înainte de implementarea tehnică.
### 3.01 ✅ `[UI/UX]` Header & Navigare Globală (2026-02-27)
**Cerințe noi:**
- **Logo-uri:** Mărirea dimensiunii logo-urilor în header.
- **Mini-joc Logo:** Click pe logo-uri le animează (spin/bounce/ping), combo secret BTG→US→SDT declanșează confetti.
- **Navigare:** Click pe titlul aplicației redirecționează către Dashboard.
- **Theme Toggle:** Slider animat sun/moon cu gradient zi/noapte, stele, nori.
- **Dark mode logos:** Variante corecte light/dark pe baza temei, cu fallback montat.
**Status:** ✅ Done. Sidebar redesigned: logos in centered row (flex-1, theme-aware, dual-render light+dark), "ArchiTools" text below, animated theme toggle (Sun/Moon lucide icons, gradient background, stars/clouds).
### 3.02 ✅ `[BUSINESS]` Registratura — Integrare și UX (2026-02-27)
**Cerințe noi:**
- **Tipuri de documente (Bidirecțional):** Câmpul de tip document comunică cu Tag Manager. Dacă se introduce un tip nou, se salvează automat ca etichetă nouă sub o categorie fixă "Registratura" (pentru a acoperi și apeluri telefonice, video-uri, nu doar documente fizice).
- **Expeditor/Destinatar (Bidirecțional):** Autocomplete legat de Address Book. Dacă un contact nu există, se creează automat (minim Nume) și apare un popup rapid pentru a adăuga opțional Telefon/Email.
- **Status Simplificat:** Eliminarea statusului "Deschis". Înlocuire cu un simplu checkbox "Închis" (implicit totul e deschis).
- **Termen Limită Intern:** Clarificarea funcției (ex: termen pentru a răspunde la o intrare). Adăugare tooltip/info box explicativ pentru a maximiza eficiența echipei.
- **Pregătire Integrare ERP (Responsabil):** Adăugarea unui câmp "Responsabil" (Assignee) pentru a aloca sarcini interne, gândit arhitectural pentru a putea fi expus/sincronizat ușor printr-un API/Webhook viitor către un sistem ERP extern.
- **Legături între intrări/ieșiri (Thread-uri & Branches):** Posibilitatea de a lega o ieșire de o intrare specifică (ex: "Răspuns la adresa nr. X"), creând un "fir" (thread) vizual al conversației instituționale. Trebuie să suporte și "branching" (ex: o intrare generează mai multe ieșiri conexe către instituții diferite). UI-ul trebuie să rămână extrem de simplu și intuitiv (ex: vizualizare tip arbore simplificat sau listă indentată în detaliile documentului).
**Status:** ✅ Done. All 6 sub-features implemented:
1. **Dynamic doc types** — Select + inline "Tip nou" input. New types auto-created as Tag Manager tags (category: document-type). Added "Apel telefonic" and "Videoconferință" as defaults.
2. **Bidirectional Address Book** — Autocomplete shows "Creează contact" button when no match. QuickContactDialog popup creates contact in Address Book with minimal data (Name required, Phone/Email optional).
3. **Simplified status** — Replaced Status dropdown with Switch toggle "Închis/Deschis". Default is open.
4. **Internal deadline tooltip** — Added Info tooltip explaining "Termen limită intern" vs legal deadlines. Also added tooltips on "Închis" and "Responsabil" fields.
5. **Responsabil (Assignee)** — New field with contact autocomplete + quick-create. ERP-ready with separate assigneeContactId. Shown in registry table as "Resp." column.
6. **Threads & Branching**`threadParentId` field links entries as reply-to. Thread search with direction badges. ThreadView component shows parent, current entry, siblings (branches), and child replies as indented tree. Thread icon in table. Click to navigate between threaded entries.
### 3.03 `[BUSINESS]` Registratura — Termene Legale (Flux Nou)
**Cerințe noi:**
- **Declanșare Termen:** Termenul legal pentru ieșiri curge DOAR de la data înregistrării la destinatar, nu de la data trimiterii interne.
- **Câmpuri Noi:** "Număr înregistrare destinatar" și "Data înregistrare destinatar".
- **Sistem de Alerte:** Notificări/Atenționări clare (în Dashboard și în modul) pentru ieșirile cu termen legal care NU au încă completate datele de la destinatar.
- **Categorii Termene:** Mutarea "Certificat de Urbanism" (CU) pe prima pagină/categorie principală (nu sub Avize). Adăugare subcategorie: "Cerere de prelungire CU".
- **Acord Tacit:** Modificare automată a statusului pentru documentele fără răspuns în termenul legal (acord tacit).
- **Generare Raport/Declarație (Integrare Word Templates):** Generarea unui mini-log/raport combinat cu o "Declarație pe proprie răspundere" a proiectantului. Se va folosi un șablon din modulul _Word Templates_, populat automat cu datele din Registratură (data trimiterii, lipsa răspunsului), permițând editarea ulterioară în Word.
- **Istoric Modificări Termene (Audit Log):** Un mini-log de audit vizibil pe fiecare termen legal (cine a modificat data, când a fost adăugat numărul de la destinatar). _Notă: Necesită implementarea autentificării (Phase 6 - Authentik) pentru a asocia acțiunile cu utilizatori reali din Active Directory._
- **Valabilitate Documente (Expirare CU/AC):** Adăugarea unui sistem de urmărire a valabilității pentru documente emise (ex: Certificat de Urbanism, Autorizație de Construire). Sistemul trebuie să permită setarea unei date de expirare și să genereze alerte/reamintiri cu X zile înainte de expirare (pentru a iniția procedurile de prelungire).
- **Pregătire Web Scraping (Wishlist):** Adăugarea unui câmp opțional "URL Verificare Status" (ex: link către portalul primăriei) și "ID Urmărire Extern". Arhitectura trebuie să permită pe viitor rularea unui job de fundal (ex: via N8N sau un worker intern) care să facă scraping/API call pe acel URL și să actualizeze automat statusul în ArchiTools.
### 3.04 ✅ `[ARCHITECTURE]` Autentificare & Identitate (2026-02-27)
**Cerințe noi:**
- **Devansare Prioritate Authentik:** Integrarea cu Authentik (legat la Domain Controller/Active Directory).
- **Sincronizare Useri:** Sistemul poate citi lista de utilizatori din Authentik/AD.
**Status:** ✅ Done. NextAuth v4 + Authentik OIDC fully configured. Group→role mapping (admin/manager/user) and group→company mapping. Header user menu with login/logout. Env vars hardcoded in docker-compose.yml (Portainer CE limitation). See also Phase 6 below.
### 3.05 `[BUSINESS]` Email Signature — Automatizare și Branding
**Cerințe noi:**
- **Sincronizare Active Directory:** Precompletarea automată a câmpurilor (Nume, Funcție, Telefon, Email) pe baza utilizatorului logat (via Authentik/AD), eliminând necesitatea introducerii manuale.
- **Bannere Promoționale Centrale:** Posibilitatea de a adăuga un banner imagine/link sub semnătură (ex: "Suntem închiși de sărbători", "Proiect nou"). Acestea trebuie să poată fi gestionate centralizat (ex: un admin setează bannerul activ pentru toată compania).
- **Slider Dimensiune Logo:** Adăugarea unui control (slider) în UI pentru a ajusta fin dimensiunea logo-ului companiei în semnătura generată.
- **Elemente Grafice Personalizate (Icoane Adresă/Telefon):** Înlocuirea elementelor grafice generice (liniile oblice de la Beletage) cu elemente vizuale specifice și distincte pentru Urban Switch și Studii de Teren, păstrând un aspect interesant și profesional.
### 3.06 `[BUSINESS]` Template Library (Fostul Word Templates)
**Cerințe noi:**
- **Redenumire și Extindere:** Modulul devine "Template Library" (Șabloane Documente) pentru a suporta nu doar Word, ci și Excel (.xlsx), Archicad (.tpl, .pln), DWG, PDF, etc.
- **Sistem de Versionare Automat:** Eliminarea introducerii manuale a versiunii. Adăugarea unui buton "Revizie Nouă" care preia datele curente, incrementează automat versiunea (ex: v1.0 -> v1.1) și păstrează istoricul versiunilor anterioare pentru a putea descărca o variantă mai veche la nevoie.
- **Clarificare UX (URL, Magic Wand, Placeholders):**
- _Problema curentă:_ UI-ul cu URL și "Magic Wand" este confuz pentru utilizatori.
- _Soluția:_ Simplificarea interfeței. "Magic Wand-ul" (care extrage automat variabile de tip `{{Nume}}` din text) va rula automat și invizibil în fundal _doar_ când se încarcă un fișier `.docx`. Pentru Excel sau Archicad, această secțiune de "Placeholders" va fi ascunsă sau marcată ca indisponibilă, evitând confuzia.
- _Încărcare Fișiere:_ Distincție clară în UI între "Încarcă fișier" (care se va salva în viitorul MinIO) și "Adaugă link extern" (pentru fișiere mari ținute pe SharePoint/Nextcloud).
### 3.07 ✅ `[BUSINESS]` Digital Signatures — Simplificare și Suport TIFF (2026-02-28)
**Cerințe noi:**
- **Simplificare Formular:** Eliminarea câmpurilor inutile pentru fluxul actual: "inițiale", "data expirare", "statut legal" și "note utilizare".
- **Suport Nativ TIFF:** Permiterea încărcării fișierelor `.tiff` (formatul principal folosit pentru semnături/ștampile). _Notă tehnică: Deoarece browserele nu randează nativ TIFF, se va implementa o conversie client-side (ex: via `tiff.js` sau un canvas) doar pentru preview-ul vizual, dar sistemul va stoca și va folosi fișierul TIFF original._
- **Organizare pe Subcategorii:** Adăugarea posibilității de a grupa semnăturile/ștampilele pe subcategorii clare (ex: "Colaboratori firma X", "Experți tehnici", "Verificatori de proiect").
- **Opțiuni de Descărcare Avansate:**
- Descărcare fișier original (`.tiff` / `.png`).
- Generare și descărcare document Word (`.docx`) gol care conține imaginea inserată automat.
- Generare și descărcare document PDF gol care conține imaginea inserată automat.
**Status:** ✅ Done. Removed `initials` type, `expirationDate`, `legalStatus`, `usageNotes` fields. Added `subcategory` field with creatable input (6 defaults: Colaboratori, Experți tehnici, Verificatori de proiect, Proiectanți, Diriginți de șantier, Responsabili tehnici). TIFF upload via `utif2` client-side decode → PNG preview, original TIFF stored in `originalFileData`. Download dropdown on each card: Original, Word (.docx via `docx` lib), PDF (.pdf via `jsPDF`). Assets grouped by subcategory in list view with subcategory filter.
### 3.08 ✅ `[BUSINESS]` IT Inventory — Simplificare și Status Nou (2026-02-28)
**Cerințe noi:**
- **Eliminare Câmpuri Inutile:** Se vor șterge câmpurile "Atribuit către" (assignedTo), "Data achiziție", "Cost achiziție" și "Expirare garanție".
- **Tipuri Dinamice (Bidirecțional):** Câmpul "Tip echipament" (ex: Laptop, Monitor) trebuie să permită adăugarea interactivă de noi tipuri direct din formular (similar cu logica de la Registratură/Tag Manager).
- **Status Nou "Închiriat":** Adăugarea statusului "Închiriat" în lista de statusuri.
- **Atenționare Vizuală (Animație):** Când un echipament are statusul "Închiriat", badge-ul/rândul respectiv trebuie să aibă o animație subtilă (ex: un puls de culoare, un glow) pentru a "sări în ochi" în tabelul principal.
- **Vizualizare Rack (Server Rack 42U):**
- Adăugarea unei vizualizări grafice (schematice) a unui rack de servere standard de 42U.
- În formularul de echipament, dacă tipul este compatibil (ex: Server, Switch, UPS, Patch Panel), se vor adăuga două câmpuri noi: "Poziție Rack (U)" (ex: 12) și "Dimensiune (U)" (ex: 1U, 2U).
- Echipamentele care au aceste date completate vor fi randate automat în vizualizarea grafică a rack-ului.
- La hover pe un echipament din rack, va apărea un tooltip cu detaliile de bază (Nume, IP, Status).
**Status:** ✅ Done. Rewrote types.ts: dynamic `InventoryItemType` (string-based) with `DEFAULT_EQUIPMENT_TYPES` (added server/switch/ups/patch-panel), `RACK_MOUNTABLE_TYPES` set, new "rented" status with `STATUS_LABELS` export. Removed deprecated fields (assignedTo, purchaseDate, purchaseCost, warrantyExpiry). Added `rackPosition`/`rackSize` fields. New `server-rack.tsx` — 42U rack visualization with color-coded status slots and tooltips. Rewrote module component: tabbed UI (Inventar + Rack 42U), 5 stat cards with purple pulse animation for rented count, inline custom type creation, conditional rack position fields for mountable types.
### 3.09 ✅ `[BUSINESS]` Address Book — Tipuri Dinamice (2026-02-27)
**Cerințe noi:**
- **Tip Contact Dinamic:** Câmpul "Tip" devine "creatable select" (dropdown + text input) cu salvare automată.
**Status:** ✅ Done. `CreatableTypeSelect` component (input + "+" button), `DEFAULT_TYPE_LABELS` + dynamic types from existing contacts, `ContactType` allows `| string` for custom types.
### 3.10 ✅ `[UI/UX]` Hot Desk — Orientare Vizuală (2026-02-27)
**Cerințe noi:**
- **Punct de Reper (Fereastră):** Fereastră pe stânga, ușă pe dreapta.
**Status:** ✅ Done. Window on left wall (sky-blue, "Fereastră"), door on right wall (amber, "Ușă").
### 3.11 ✅ `[BUSINESS]` Password Vault — Câmpuri Noi (2026-02-27)
**Cerințe noi:**
- **Câmp Email:** Adăugarea unui câmp distinct pentru "Email", separat de "Username".
- **Link Clickabil:** URL afișat ca link clickabil (tab nou) din lista de parole.
**Status:** ✅ Done. Added `email: string` field to VaultEntry type. Form has email input. URLs rendered as clickable `<a>` links with `target="_blank"`.
### 3.12 `[BUSINESS]` Mini Utilities — Extindere și Fix-uri ✅ DONE (989a990)
**Implementat:**
-**Transformare Numere în Litere:** Convertor complet RO — lei/bani, variante compact și cu spații, suport până la 1 miliard
-**Convertor Suprafețe (Bidirecțional):** 5 câmpuri editabile (mp, ari, ha, km², sq ft), orice câmp actualizează restul
-**Convertor U ↔ R (Bidirecțional):** Toggle U→R / R→U, calcul cu Rsi/Rse/lambda
-**Fix MDLPA:** Iframe înlocuit cu 3 carduri link extern (portal, tutoriale, regulament)
-**PDF Reducer:** Drag & drop, 2 nivele (Echilibrat/Maximă), linkuri Deblocare PDF + PDF/A pe Stirling PDF
-**Extractor Paletă Culori:** Upload imagine → canvas downscale → top 8 culori ca swatches hex clickabile
- ⏭️ **DWG to DXF:** Amânat — necesită serviciu backend (ODA File Converter sau similar)
### 3.13 `[BUSINESS]` Tag Manager — Sincronizare ManicTime
**Cerințe noi:**
- **Sincronizare Bidirecțională:** Modulul trebuie să citească și să scrie direct în fișierul text folosit de ManicTime (`\\time\tags\Tags.txt` aflat pe serverul Windows 10 Enterprise LTSC). Orice tag adăugat în ArchiTools trebuie să apară în ManicTime și invers.
- **Versionare Fișier (Backup):** La fiecare modificare a fișierului `Tags.txt` din ArchiTools, sistemul trebuie să creeze automat un backup al versiunii anterioare (ex: `Tags_backup_YYYYMMDD_HHMMSS.txt`) în același folder, pentru a preveni pierderea accidentală a structurii de tag-uri.
- **Validare Ierarhie:** Asigurarea că tag-urile adăugate respectă formatul ierarhic cerut de ManicTime (ex: `Proiect, Faza, Activitate`).
### 3.14 `[ARCHITECTURE]` Storage & Securitate
**Cerințe noi:**
- **Migrare Storage (Prioritate):** Devansarea migrării de la `localStorage` la o soluție robustă (MinIO pentru fișiere și o bază de date reală, ex: PostgreSQL/Prisma) pentru a asigura persistența și partajarea datelor între toți utilizatorii.
- **Criptare Parole:** În modulul Password Vault, parolele trebuie criptate real în baza de date (nu doar ascunse în UI), eliminând warning-ul actual de securitate.
- **Integrare Passbolt (Wishlist):** Studierea posibilității de a lega Password Vault-ul din ArchiTools direct de instanța voastră de Passbolt (via API), pentru a avea un singur "source of truth" securizat pentru parole.
### 3.15 `[BUSINESS]` AI Tools — Extindere și Integrare
**Cerințe noi:**
- **Integrare AI Chat cu Tag Manager:** Sesiunile de chat trebuie să fie legate direct de proiectele din Tag Manager. Lista de proiecte va fi menținută actualizată de AI, iar utilizatorul va putea selecta la ce proiect se referă discuția curentă pentru a oferi context automat.
- **Prompt Generator (Extindere):** Adăugarea unei bare de căutare (Search) și a unor șabloane specifice pentru generare de imagini (ex: Midjourney/Stable Diffusion prompts pentru randări, explainer images, infografice arhitecturale).
- **Activare AI Chat (Demo/Live):** Conectarea modulului de AI Chat la un API real (OpenAI/Anthropic/Ollama) pentru a putea fi testat de echipă.
- **Generatoare Media (Node-based Canvas):** Interfața pentru generarea de imagini/media să fie construită pe un sistem _node-based_ (infinite canvas), permițând legarea vizuală a prompturilor, imaginilor de referință și setărilor.
- **Nod de Interpretare 3D (Wishlist):** Un nod avansat care preia o imagine/screenshot simplu și o interpretează într-o mini-scenă 3D (un viewport simplificat). De exemplu, obiectul principal devine un volum pe care utilizatorul îl poate roti în 3D (sau roti camera în jurul lui) pentru a explica vizual AI-ului ce modificări spațiale dorește (inspirat din concepte tip arXiv:2601.23265, adaptat pentru use-case-ul de arhitectură).
---
## PHASE 4 — Quality & Testing
> Foundation work: tests, CI, docs, data safety.
### 4.01 `[STANDARD]` Install Testing Framework (Vitest)
**What:** Install and configure Vitest with React Testing Library.
```bash
npm install -D vitest @testing-library/react @testing-library/jest-dom jsdom @vitest/coverage-v8
```
**Files to create:** `vitest.config.ts`, `src/test-setup.ts`
**Files to modify:** `package.json` (add test scripts)
---
### 4.02 `[STANDARD]` Unit Tests — Critical Services
**What:** Write tests for the most critical business logic:
1. `working-days.test.ts` — Orthodox Easter 2024-2030, addWorkingDays, backward deadlines
2. `deadline-service.test.ts` — Due date computation, tacit approval, chain resolution
3. `registry-service.test.ts` — Number generation, overdue calculation
4. `local-storage.test.ts` — CRUD, namespace isolation
5. `feature-flags.test.ts` — Defaults, env overrides
**Coverage target:** 90%+ for services.
---
### 4.03 `[STANDARD]` Data Export/Import for All Modules
**What:** Create a shared utility for backing up localStorage data:
1. Per-module JSON export (download file)
2. Per-module JSON import (upload + merge)
3. Full backup: export ALL modules as single JSON
4. Add export/import buttons to each module's main view
**Files to create:** `src/shared/hooks/use-data-export.ts`, `src/shared/components/common/data-export-button.tsx`
---
### 4.04 `[LIGHT]` Update Stale Documentation
**What:** Update docs to reflect current state:
- `docs/architecture/SYSTEM-ARCHITECTURE.md` — Change modules from "Planned" to "Implemented"
- `docs/DATA-MODEL.md` — Add TrackedDeadline, Hot Desk schemas
- `docs/REPO-STRUCTURE.md` — Add new files
---
### 4.05 `[LIGHT]` Wire External Tool URLs to Env Vars
**What:** `src/config/external-tools.ts` has hardcoded IPs. Wire to `process.env.NEXT_PUBLIC_*_URL` with fallback.
---
## PHASE 5 — AI Chat Integration
> Make Module 13 functional.
### 5.01 `[HEAVY]` AI Chat — Real API Integration
**What:** Replace demo mode with actual AI provider calls:
- Create `/api/ai/chat` server-side route (API keys never exposed to browser)
- Provider abstraction: Anthropic Claude, OpenAI GPT, Ollama (local)
- Response streaming via ReadableStream
- Model selector in the UI
- Token usage display
**Env vars:**
```
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
OLLAMA_BASE_URL=http://10.10.10.166:11434
AI_DEFAULT_PROVIDER=anthropic
AI_DEFAULT_MODEL=claude-sonnet-4-6-20261001
```
**User action needed:** Provide API keys when ready.
---
### 5.02 `[STANDARD]` AI Chat — Domain-Specific System Prompts
**What:** Architecture office-focused conversation modes:
- Romanian construction law assistant
- Architectural visualization prompt crafter
- Technical specification writer
- Urban planning regulation lookup
- Document drafting assistant
- Normative compliance checker
---
### 5.03 `[LIGHT]` Enable AI Chat Feature Flag
**What:** Set `module.ai-chat` enabled in `flags.ts` + production `.env`.
---
## PHASE 6 — Authentication (Authentik SSO) ✅
> Real users, real permissions. Core auth done, access control pending.
### 6.01 ✅ `[HEAVY]` Authentik OIDC Integration (2026-02-27)
**What:** Replace stub user with real Authentik SSO.
**Status:** ✅ Done. NextAuth v4 + Authentik OIDC provider configured. Group→role mapping (authentik groups → admin/manager/user). Group→company mapping (beletage/urban-switch/studii-de-teren). Cookie-based session. `useAuth()` returns real user. Header shows user name/email + logout. Sign in with Authentik page works.
Env vars (hardcoded in docker-compose.yml for Portainer CE):
- `NEXTAUTH_URL=https://tools.beletage.ro`
- `NEXTAUTH_SECRET`, `AUTHENTIK_CLIENT_ID`, `AUTHENTIK_CLIENT_SECRET`, `AUTHENTIK_ISSUER`
---
### 6.02 `[STANDARD]` Module-Level Access Control
**What:** Implement `canAccessModule()` with role-based rules. FeatureGate checks flag + permission.
**Depends on:** 6.01 ✅
---
### 6.03 `[STANDARD]` Data Visibility Enforcement
**What:** Filter storage results by `visibility` and `createdBy` fields (already stored on every entity, never enforced).
**Depends on:** 6.01 ✅
---
### 6.04 `[LIGHT]` Audit Logging
**What:** Log create/update/delete actions with user ID + timestamp. Console initially, later storage/N8N.
**Depends on:** 6.01 ✅
---
## PHASE 7 — Storage Migration (localStorage → Database) — PARTIALLY DONE
> Multi-user shared data. PostgreSQL + Prisma + MinIO client configured.
### 7.01 ✅ `[HEAVY]` PostgreSQL + Prisma Setup (2026-02-27)
**What:** PostgreSQL + Prisma ORM setup.
**Status:** ✅ Done. Prisma v6.19.2 with PostgreSQL on 10.10.10.166:5432. `KeyValueStore` model. `npx prisma generate` in Dockerfile. `@prisma/client` in dependencies.
---
### 7.02 ✅ `[HEAVY]` API Storage Adapter (2026-02-27)
**What:** `DatabaseStorageAdapter` implementing `StorageService` via `/api/storage` route + Prisma.
**Status:** ✅ Done. Set `NEXT_PUBLIC_STORAGE_ADAPTER=database` to activate. All 14 modules instantly get DB persistence.
---
### 7.03 `[STANDARD]` Data Migration Tool
**What:** One-time export from localStorage → import to PostgreSQL. Preserve IDs and timestamps.
**Depends on:** 7.02 ✅
---
### 7.04 ✅ `[HEAVY]` MinIO File Storage (2026-02-27)
**What:** MinIO client configured and tested.
**Status:** ✅ Done. MinIO client installed (`minio` npm package). Connected to 10.10.10.166:9002 (API) / 9003 (UI). Bucket `tools` exists. File upload adapter not yet wired to StorageService (MinioAdapter pending).
---
## PHASE 8 — Advanced Features
> Cross-cutting features that enhance the entire platform.
### 8.01 `[HEAVY]` Project Entity & Cross-Module Linking
**What:** New module: Projects. Central entity linking Registratura entries, Tags, Contacts, Templates.
**Reference:** `docs/DATA-MODEL.md` lines 566-582.
---
### 8.02 `[STANDARD]` Global Search (Cmd+K)
**What:** Search across all modules. Each module registers a search provider. Header bar integration.
---
### 8.03 `[STANDARD]` Notification System
**What:** Bell icon in header. Deadline alerts, overdue warnings, tacit approval triggers.
---
### 8.04 `[STANDARD]` Registratura — Print/PDF Export
**What:** Export registry as formatted PDF. Options: full registry, single entry, deadline summary.
---
### 8.05 `[STANDARD]` Word Templates — Clause Library + Document Generator
**What:** In-app clause composition, template preview, simple Word generation from templates.
---
### 8.06 `[STANDARD]` N8N Webhook Integration
**What:** Fire webhooks on events (new entry, deadline approaching, status change). N8N at http://10.10.10.166:5678.
---
### 8.07 `[STANDARD]` Mobile Responsiveness Audit
**What:** Test all modules on 375px/768px. Fix overflowing tables, forms, sidebar.
---
## PHASE 9 — Security & External Access
### 9.01 `[HEAVY]` Guest/External Access Role
**What:** Read-only guest role, time-limited share links. Depends on Authentik (Phase 6).
---
### 9.02 `[STANDARD]` CrowdSec Integration
**What:** IP banning for brute force. CrowdSec at http://10.10.10.166:8088.
---
### 9.03 `[LIGHT]` SSL/TLS via Let's Encrypt
**What:** When public domain ready, configure in Nginx Proxy Manager.
---
## PHASE 10 — CI/CD
### 10.01 `[STANDARD]` Gitea Actions CI Pipeline
**What:** `.gitea/workflows/ci.yml` — lint, typecheck, test, build on push.
**Check first:** Is Gitea Actions runner installed on server?
---
### 10.02 `[STANDARD]` E2E Tests (Playwright)
**What:** End-to-end tests for critical flows: navigation, Registratura CRUD, email signature, tag management.
---
## Infrastructure Credentials Needed
| Service | What | When Needed | Status |
| ------------------------ | --------------------------------------- | --------------------- | --------------------- |
| **US/SDT Logos** | SVG/PNG logo files | Phase 1 (task 1.01) | ✅ Done |
| **US/SDT Addresses** | Office addresses for email signature | Phase 1 (task 1.02) | ✅ Done (placeholder) |
| **Anthropic API Key** | `sk-ant-...` from console.anthropic.com | Phase 5 (task 5.01) | Pending |
| **OpenAI API Key** | `sk-...` from platform.openai.com | Phase 5 (task 5.01) | Pending |
| **Authentik Admin** | Login to create OAuth app at :9100 | Phase 6 (task 6.01) | ✅ Done |
| **MinIO Credentials** | Access key + secret key for :9003 | Phase 7 (task 7.04) | ✅ Done |
| **PostgreSQL** | Database + password | Phase 7 (task 7.01) | ✅ Done |
| **Gitea Actions Runner** | Registration token from Gitea admin | Phase 10 (task 10.01) | Pending |
---
## Quick Picker
**15 min tasks** `[LIGHT]`:
- 1.01 — Check logo files
- ~~1.07 — Password vault company + strength~~ ✅
- 1.08 — IT inventory contact link
- 1.12 — Registry linked-entry limit
- 1.13 — Remove POT/CUT auto-calc
- 3.04 — Update stale docs
- 3.05 — Wire env var URLs
**1 hour tasks** `[STANDARD]`:
- 1.03 — Prompt generator templates
- 1.04 — Tag manager seeds + mandatory
- ~~1.05 — Mini utilities new tools~~ ✅
- ~~1.06 — Digital signatures upload~~ ✅
- 1.09 — Address book vCard + reverse lookup
- 1.11 — Dashboard activity feed + KPIs
- 3.01 + 3.02 — Tests setup + core tests
**Full session tasks** `[HEAVY]`:
- 2.01 — Hot Desk module (new)
- 4.01 — AI Chat API integration
- 5.01 — Authentik SSO
- 6.01 + 6.02 — PostgreSQL + API adapter
- 7.01 — Project entity module