From 4d2f924537961b0200f1bed86236d0ac5674b1b4 Mon Sep 17 00:00:00 2001 From: AI Assistant Date: Sun, 8 Mar 2026 14:08:48 +0200 Subject: [PATCH] pre-launch hardening: Address Book type sort, Hot Desk proportions, TVA calculator, ROADMAP Phase 4B - Address Book: type dropdown always sorted alphabetically (ro locale), including custom types - Hot Desk: window ~half height (top-[35%] bottom-[35%]), door ~double height (h-16) - Mini Utilities: TVA calculator (19%) with add/extract modes, RON formatting, copy buttons - ROADMAP: new Phase 4B Pre-Launch Hardening with 10 structured tasks - CLAUDE.md: bumped versions (Address Book 0.1.1, Mini Utilities 0.1.1, Hot Desk 0.1.1), Visual Copilot separate repo note --- CLAUDE.md | 10 +- ROADMAP.md | 141 +++++++++++++++--- SESSION-LOG.md | 12 +- .../components/address-book-module.tsx | 32 ++-- .../hot-desk/components/desk-room-layout.tsx | 10 +- .../components/mini-utilities-module.tsx | 111 ++++++++++++++ 6 files changed, 269 insertions(+), 47 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index e8d6293..8222c4d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -104,16 +104,16 @@ legacy/ # Original HTML tools for reference | 4 | **Registratura** | `/registratura` | 0.4.0 | CRUD registry, dynamic doc types, bidirectional Address Book, threads, backdating, **legal deadline tracking**, recipient registration, document expiry, **NAS network path attachments** (A/O/P/T drives, copy-to-clipboard), **detail sheet side panel**, **configurable column visibility**, **QuickLook attachment preview** (images: zoom/pan, PDFs: native viewer, multi-file navigation) | | 5 | **Tag Manager** | `/tag-manager` | 0.2.0 | CRUD tags, category/scope/color, US/SDT seeds, mandatory categories, **ManicTime bidirectional sync** | | 6 | **IT Inventory** | `/it-inventory` | 0.2.0 | Dynamic equipment types, rented status (purple pulse), **42U rack visualization**, type/status/company filters | -| 7 | **Address Book** | `/address-book` | 0.1.0 | CRUD contacts, card grid, vCard export, Registratura reverse lookup, **dynamic types (creatable)** | +| 7 | **Address Book** | `/address-book` | 0.1.1 | CRUD contacts, card grid, vCard export, Registratura reverse lookup, **dynamic types (creatable)**, **alphabetically sorted type dropdown** | | 8 | **Password Vault** | `/password-vault` | 0.3.0 | CRUD credentials, 9 categorii cu iconițe, **WiFi QR code real**, context-aware form, strength meter, company scope, **AES-256-GCM encryption** | -| 9 | **Mini Utilities** | `/mini-utilities` | 0.1.0 | Text case, char counter, percentage, area converter, U→R, artifact cleaner, MDLPA, PDF reducer, OCR | +| 9 | **Mini Utilities** | `/mini-utilities` | 0.1.1 | Text case, char counter, percentage, **TVA calculator (19%)**, area converter, U→R, num→text, artifact cleaner, MDLPA, PDF reducer, OCR, color palette | | 10 | **Prompt Generator** | `/prompt-generator` | 0.2.0 | Template-driven prompt builder, **18 templates** (14 text + 4 image), search bar, target type filter | | 11 | **Digital Signatures** | `/digital-signatures` | 0.1.0 | CRUD assets, drag-and-drop file upload, tag chips | | 12 | **Word Templates** | `/word-templates` | 0.1.0 | Template library, 8 categories, version tracking, .docx placeholder auto-detection | | 13 | **AI Chat** | `/ai-chat` | 0.2.0 | Multi-provider (OpenAI/Claude/Ollama/demo), **project linking via Tag Manager**, provider status badge | -| 14 | **Hot Desk** | `/hot-desk` | 0.1.0 | 4 desks, week-ahead calendar, room layout (window+door), reserve/cancel | -| 15 | **ParcelSync** | `/parcel-sync` | 0.5.0 | eTerra ANCPI integration, **PostGIS database**, background sync, 23-layer catalog, enrichment pipeline, owner search, **per-UAT analytics dashboard**, **health check + maintenance detection** | -| 16 | **Visual Copilot** | `/visual-copilot` | 0.1.0 | AI-powered image analysis (placeholder/early stage) | +| 14 | **Hot Desk** | `/hot-desk` | 0.1.1 | 4 desks, week-ahead calendar, room layout (window+door proportioned), reserve/cancel | +| 15 | **ParcelSync** | `/parcel-sync` | 0.5.0 | eTerra ANCPI integration, **PostGIS database**, background sync, 23-layer catalog, enrichment pipeline, owner search, **per-UAT analytics dashboard**, **health check + maintenance detection** | +| 16 | **Visual Copilot** | `/visual-copilot` | 0.1.0 | AI-powered image analysis — **developed in separate repo** (`https://git.beletage.ro/gitadmin/vim`), placeholder in ArchiTools, will be merged as module later | ### Registratura — Legal Deadline Tracking (Termene Legale) diff --git a/ROADMAP.md b/ROADMAP.md index 6653ecd..bfa149e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -30,26 +30,26 @@ ## Current Module Status (after Phase 3 completion) -| # | Module | Version | Status | Remaining Gaps | Future Enhancements | -| --- | ------------------ | ------- | -------- | ---------------------------------------- | ------------------------------------------------- | -| 1 | Registratura | 0.3.0 | COMPLETE | — | Workflow automation, email integration, OCR | -| 2 | Email Signature | 0.1.0 | COMPLETE | US/SDT addresses may need update | AD sync, branding packs, promo banners | -| 3 | Word XML | 0.1.0 | COMPLETE | — | Schema validator, visual mapper | -| 4 | Digital Signatures | 0.1.0 | COMPLETE | — | Permission layers, document insertion | -| 5 | Password Vault | 0.3.0 | COMPLETE | — | Hardware key, rotation reminders, Passbolt | -| 6 | IT Inventory | 0.2.0 | COMPLETE | — | Network scan import | -| 7 | Address Book | 0.1.0 | COMPLETE | — | Email sync, deduplication | -| 8 | Prompt Generator | 0.2.0 | COMPLETE | — | Prompt scoring, more image templates | -| 9 | Word Templates | 0.1.0 | COMPLETE | No clause library; no Word generation | Diff compare, document generator | -| 10 | Tag Manager | 0.2.0 | COMPLETE | ManicTime needs SMB mount on Docker host | Smart suggestions | -| 11 | Mini Utilities | 0.1.0 | COMPLETE | — | More converters, DWG→DXF | -| 12 | Dashboard | 0.1.0 | COMPLETE | — | Custom dashboards per role | -| 13 | AI Chat | 0.2.0 | COMPLETE | Needs API key env vars for real AI | Streaming, model selector, conversation templates | -| 14 | Hot Desk | 0.1.0 | COMPLETE | — | — | -| 15 | ParcelSync | 0.5.0 | COMPLETE | Needs real-world UAT testing at scale | Map visualization, batch enrichment, export tools | -| 16 | Visual Copilot | 0.1.0 | STUB | Placeholder only | AI image analysis integration | +| # | Module | Version | Status | Remaining Gaps | Future Enhancements | +| --- | ------------------ | ------- | --------- | --------------------------------------------------- | ------------------------------------------------- | +| 1 | Registratura | 0.4.0 | HARDENING | Legal deadline workflow gaps, chain logic | Workflow automation, email integration, OCR | +| 2 | Email Signature | 0.1.0 | COMPLETE | US/SDT addresses may need update | AD sync, branding packs, promo banners | +| 3 | Word XML | 0.1.0 | COMPLETE | — | Schema validator, visual mapper | +| 4 | Digital Signatures | 0.1.0 | COMPLETE | — | Permission layers, document insertion | +| 5 | Password Vault | 0.3.0 | COMPLETE | — | Hardware key, rotation reminders, Passbolt | +| 6 | IT Inventory | 0.2.0 | COMPLETE | — | Network scan import | +| 7 | Address Book | 0.1.1 | COMPLETE | — | Email sync, deduplication | +| 8 | Prompt Generator | 0.2.0 | HARDENING | Bug fixes, new idea TBD | Prompt scoring, more image templates | +| 9 | Word Templates | 0.1.0 | COMPLETE | No clause library; no Word generation | Diff compare, document generator | +| 10 | Tag Manager | 0.2.0 | HARDENING | Logic/workflow fix, ERP API exposure needed | Smart suggestions | +| 11 | Mini Utilities | 0.1.1 | COMPLETE | — | More converters, DWG→DXF, more tools TBD | +| 12 | Dashboard | 0.1.0 | COMPLETE | — | Custom dashboards per role | +| 13 | AI Chat | 0.2.0 | COMPLETE | Needs API key env vars for real AI | Streaming, model selector, conversation templates | +| 14 | Hot Desk | 0.1.1 | COMPLETE | — | — | +| 15 | ParcelSync | 0.5.0 | COMPLETE | Needs real-world UAT testing at scale | Map visualization, batch enrichment, export tools | +| 16 | Visual Copilot | 0.1.0 | SEPARATE | Dev in separate repo (git.beletage.ro/gitadmin/vim) | AI image analysis, merge into ArchiTools later | -**Phases 1–3 COMPLETE (all 42 tasks).** Phase 7B (ParcelSync) COMPLETE. Next: Phase 4 (Quality & Testing) or module hardening. +**Phases 1–3 COMPLETE (all 42 tasks).** Phase 7B (ParcelSync) COMPLETE. Phase 4B (Pre-Launch Hardening) IN PROGRESS. --- @@ -684,6 +684,7 @@ Env vars (hardcoded in docker-compose.yml for Portainer CE): **Status:** ✅ Done. `eterra-health.ts` singleton, `/api/eterra/health` endpoint, session route blocks login, UI shows amber pill with message extraction. **Bugs found & fixed during ParcelSync development:** + - Timeout 40s too low for geometry pages → increased to 120s - `arr[0]` access fails TS strict even after length check → assign to const - `?? ""` on `{}` typed field produces `{}` → use `typeof` check @@ -691,6 +692,108 @@ Env vars (hardcoded in docker-compose.yml for Portainer CE): --- +## PHASE 4B — Pre-Launch Hardening (2026-03 — OFFICE TESTING) + +> Final fixes and polish before rolling out to the office for daily use. +> Official testing start: **2026-03-09**. All critical items must be resolved. + +### 4B.01 ✅ `[LIGHT]` Address Book — Type Dropdown Alphabetical Sort (2026-03-08) + +**What:** Type dropdown (filter + creation form) always sorted alphabetically by Romanian label, including newly created custom types. +**Files:** `src/modules/address-book/components/address-book-module.tsx` +**Status:** ✅ Done. `allTypes` memo sorted with `localeCompare('ro')`. `CreatableTypeSelect` entries merged and sorted. + +--- + +### 4B.02 ✅ `[LIGHT]` Hot Desk — Window/Door Proportions (2026-03-08) + +**What:** Room layout: window ~half current height, door ~double current height. Window indicator dots reduced from 6 to 3. +**Files:** `src/modules/hot-desk/components/desk-room-layout.tsx` +**Status:** ✅ Done. Window: `top-[35%] bottom-[35%]` (was `top-4 bottom-4`). Door: `h-16` (was `h-8`). + +--- + +### 4B.03 ✅ `[STANDARD]` Mini Utilities — TVA Calculator (2026-03-08) + +**What:** Quick VAT calculator with 19% Romanian rate. Two modes: "Adaugă TVA" (add to net) and "Extrage TVA" (extract from gross). Copy buttons, formatted RON output. +**Files:** `src/modules/mini-utilities/components/mini-utilities-module.tsx` +**Status:** ✅ Done. New `TvaCalculator` component with mode toggle, RON formatting, copy-to-clipboard. + +--- + +### 4B.04 `[STANDARD]` Registratura — Legal Deadline Workflow Fixes + +**What:** Fix gaps in the legal deadline tracking logic: +- Chain deadline workflow (resolving one → prompt to add next in sequence) +- Backward deadline edge cases (e.g., AC extension 45 working days BEFORE expiry) +- Tacit approval auto-detection when overdue + applicable type +- UI polish for deadline dashboard (filters, sorting, edge states) +**Files:** `src/modules/registratura/services/deadline-service.ts`, `components/deadline-dashboard.tsx`, `components/deadline-add-dialog.tsx` +**Status:** TODO + +--- + +### 4B.05 `[STANDARD]` Tag Manager — Logic/Workflow Fix + ERP API + +**What:** +- Fix tag assignment and filtering logic/workflow issues +- Expose tags via API for external ERP integration (read-only endpoint for tag list + project assignments) +- Verify ManicTime bidirectional sync still works +**Files:** `src/modules/tag-manager/`, `src/app/api/` (new tags API route) +**Status:** TODO + +--- + +### 4B.06 `[STANDARD]` Prompt Generator — Bug Fixes + New Features + +**What:** Address known bugs and implement new ideas (details TBD from user testing): +- Fix any template rendering issues +- Add new templates as requested +- Implement user-suggested feature improvements +**Files:** `src/modules/prompt-generator/` +**Status:** TODO — awaiting user feedback from testing + +--- + +### 4B.07 `[HEAVY]` Authentik SSO — Verify & Fix + +**What:** End-to-end verification that Authentik OIDC login works: +- Verify auth.beletage.ro accessibility +- Test login flow (redirect → auth → callback → session) +- Verify group→role/company mapping +- Fix any issues with NextAuth v4 + Authentik provider config +- Ensure session persistence and token refresh +**Files:** `src/core/auth/`, `src/app/api/auth/`, `.env` / `docker-compose.yml` +**Status:** TODO — critical for multi-user testing + +--- + +### 4B.08 `[STANDARD]` DB/Storage — End-to-End Verification + +**What:** Verify all 14 modules correctly persist to PostgreSQL: +- Test CRUD operations for each module +- Verify data survives container restart +- Check storage adapter fallback behavior +- Validate MinIO file storage connection (adapter pending) +**Files:** `src/core/storage/`, `src/app/api/storage/`, `prisma/schema.prisma` +**Status:** TODO + +--- + +### 4B.09 `[STANDARD]` Mini Utilities — Additional Tools (TBD) + +**What:** User will provide a list of additional quick tools to add to the Mini Utilities module. +**Status:** TODO — awaiting user list + +--- + +### 4B.10 `[LIGHT]` Visual Copilot — Separate Repo Documentation + +**What:** Visual Copilot is being developed in a **separate repository**: `https://git.beletage.ro/gitadmin/vim`. Current ArchiTools placeholder stays as-is. Module will be merged back as a proper module when ready. +**Status:** DOCUMENTED — no code changes needed in ArchiTools + +--- + ## PHASE 8 — Advanced Features > Cross-cutting features that enhance the entire platform. diff --git a/SESSION-LOG.md b/SESSION-LOG.md index 0ffb37a..1c5b57e 100644 --- a/SESSION-LOG.md +++ b/SESSION-LOG.md @@ -48,12 +48,12 @@ ParcelSync module development continuation — owner search, UAT dashboard, eTer ### Bugs Found & Fixed -| Bug | Root Cause | Fix | -|-----|-----------|-----| -| `timeout of 40000ms exceeded` on TERENURI_ACTIVE | Default 40s too short for 1000-feature geometry pages | Increased to 120s | -| `suprafata` type `{}` not assignable to `string\|number` | `?? ""` on enrichment field typed `{}` produces `{}` | `typeof x === 'number'` explicit check | -| `Object is possibly 'undefined'` on `topOwners[0]` | TS strict: `arr[0]` is `T\|undefined` even after `length > 0` | Assign to const, `if (const)` guard | -| eTerra maintenance shows as "Eroare conectare" | No health check, login attempt fails with generic error | Health check + maintenance detection + amber UI state | +| Bug | Root Cause | Fix | +| -------------------------------------------------------- | ------------------------------------------------------------- | ----------------------------------------------------- | +| `timeout of 40000ms exceeded` on TERENURI_ACTIVE | Default 40s too short for 1000-feature geometry pages | Increased to 120s | +| `suprafata` type `{}` not assignable to `string\|number` | `?? ""` on enrichment field typed `{}` produces `{}` | `typeof x === 'number'` explicit check | +| `Object is possibly 'undefined'` on `topOwners[0]` | TS strict: `arr[0]` is `T\|undefined` even after `length > 0` | Assign to const, `if (const)` guard | +| eTerra maintenance shows as "Eroare conectare" | No health check, login attempt fails with generic error | Health check + maintenance detection + amber UI state | ### Learnings diff --git a/src/modules/address-book/components/address-book-module.tsx b/src/modules/address-book/components/address-book-module.tsx index b4dbbba..809a8f6 100644 --- a/src/modules/address-book/components/address-book-module.tsx +++ b/src/modules/address-book/components/address-book-module.tsx @@ -80,15 +80,22 @@ export function AddressBookModule() { null, ); - // Collect all contact types (defaults + custom ones from existing contacts) + // Collect all contact types (defaults + custom ones from existing contacts), sorted alphabetically by label const allTypes = useMemo(() => { - const types = { ...DEFAULT_TYPE_LABELS }; + const types: Record = { ...DEFAULT_TYPE_LABELS }; for (const c of allContacts) { if (c.type && !types[c.type]) { types[c.type] = c.type; // custom type — label is the type itself } } - return types; + // Sort entries alphabetically by label + const sorted: Record = {}; + for (const [k, v] of Object.entries(types).sort((a, b) => + a[1].localeCompare(b[1], "ro"), + )) { + sorted[k] = v; + } + return sorted; }, [allContacts]); const handleSubmit = async ( @@ -652,15 +659,16 @@ function CreatableTypeSelect({ - {Object.entries(DEFAULT_TYPE_LABELS).map(([k, label]) => ( - - {label} - - ))} - {/* Show current custom value if not in defaults */} - {value && !DEFAULT_TYPE_LABELS[value] && ( - {value} - )} + {Object.entries(DEFAULT_TYPE_LABELS) + .concat( + value && !DEFAULT_TYPE_LABELS[value] ? [[value, value]] : [], + ) + .sort((a, b) => a[1].localeCompare(b[1], "ro")) + .map(([k, label]) => ( + + {label} + + ))} + + +
+ +
+ setAmount(e.target.value)} + placeholder={mode === "add" ? "Ex: 1000" : "Ex: 1190"} + className="flex-1" + /> + + RON + +
+
+ {!isNaN(val) && val > 0 && ( +
+ {mode === "add" ? ( + <> +

+ Sumă fără TVA: {fmt(val)} RON +

+

+ TVA ({TVA_RATE}%): {fmt(tvaAmount)} RON + +

+

+ Total cu TVA:{" "} + {fmt(cuTva)} RON + +

+ + ) : ( + <> +

+ Sumă cu TVA: {fmt(val)} RON +

+

+ TVA ({TVA_RATE}%): {fmt(tvaAmount)} RON + +

+

+ Sumă fără TVA:{" "} + {fmt(faraTva)} RON + +

+ + )} +
+ )} + + ); +} + function AreaConverter() { const units = [ { key: "mp", label: "mp (m²)", factor: 1 }, @@ -1207,6 +1305,9 @@ export function MiniUtilitiesModule() { Procente + + TVA + Suprafețe @@ -1263,6 +1364,16 @@ export function MiniUtilitiesModule() { + + + + Calculator TVA (19%) + + + + + +