📚 DOCUMENTAZIONE: Architettura UI Completa
Questa issue contiene la documentazione completa dell'architettura UI proposta per PTRP.
Include: struttura componenti, design system, schema colori, navigazione, flussi utente, e considerazioni tecniche.
🏛️ Struttura Architetturale
Pattern MVVM Completo
PTRP.App/
├── Views/
│ ├── MainWindow.xaml # Shell principale con NavigationFrame
│ ├── Dashboard/
│ │ └── DashboardView.xaml # Dashboard con KPI cards
│ ├── Patients/
│ │ ├── PatientListView.xaml # Master-Detail layout
│ │ └── PatientFormView.xaml # Form add/edit paziente
│ ├── Projects/
│ │ ├── ProjectListView.xaml
│ │ └── ProjectFormView.xaml
│ ├── Educators/
│ │ ├── EducatorListView.xaml
│ │ └── EducatorFormView.xaml
│ ├── Calendar/
│ │ ├── CalendarView.xaml # Calendario appuntamenti
│ │ └── AppointmentFormView.xaml
│ ├── Visits/
│ │ └── VisitFormView.xaml # Registrazione visita
│ ├── Sync/
│ │ ├── SyncView.xaml # Export/Import pacchetti
│ │ └── ConflictResolutionView.xaml
│ ├── Setup/
│ │ └── FirstRunView.xaml # Schermata primo avvio
│ └── Dialogs/
│ ├── ConfirmationDialog.xaml
│ └── ErrorDetailsDialog.xaml
│
├── ViewModels/
│ ├── MainViewModel.cs
│ ├── ViewModelBase.cs
│ ├── DashboardViewModel.cs
│ ├── PatientListViewModel.cs
│ └── ...
│
├── Services/
│ ├── INavigationService.cs
│ ├── IConfigurationService.cs
│ ├── IErrorHandlingService.cs
│ └── ...
│
├── Behaviors/
│ └── ValidationBehavior.cs
│
├── Converters/
│ ├── BoolToVisibilityConverter.cs
│ ├── ProjectStateToColorConverter.cs
│ └── ...
│
├── Validation/
│ └── ValidationAttributes.cs
│
└── Styles/
├── Colors.xaml # Design system colors
├── Typography.xaml # Font styles
├── Buttons.xaml # Button styles
└── Controls.xaml # Custom control styles
🎨 Design System Completo
Palette Colori
Primary Colors
<Color x : Key =" PrimaryColor" >#28A745</Color > <!-- Verde Terapeutico -->
<Color x : Key =" PrimaryLightColor" >#34D058</Color > <!-- Hover state -->
<Color x : Key =" PrimaryDarkColor" >#1E7E34</Color > <!-- Active state -->
<SolidColorBrush x : Key =" PrimaryBrush" Color =" {StaticResource PrimaryColor}" />
<SolidColorBrush x : Key =" PrimaryLightBrush" Color =" {StaticResource PrimaryLightColor}" />
<SolidColorBrush x : Key =" PrimaryDarkBrush" Color =" {StaticResource PrimaryDarkColor}" />
Secondary Colors
<Color x : Key =" SecondaryColor" >#007BFF</Color > <!-- Blu Informativo -->
<Color x : Key =" SecondaryLightColor" >#3395FF</Color >
<Color x : Key =" SecondaryDarkColor" >#0056B3</Color >
<SolidColorBrush x : Key =" SecondaryBrush" Color =" {StaticResource SecondaryColor}" />
Semantic Colors
<!-- Success -->
<Color x : Key =" SuccessColor" >#28A745</Color >
<SolidColorBrush x : Key =" SuccessBrush" Color =" {StaticResource SuccessColor}" />
<!-- Warning -->
<Color x : Key =" WarningColor" >#FFC107</Color >
<SolidColorBrush x : Key =" WarningBrush" Color =" {StaticResource WarningColor}" />
<!-- Error -->
<Color x : Key =" ErrorColor" >#DC3545</Color >
<SolidColorBrush x : Key =" ErrorBrush" Color =" {StaticResource ErrorColor}" />
<!-- Info -->
<Color x : Key =" InfoColor" >#17A2B8</Color >
<SolidColorBrush x : Key =" InfoBrush" Color =" {StaticResource InfoColor}" />
Neutral Colors
<Color x : Key =" TextPrimaryColor" >#212529</Color > <!-- Testo principale -->
<Color x : Key =" TextSecondaryColor" >#6C757D</Color > <!-- Testo secondario -->
<Color x : Key =" TextDisabledColor" >#ADB5BD</Color > <!-- Testo disabilitato -->
<Color x : Key =" BackgroundColor" >#FFFFFF</Color > <!-- Sfondo principale -->
<Color x : Key =" SurfaceColor" >#F8F9FA</Color > <!-- Sfondo cards -->
<Color x : Key =" BorderColor" >#DEE2E6</Color > <!-- Bordi -->
<SolidColorBrush x : Key =" TextPrimaryBrush" Color =" {StaticResource TextPrimaryColor}" />
<SolidColorBrush x : Key =" TextSecondaryBrush" Color =" {StaticResource TextSecondaryColor}" />
<SolidColorBrush x : Key =" TextDisabledBrush" Color =" {StaticResource TextDisabledColor}" />
<SolidColorBrush x : Key =" BackgroundBrush" Color =" {StaticResource BackgroundColor}" />
<SolidColorBrush x : Key =" SurfaceBrush" Color =" {StaticResource SurfaceColor}" />
<SolidColorBrush x : Key =" BorderBrush" Color =" {StaticResource BorderColor}" />
Tipografia
<!-- Headings -->
<Style x : Key =" H1Style" TargetType =" TextBlock" >
<Setter Property =" FontSize" Value =" 32" />
<Setter Property =" FontWeight" Value =" Bold" />
<Setter Property =" Foreground" Value =" {StaticResource TextPrimaryBrush}" />
</Style >
<Style x : Key =" H2Style" TargetType =" TextBlock" >
<Setter Property =" FontSize" Value =" 24" />
<Setter Property =" FontWeight" Value =" SemiBold" />
<Setter Property =" Foreground" Value =" {StaticResource TextPrimaryBrush}" />
</Style >
<Style x : Key =" H3Style" TargetType =" TextBlock" >
<Setter Property =" FontSize" Value =" 18" />
<Setter Property =" FontWeight" Value =" SemiBold" />
<Setter Property =" Foreground" Value =" {StaticResource TextPrimaryBrush}" />
</Style >
<!-- Body Text -->
<Style x : Key =" BodyStyle" TargetType =" TextBlock" >
<Setter Property =" FontSize" Value =" 14" />
<Setter Property =" FontWeight" Value =" Normal" />
<Setter Property =" Foreground" Value =" {StaticResource TextPrimaryBrush}" />
</Style >
<Style x : Key =" CaptionStyle" TargetType =" TextBlock" >
<Setter Property =" FontSize" Value =" 12" />
<Setter Property =" Foreground" Value =" {StaticResource TextSecondaryBrush}" />
</Style >
Spacing System
<system : Double x : Key =" Spacing0" >0</system : Double >
<system : Double x : Key =" Spacing4" >4</system : Double >
<system : Double x : Key =" Spacing8" >8</system : Double >
<system : Double x : Key =" Spacing12" >12</system : Double >
<system : Double x : Key =" Spacing16" >16</system : Double >
<system : Double x : Key =" Spacing20" >20</system : Double >
<system : Double x : Key =" Spacing24" >24</system : Double >
<system : Double x : Key =" Spacing32" >32</system : Double >
<system : Double x : Key =" Spacing40" >40</system : Double >
🗺️ Schermate Dettagliate
1. MainWindow (Shell)
┌─────────────────────────────────────────────────────────────────┐
│ 🏛 PTRP [User] [⚙] [×] │
├─────────────────────────────────────────────────────────────────┤
│ SIDEBAR (240px) │ CONTENT AREA │
│ │ │
│ 📊 Dashboard │ [Dynamic View loaded here] │
│ 👥 Pazienti │ │
│ 📋 Progetti │ (e.g., DashboardView, │
│ 👨🏫 Educatori │ PatientListView, etc.) │
│ 📅 Calendario │ │
│ │ │
│ --- Sincronizzazione --- │ │
│ 🔄 Sync │ │
│ │ │
│ --- Informazioni --- │ │
│ 📊 Report │ │
│ ⚙ Impostazioni │ │
└──────────────────────────┴─────────────────────────────────┘
│ Snackbar: "Dati salvati con successo" │
└─────────────────────────────────────────────────────────────────┘
Componenti:
Top Bar : Logo, Nome app, User info, Impostazioni
Sidebar : Menu navigazione con icone MaterialDesign
Content Area : Frame per navigazione views
Snackbar : Toast notifications bottom-center
2. Dashboard Coordinatore
┌─────────────────────────────────────────────────────────────────┐
│ 📊 Dashboard │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ ┌────────────┐ │
│ │ 42 │ │ 18 │ │ 8 │ │ 15/20 │ │
│ │ Pazienti │ │ Progetti │ │ Educatori │ │ Visite │ │
│ │ Totali │ │ Attivi │ │ Operativi │ │ Completate │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ └────────────┘ │
│ │
│ ┌─────────────────────────────────────────┐ ┌────────────────────┐ │
│ │ Gennaio 2025 - Andamento Visite │ │ Top Educatori │ │
│ │ │ │ │ │
│ │ [Chart Area] │ │ 1. Bianchi (12) │ │
│ │ │ │ 2. Verdi (10) │ │
│ │ Line chart visite completate │ │ 3. Rossi (8) │ │
│ │ vs schedulate │ │ 4. Neri (7) │ │
│ │ │ │ 5. Gialli (5) │ │
│ └─────────────────────────────────────────┘ └────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
KPI Cards: Pazienti Totali, Progetti Attivi, Educatori Operativi, Visite Completate (con progress)
Grafici: Line chart andamento visite mese corrente
Liste: Top 5 educatori per numero visite
3. PatientListView (Master-Detail)
Vedi issue #51 per layout completo.
Layout:
Sinistra (2 ) *: DataGrid con search/filtri
Destra (*) : Detail panel con anagrafica, progetto attivo, prossimo appuntamento
4. CalendarView
┌─────────────────────────────────────────────────────────────────┐
│ 📅 Calendario Appuntamenti [◀ Oggi ▶] [+] │
├─────────────────────────────────────────────────────────────────┤
│ │
│ ┌─ Gennaio 2025 ─────────────────────────────────────────┐ │
│ │ Lun Mar Mer Gio Ven Sab Dom │ │
│ │ │ │
│ │ 1 2 3 4 5 6 7 │ │
│ │ 8 9 10 11 12 13 14 │ │
│ │ 15 16 17 [18] 19 20 21 <- Oggi evidenziato │ │
│ │ 22 23 24 25 26 27 28 │ │
│ │ 29 30 31 │ │
│ │ │ │
│ │ Days con appuntamenti: badge colorato │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌─ Appuntamenti del 18/01/2025 ────────────────────────────┐ │
│ │ │ │
│ │ 09:00 - Prima Apertura - Mario Rossi (Bianchi) │ │
│ │ 10:30 - Visita Domiciliare - Luca Verdi (Neri) │ │
│ │ 14:00 - Follow-up - Anna Bianchi (Gialli) │ │
│ │ │ │
│ └─────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
Features:
Calendario mensile con giorni cliccabili
Badge su giorni con appuntamenti
Lista appuntamenti giorno selezionato
Bottone "Oggi" per tornare a data odierna
Bottone "+" per nuovo appuntamento
🧭 Navigazione e Flussi
Flusso Coordinatore
1. PRIMO AVVIO
└─> FirstRunView → Importa admin.ptrp → Dashboard
2. GESTIONE PAZIENTI
Dashboard → Pazienti → PatientListView
├─> [Nuovo Paziente] → PatientFormView → Salva → PatientListView
├─> [Modifica] → PatientFormView → Salva → PatientListView
└─> [Nuovo Progetto] → ProjectFormView → Salva → PatientListView
3. GESTIONE EDUCATORI
Dashboard → Educatori → EducatorListView
├─> [Nuovo Educatore] → EducatorFormView → Salva → EducatorListView
└─> [Modifica] → EducatorFormView → Salva → EducatorListView
4. CALENDARIO APPUNTAMENTI
Dashboard → Calendario → CalendarView
├─> [Giorno] → Lista appuntamenti giorno
├─> [Nuovo Appuntamento] → AppointmentFormView → Salva → CalendarView
└─> [Registra Visita] → VisitFormView → Salva → CalendarView
5. SINCRONIZZAZIONE
Dashboard → Sync → SyncView
├─> [Tab Esporta] → Seleziona Educatore + Periodo → Esporta .ptrp
└─> [Tab Importa] → Seleziona .ptrp → Verifica → Conflitti? → ConflictResolutionView → Importa
Flusso Educatore
1. PRIMO AVVIO
└─> FirstRunView → Importa appointments_*.ptrp → Calendario
2. CALENDARIO (VIEW PRINCIPALE)
CalendarView (Read-Only per appuntamenti)
└─> [Registra Visita] → VisitFormView → Salva → CalendarView
3. SINCRONIZZAZIONE
Calendario → Sync → SyncView
├─> [Tab Esporta] → Esporta visite registrate → .ptrp per Coordinatore
└─> [Tab Importa] → Importa nuovi appuntamenti da Coordinatore
⚙️ Considerazioni Tecniche
Performance
Virtualizzazione : DataGrid con EnableRowVirtualization="True" per liste >500 items
Lazy Loading : Caricare dati al bisogno (es. detail panel solo quando paziente selezionato)
Async Operations : Tutte le operazioni DB async per non bloccare UI thread
Caching : Cache in-memory per dati frequentemente accessati (educatori, stati progetto)
Accessibilità
Keyboard Navigation : Tutti i controlli accessibili via tastiera (Tab, Enter, Esc)
Focus Management : Focus visibile e logico tra controlli
Screen Reader : AutomationProperties.Name per controlli custom
Contrast : Ratio 4.5:1 per testo normale, 3:1 per large text
Testing Strategy
Unit Tests : ViewModels con MOQ per repository mocking
Integration Tests : Services + Repository layer
UI Tests : Appium/WinAppDriver per critical paths
Manual Testing : Checklist per ogni schermata
Security
HMAC Validation : Firma digitale per pacchetti .ptrp
Data Encryption : AES per contenuto pacchetti
Input Sanitization : Validazione input utente per prevenire SQL injection
Audit Trail : Log operazioni critiche (creazione/modifica/eliminazione)
🛣️ Roadmap Implementazione
FASE 1: Foundation (Issue #45 -49)
Struttura base MainWindow con sidebar
Navigation service
Design system (colors, typography, styles)
Schermata primo avvio
FASE 2: Core Features (Issue #50 -51, +altri)
Dashboard Coordinatore
PatientListView Master-Detail
EducatorListView
CalendarView
Form CRUD (Patient, Project, Educator, Appointment)
VisitFormView
FASE 3: Sync & Advanced (Issue #52 -53)
SyncView (Export/Import)
ConflictResolutionView
HMAC validation
Package encryption
FASE 4: Polish & Deploy (Issue #54 , +altri)
Validation UI
Error handling globale
Accessibility improvements
Performance optimization
Testing
Documentation
Deployment
📝 Riferimenti Issue
🎯 Prossimi Passi
Iniziare con FASE 1 - Issue FASE 1 - Foundation: Struttura Base MainWindow e Architettura UI #45 (MainWindow structure)
Seguire roadmap sequenzialmente
Testing incrementale ad ogni fase
Review code + UI/UX dopo ogni milestone
Iterare basandosi su feedback
Questa documentazione è un living document. Aggiornare man mano che l'implementazione procede.
📚 DOCUMENTAZIONE: Architettura UI Completa
🏛️ Struttura Architetturale
Pattern MVVM Completo
🎨 Design System Completo
Palette Colori
Primary Colors
Secondary Colors
Semantic Colors
Neutral Colors
Tipografia
Spacing System
🗺️ Schermate Dettagliate
1. MainWindow (Shell)
Componenti:
2. Dashboard Coordinatore
KPI Cards: Pazienti Totali, Progetti Attivi, Educatori Operativi, Visite Completate (con progress)
Grafici: Line chart andamento visite mese corrente
Liste: Top 5 educatori per numero visite
3. PatientListView (Master-Detail)
Vedi issue #51 per layout completo.
Layout:
4. CalendarView
Features:
🧭 Navigazione e Flussi
Flusso Coordinatore
Flusso Educatore
⚙️ Considerazioni Tecniche
Performance
EnableRowVirtualization="True"per liste >500 itemsAccessibilità
Testing Strategy
Security
🛣️ Roadmap Implementazione
FASE 1: Foundation (Issue #45-49)
FASE 2: Core Features (Issue #50-51, +altri)
FASE 3: Sync & Advanced (Issue #52-53)
FASE 4: Polish & Deploy (Issue #54, +altri)
📝 Riferimenti Issue
🎯 Prossimi Passi
Questa documentazione è un living document. Aggiornare man mano che l'implementazione procede.