# PR-Bericht: frontend_nyla (feat/saas-multi-tenant-mandates)

**Ziel-Branch:** `int`  
**Feature-Branch:** `feat/saas-multi-tenant-mandates`  
**Stand:** Januar 2026

---

## Übersicht

| Metrik | Wert |
|--------|------|
| **Anzahl Commits** | 73 |
| **Geänderte Dateien** | 455 |
| **Zeilen hinzugefügt** | ~78'604 |
| **Zeilen gelöscht** | ~15'070 |

---

## Wichtigste inhaltliche Änderungen

### 1. SaaS Multi-Mandate & Mandatsverwaltung
- Mandaten-Navigation und Mandatenwechsel im UI
- Mandats-Einladungen und Benachrichtigungssystem
- Mandats-Rollen und -Berechtigungen (RBAC)
- Zugriff auf Seiten und Features mandatenbasiert
- UID-/ID-Mapping und Referenzen für Multi-Mandate angepasst

### 2. Admin-Bereich
- Admin-Seiten: Mandate, RBAC-Rollen, RBAC-Regeln, Team-Mitglieder
- Feature-Zugriff, Benutzer-Zugriff, Mandats-Rollen-Berechtigungen
- Einladungsverwaltung, Benutzer-Mandate, Benutzerübersicht
- RBAC-Export/Import

### 3. Trustee (Treuhand)-Feature
- Trustee-Views: Dashboard, Positionen, Dokumente, Verträge, Rollen, Organisationen, Access
- Expense-Import-View, Positions-Dokumente
- Trustee-API und Hooks (`useTrustee`, `useTrusteeOptions`)

### 4. Workflows & Automation
- Workflow-Playground mit zentralem State, Log-Polling, Lifecycle-Hooks
- Automations-Seite und Workflows-Seite
- Workflow-Statistiken, verbesserte Log-Darstellung
- Chatbot-Integration (Messages, Dateien, Lifecycle)

### 5. PEK (Projekte & Stammdaten)
- Isoliert in Folder

### 6. Authentifizierung & Nutzerverwaltung
- Magic-Link-Login
- Passwort-Reset (Request & Reset-Seiten)
- Registrierung und Login überarbeitet
- Erweiterter Auth-Hook und CSRF-Utilities

### 7. GDPR & Rechtliches
- GDPR-konforme Seite/Flows
- PowerOn Home, Datenschutz, AGB als statische HTML-Seiten

### 8. UI/UX & Architektur
- Neues Page-Management (`core/PageManager`) mit datengetriebenen Seiten
- FormGenerator: Aufteilung in Form, List, Table, Controls, Action-Buttons
- Server-seitige Filter/Sort für generische Tabellen, Scroll-Lock für Header
- Sidebar überarbeitet, Mandaten-Navigation, Tree-Navigation, UserSection
- Notification-Bell, Access-Rules-Editor
- Layouts: `MainLayout`, `FeatureLayout`; Seiten: `FeatureView`, `Dashboard`, `Settings`
- Diverse UI-Komponenten (Log, Messages, MapView, Tabs, Toast, ViewForm, WorkflowStatus, etc.)

### 9. Konfiguration & Deployment
- Konfiguration in `config/` (env, serverConfig, universalConfig)
- Scripts nach `scripts/` (server, deploy-server)
- GitHub-Workflows angepasst, Node-Version 20

### 10. Weitere Features & Fixes
- Speech-Integration (Prototyp), Speech-Seiten & -Transkripte
- Real-Estate/Privilege-Checker isoliert in Folder
- Althaus-Seite, PEK-Tabs umbenannt (Projects, Data Management)
- Einstellungen-Seite, Basedata-Seiten (Connections, Files, Prompts)
- Privilege-Caching und -Checker konsolidiert
- Diverse Build- und TypeScript-Fixes, Hotfixes

---

## Geänderte Dateien (nach Bereichen)

### Konfiguration & Projekt
- `.cursorignore`, `.gitignore`, `.github/workflows/*.yml`
- `README.md`, `index.html`, `package.json`, `package-lock.json`
- `vite.config.ts`
- `config/*` (neu), `.env.*` → `config/.env.*`
- `scripts/server.js`, `scripts/deploy-server.js`
- `public/`: Favicon, Logos, `poweron-home.html`, `poweron-privacy.html`, `poweron-terms.html`

