diff --git a/CLAUDE.md b/CLAUDE.md index af2d12b..becb158 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -101,7 +101,7 @@ legacy/ # Original HTML tools for reference | 1 | **Dashboard** | `/` | 0.1.0 | KPI cards (6), activity feed (last 20), module grid, external tools | | 2 | **Email Signature** | `/email-signature` | 0.1.0 | Multi-company branding, address toggle (BTG/US/SDT), live preview, zoom/copy/download | | 3 | **Word XML Generator** | `/word-xml` | 0.1.0 | Category-based XML gen, simple/advanced mode, ZIP export | -| 4 | **Registratura** | `/registratura` | 0.5.0 | CRUD registry, dynamic doc types, bidirectional Address Book, threads, backdating, **legal deadline tracking** (6 categories, 18 types), 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), **email notifications** (Brevo SMTP daily digest, per-user preferences) | +| 4 | **Registratura** | `/registratura` | 0.5.0 | CRUD registry, dynamic doc types, bidirectional Address Book, threads, backdating, **legal deadline tracking** (6 categories, 18 types), 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), **email notifications** (Brevo SMTP daily digest, per-user preferences), **compact registry numbers** (single-letter company badge + direction arrow + plain number) | | 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.1 | CRUD contacts, card grid, vCard export, Registratura reverse lookup, **dynamic types (creatable)**, **alphabetically sorted type dropdown** | @@ -135,6 +135,7 @@ Key files: - `components/deadline-dashboard.tsx` — Stats + filters + table - `components/deadline-add-dialog.tsx` — 3-step wizard (category → type → date preview) - `components/notification-preferences.tsx` — Bell button + dialog with per-type toggles +- `components/registry-table.tsx` — `CompactNumber` component: single-letter company badge (B/U/S/G), direction arrow (↓ intrat / ↑ iesit), plain number ### Email Notifications (Brevo SMTP) @@ -145,6 +146,7 @@ Platform-level notification service for daily email digests: - **Per-user preferences**: stored in KeyValueStore (`notifications` namespace), toggle global opt-out + 3 notification types - **Digest content**: urgent deadlines (<=5 days), overdue deadlines, expiring documents (CU/AC) - **HTML email**: inline-styled table layout, color-coded rows (red/yellow/blue), per-company grouping +- **Sender**: "Alerte Termene" <noreply@beletage.ro>, test mode via `?test=true` query param Key files: diff --git a/ROADMAP.md b/ROADMAP.md index bedb514..7a6fb0c 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -826,18 +826,22 @@ Env vars (hardcoded in docker-compose.yml for Portainer CE): --- -### 8.03 ✅ `[STANDARD]` Notification System (2026-03-11) +### 8.03 ✅ `[STANDARD]` Notification System + Registratura UI Polish (2026-03-11) -**What:** Email notification system with daily digest via Brevo SMTP + N8N cron. +**What:** Email notification system with daily digest via Brevo SMTP + N8N cron. Plus Registratura toolbar and registry number UX improvements. **Implemented:** -- Brevo SMTP relay (nodemailer, port 587 STARTTLS) +- Brevo SMTP relay (nodemailer, port 587 STARTTLS), sender "Alerte Termene" <noreply@beletage.ro> - Daily digest email: urgent deadlines, overdue deadlines, expiring documents - Per-user notification preferences (3 types + global opt-out) stored in KeyValueStore - API routes: POST `/api/notifications/digest` (N8N Bearer auth), GET/PUT `/api/notifications/preferences` (session auth) -- UI: Bell button "Notificari" in Registratura toolbar → dialog with toggles +- Test mode via `?test=true` query param on digest endpoint +- "group" company users see ALL entries across companies in digest +- UI: Bell icon button "Notificari" in Registratura toolbar → dialog with toggles +- Icon-only toolbar buttons (Bune practici + Notificari) with native `title` tooltips - HTML email: inline-styled tables, color-coded rows (red/yellow/blue), per-company grouping - N8N cron: `0 8 * * 1-5` (weekdays 8:00) -**Files:** `src/core/notifications/`, `src/app/api/notifications/`, `components/notification-preferences.tsx` +- **Compact registry numbers**: single-letter company badge (B=blue, U=violet, S=green, G=gray) + direction arrow (↓ green=intrat, ↑ orange=iesit) + plain number — `CompactNumber` component in `registry-table.tsx` +**Files:** `src/core/notifications/`, `src/app/api/notifications/`, `components/notification-preferences.tsx`, `components/registry-table.tsx` --- diff --git a/docs/REPO-STRUCTURE.md b/docs/REPO-STRUCTURE.md index 7b69bb7..8d2a4e7 100644 --- a/docs/REPO-STRUCTURE.md +++ b/docs/REPO-STRUCTURE.md @@ -99,6 +99,11 @@ ArchiTools/ │ │ │ ├── use-theme.ts # Hook for theme access │ │ │ ├── tokens.ts # Design token definitions │ │ │ └── index.ts # Public API +│ │ ├── notifications/ +│ │ │ ├── types.ts # NotificationType, NotificationPreference, DigestSection +│ │ │ ├── email-service.ts # Nodemailer transport singleton (Brevo SMTP) +│ │ │ ├── notification-service.ts # runDigest(), buildCompanyDigest(), preference CRUD +│ │ │ └── index.ts # Public API │ │ └── auth/ │ │ ├── auth-provider.tsx # Auth context provider (stub) │ │ ├── use-auth.ts # Hook for auth state @@ -324,6 +329,8 @@ Platform core systems. These are infrastructure services used by all modules. Co - **`theme/`** — Dark/light theme system. Provides the theme context, toggle hook, and design token definitions. Theme preference is persisted in storage. Tokens define colors, spacing, and typography values consumed by Tailwind and component styles. +- **`notifications/`** — Email notification service. Daily digest via Brevo SMTP relay (nodemailer, port 587 STARTTLS). Includes `runDigest()` orchestrator, `buildCompanyDigest()` for per-company deadline aggregation, `renderDigestHtml()` for inline-styled email, and preference CRUD via KeyValueStore (`notifications` namespace). API routes: POST `/api/notifications/digest` (N8N cron, Bearer auth), GET/PUT `/api/notifications/preferences` (user session auth). + - **`auth/`** — Authentication and authorization stub. Defines the `AuthContext` interface (`user`, `role`, `permissions`, `company`). Currently returns a default admin user. When Authentik SSO integration is implemented, this module will resolve real identity from OIDC tokens. The interface remains stable; only the provider implementation changes. ### `src/modules/` diff --git a/docs/architecture/SYSTEM-ARCHITECTURE.md b/docs/architecture/SYSTEM-ARCHITECTURE.md index c7e8224..a4bb937 100644 --- a/docs/architecture/SYSTEM-ARCHITECTURE.md +++ b/docs/architecture/SYSTEM-ARCHITECTURE.md @@ -449,7 +449,7 @@ ArchiTools runs alongside existing services on the internal network: **Automation integration (N8N):** N8N triggers scheduled workflows via API endpoints. Active: daily digest cron calls `POST /api/notifications/digest` with Bearer token auth. Future: document processing, backups. -**Email notifications (Brevo SMTP):** Platform service in `src/core/notifications/`. Nodemailer transport singleton connects to Brevo SMTP relay. `runDigest()` loads all registry entries, groups by company, builds digest per subscriber filtering by their preference types (urgent, overdue, expiry), renders inline-styled HTML, sends via SMTP. Preferences stored in KeyValueStore (namespace `notifications`). +**Email notifications (Brevo SMTP):** Platform service in `src/core/notifications/`. Nodemailer transport singleton connects to Brevo SMTP relay. Sender: "Alerte Termene" <noreply@beletage.ro>. `runDigest()` loads all registry entries, groups by company, builds digest per subscriber filtering by their preference types (urgent, overdue, expiry), renders inline-styled HTML, sends via SMTP. Test mode via `?test=true` query param. "group" company users receive digest with ALL entries. Preferences stored in KeyValueStore (namespace `notifications`). **SSO integration (Authentik):** Authentik OIDC provides user identity. NextAuth v4 JWT/session callbacks map Authentik groups to roles and companies. Notification preferences auto-refresh user email/name/company from session on each save. diff --git a/docs/guides/CONFIGURATION.md b/docs/guides/CONFIGURATION.md index fb53809..e0c384a 100644 --- a/docs/guides/CONFIGURATION.md +++ b/docs/guides/CONFIGURATION.md @@ -66,7 +66,7 @@ BREVO_SMTP_PORT=587 BREVO_SMTP_USER= # Brevo SMTP login (from Brevo dashboard) BREVO_SMTP_PASS= # Brevo SMTP key (from Brevo dashboard) NOTIFICATION_FROM_EMAIL=noreply@beletage.ro -NOTIFICATION_FROM_NAME=ArchiTools +NOTIFICATION_FROM_NAME=Alerte Termene NOTIFICATION_CRON_SECRET= # Random Bearer token for N8N → digest API auth # ----------------------------------------------------------------------------- diff --git a/docs/guides/DOCKER-DEPLOYMENT.md b/docs/guides/DOCKER-DEPLOYMENT.md index d05ee03..a071308 100644 --- a/docs/guides/DOCKER-DEPLOYMENT.md +++ b/docs/guides/DOCKER-DEPLOYMENT.md @@ -214,11 +214,11 @@ BREVO_SMTP_PORT=587 BREVO_SMTP_USER= BREVO_SMTP_PASS= NOTIFICATION_FROM_EMAIL=noreply@beletage.ro -NOTIFICATION_FROM_NAME=ArchiTools +NOTIFICATION_FROM_NAME=Alerte Termene NOTIFICATION_CRON_SECRET= ``` -> **N8N cron setup:** Create a workflow with Cron node (`0 8 * * 1-5`), HTTP Request node (POST `https://tools.beletage.ro/api/notifications/digest`, header `Authorization: Bearer `). The endpoint returns `{ success, totalEmails, errors, companySummary }`. +> **N8N cron setup:** Create a workflow with Cron node (`0 8 * * 1-5`), HTTP Request node (POST `https://tools.beletage.ro/api/notifications/digest`, header `Authorization: Bearer `). The endpoint returns `{ success, totalEmails, errors, companySummary }`. Add `?test=true` query param to send a test digest with sample data. ### Variable Scoping Rules