### API-Schicht
- `src/api.ts` (erweitert)
- Neu: `src/api/attributesApi.ts`, `authApi.ts`, `automationApi.ts`, `chatbotApi.ts`, `connectionApi.ts`, `featuresApi.ts`, `fileApi.ts`, `mandateApi.ts`, `permissionApi.ts`, `promptApi.ts`, `rbacRulesApi.ts`, `roleApi.ts`, `trusteeApi.ts`, `userApi.ts`, `workflowApi.ts`

### Auth & Provider
- `src/providers/auth/AuthProvider.tsx`, `ProtectedRoute.tsx`, `authConfig.ts`
- `src/providers/language/LanguageContext.tsx`
- `src/auth/ProtectedRoute.tsx` (entfernt/ersetzt)

### Core: PageManager
- `src/core/PageManager/PageManager.tsx`, `PageRenderer.tsx`, `SidebarProvider.tsx`, `pageInterface.ts`
- `src/core/PageManager/data/pages/*`: admin (mandates, rbac-role, rbac-rules, team-members), automations, chatbot, connections, dashboard, files, pek, pek-tables, prompts, settings, speech, speech-transcripts, trustee (access, contracts, documents, organisations, positions, roles), workflows
- `src/config/pageRegistry.tsx`

### Komponenten (Auswahl)
- **AccessRules:** AccessLevelSelect, AccessRulesEditor, AccessRulesTable + Styles
- **FormGenerator:** FormGeneratorControls, FormGeneratorForm, FormGeneratorList, FormGeneratorTable, ActionButtons (Copy, Custom, Delete, Download, Edit, Remove, View)
- **Navigation:** MandateNavigation, TreeNavigation, UserSection + Styles
- **NotificationBell**, **ContentPreview** (inkl. Renderer)
- **Sidebar:** Sidebar, SidebarItem, SidebarSubmenu, SidebarUser, Styles, Logic, Types
- **Dashboard/DashboardChat:** teils entfernt/umgebaut (Playground-basiert)
- **Connections, Dateien, Mitglieder, PageManager, Popup, Prompts:** entfernt oder nach core/Pages migriert
- **Speech:** SpeechConfirmation, SpeechInfo, SpeechSettings, SpeechSignUp
- **TestSharepoint:** Tabelle, Logic, Interfaces
- **Workflows:** WorkflowsTable, workflowsLogic, workflowsTypes
- **UiComponents:** AutoScroll, Button, ConnectedFilesList, CopyableTruncatedValue, DragDropOverlay, DropdownSelect, InfoMessageOverlay, LocationInput, Log/LogMessage, MapView, Messages/ChatMessages, ParcelInfoPanel, Popup, Tabs, TextField, Toast, ViewForm, VoiceLanguageSelect, WorkflowStatus
- **settings:** settingsUser

### Hooks
- Neu/erweitert: `useAccessRules`, `useAdminMandates`, `useAdminRbacRoles`, `useAdminRbacRules`, `useAuthentication`, `useAutomations`, `useChatbot`, `useConnections`, `useCurrentInstance`, `useFeatureAccess`, `useFiles`, `useInstancePermissions`, `useInvitations`, `useMandateRoles`, `useMandates`, `useNavigation`, `useNotifications`, `usePek`, `usePekTables`, `usePermissions`, `usePlayground`, `usePrompts`, `useRbacExportImport`, `useResizablePanels`, `useRoles`, `useSettings`, `useTrustee`, `useTrusteeOptions`, `useUserMandates`, `useUsers`, `useWorkflows`
- Playground: `useDashboardInputForm`, `useDashboardLogTree`, `useWorkflowLifecycle`, `useWorkflowPolling`, `useWorkflows`, `playgroundUtils`
- Entfernt: `useSharePointTest`

### Seiten
- **Neu:** `Dashboard.tsx`, `FeatureView.tsx`, `GDPR.tsx`, `InvitePage.tsx`, `PasswordResetRequest.tsx`, `Reset.tsx`, `Settings.tsx`
- **Login, Register:** überarbeitet
- **Home:** Connections, Dashboard, Dateien, Einstellungen, Prompts, TeamBereich, TestSharepoint, Workflows entfernt/ausgelagert; `Home.tsx` angepasst
- **admin/:** AdminFeatureAccessPage, AdminFeatureInstanceUsersPage, AdminFeatureRolesPage, AdminInvitationsPage, AdminMandateRolePermissionsPage, AdminMandateRolesPage, AdminMandatesPage, AdminUserAccessOverviewPage, AdminUserMandatesPage, AdminUsersPage
- **basedata/:** ConnectionsPage, FilesPage, PromptsPage
- **migrate/:** ChatbotPage, PekPage, SpeechPage
- **views/trustee/:** TrusteeDashboardView, TrusteeDocumentsView, TrusteeExpenseImportView, TrusteeInstanceRolesView, TrusteePositionDocumentsView, TrusteePositionsView
- **workflows/:** AutomationsPage, PlaygroundPage, WorkflowsPage

### Contexts, Stores, Utils, Locales
- **Contexts:** FileContext, PekContext, PekTablesContext, ToastContext, WorkflowSelectionContext
- **Stores:** featureStore
- **Utils:** attributeTypeMapper, csrfUtils, privilegeCheckers, time, userCache
- **Types:** mandate.ts
- **Locales:** de.ts, en.ts, fr.ts (erweitert)

### Styles & Assets
- `src/styles/`: buttons.css, pages.module.css, themes (dark, light), assets/bg.jpg
- `src/assets/styles/light.css` entfernt
- `src/index.css`, `src/main.tsx`

### Dokumentation
- `docs/DASHBOARD_LOG_POLLING_DOCUMENTATION.md` (neu)
- `documentation/sidebar.md` (entfernt)
- `.cursor/plans/implement_rbac_roles_page_*.plan.md` (Cursor-Plan)

---

## Commit-Historie (chronologisch)

| Datum | Commit | Nachricht |
|-------|--------|-----------|
| 2025-09-10 | 0bd6091 | updated cofig logic |
| 2025-09-15 | 9fc33c7 | feat: added speech integration prototype |
| 2025-09-16 | 9e7c3b2 | implemented feedback |
| 2025-09-18 | 41aa0fd | minor bugfixing |
| 2025-10-01 | 05f51c4 | working on action button |
| 2025-10-08 | b238ab8 | fixed action buttons |
| 2025-10-12 | 6988984 | finished files page |
| 2025-10-12 | 9519fed | pushing to int |
| 2025-10-12 | 8a0e5f8 | fix: ready for build |
| 2025-12-01 | 101b306 | added PEK pages |
| 2025-12-01 | aa34508 | updated the table view |
| 2025-12-15 | aaf64b8 | resumed backend integration, RBAC focus |
| 2025-12-15 | f8d5c0a | fix: geolinien outline |
| 2025-12-15 | 78889bf | fix: collapsed sidebar |
| 2025-12-22 | bfbe3f8 | PEK updates |
| 2025-12-30 | cf76e89 | pek update |
| 2025-12-30 | 94e8681 | fix: centralized workflow state management on dashboard page |
| 2025-12-30 | 14273c2 | Merge PR #2 feat/real-estate |
| 2025-12-30 | d3c950d | fix: consolidated privilegechecker and usepermissions hook |
| 2026-01-02 | 641930b | updated log rendering |
| 2026-01-02 | 401c088 | fix: fixed styling of log messages |
| 2026-01-02 | ae6a634 | feature: show workflow stats |
| 2026-01-05 | c76e7ef | feat: completely build up althaus page |
| 2026-01-05 | 079d398 | fix: build errors removed |
| 2026-01-05 | 6315c9a | fix: constant reload |
| 2026-01-05 | 6c90a00 | fix: another build error |
| 2026-01-05 | 05508cc | fix: privilege caching led to no pages showing |
| 2026-01-05 | 826eead | fix: added more rolelabel logging |
| 2026-01-05 | 48754d6 | fix: typescript build errors |
| 2026-01-05 | fc55a25 | fix: added more rolelabel logging |
| 2026-01-05 | 5f22c7b | fix: added more rolelabel logging |
| 2026-01-05 | eb280db | feat: completely build up althaus page |
| 2026-01-05 | c80ad96 | Rename PEK tabs: Projects and Data Management |
| 2026-01-05 | dd79895 | Merge int |
| 2026-01-05 | b0826a3 | feat: weiter chatbot implementiert |
| 2026-01-05 | 23508ea | fix: merge conflicts |
| 2026-01-05 | 350cc7b | fix: geolinien outline |
| 2026-01-05 | 407a3c4 | PEK updates |
| 2026-01-05 | c5a82dd | feat: multiselect parcels and create projects |
| 2026-01-09 | 836b803 | fix: fixed and finished chatbot integration |
| 2026-01-09 | 3df83f0 | fix: button fix |
| 2026-01-12 | 7d794ef | Merge feat/chatbot into int |
| 2026-01-12 | 5808bd4 | fixed merge conflicts |
| 2026-01-12 | 239fd32 | fix: readded deleted code, fixed build |
| 2026-01-12 | be3844f | feat: privilege checker into real estate pages |
| 2026-01-12 | eaf69f4 | feat/fix: added admin pages, fixed sidebar width |
| 2026-01-12 | 64d14af | feat: finished admin pages |
| 2026-01-12 | acdcf2c | fix: moved team-members file to correct place |
| 2026-01-12 | 06ffce8 | fix: fixed build |
| 2026-01-13 | 9fc0c9b | user magic link implemented |
| 2026-01-13 | 7d2808d | hotfix |
| 2026-01-13 | b2c38e7 | Fixed UI issues |
| 2026-01-13 | 71666d2 | hotfixes |
| 2026-01-13 | de98b86 | hotfixes |
| 2026-01-13 | c5d60c4 | node-version 20 |
| 2026-01-13 | 2b96ab7 | fixed trustee access |
| 2026-01-14 | 54ba020 | fix: fixed formgenerator layout and design |
| 2026-01-17 | 8033ca9 | prepared multimandate |
| 2026-01-20 | 70c84dd | revised ui components |
| 2026-01-21 | 7f07a55 | saas mandates core done |
| 2026-01-21 | 537b624 | fixed uid mapping to id |
| 2026-01-21 | d387322 | serverside filter and sort for form generic |
| 2026-01-21 | 34d4646 | generic form table scroll lock for headers |
| 2026-01-21 | f99b6b7 | saas multi mandate tested |
| 2026-01-22 | b207c0c | dyn options in api |
| 2026-01-23 | dc4b475 | refactored pages ui access with saas mandates |
| 2026-01-24 | cc8770d | reference fixes |
| 2026-01-24 | 41e02b5 | fixed automation and trustee |
| 2026-01-24 | 5952074 | access rules editor enhanced |
| 2026-01-24 | 6a406d8 | fixes |
| 2026-01-25 | bf4ddc6 | rbac rules tested and fixed |
| 2026-01-25 | 2b220fe | gpdr compliancy implemented |
| 2026-01-26 | 28af4cb | mandate invitation and notification system |
| 2026-01-26 | f41e6d0 | fixed ai call end to end with saas multimandate |

---

## Hinweise für das PR-Review

1. **Breite Änderung:** Viele Dateien und neue Strukturen; Fokus auf PageManager, Admin, Trustee und Workflow/Playground empfohlen.
2. **Auth & Mandate:** Magic Link, Reset-Flow und Mandatenwechsel sollten manuell geprüft werden.
3. **RBAC:** Admin RBAC-Seiten und Access Rules Editor sind kritisch für Berechtigungen.
4. **Build & Lint:** `npm run build` und Linter im CI prüfen.
5. **Doku:** `docs/DASHBOARD_LOG_POLLING_DOCUMENTATION.md` für Playground/Logging konsultieren.

---

*Bericht erstellt aus der Git-Historie `main..HEAD` im Repository `frontend_nyla` (Branch `feat/saas-multi-tenant-mandates`).*
