using CommunityToolkit.Mvvm.ComponentModel; using LehrerApp.Core.Models; using System.Collections.ObjectModel; namespace LehrerApp.Desktop.ViewModels.Students; /// Ein Gesprächspunkt während des begleiteten Elternanrufs, abhakbar (5.1: Elternanruf). public partial class ParentCallPointItem : ObservableObject { public Guid Id { get; } public string Text { get; } [ObservableProperty] private bool _isDone; public ParentCallPointItem(ParentCallPoint p) { Id = p.Id; Text = p.Text; IsDone = p.IsDone; } } /// /// Begleitet einen Elternanruf während des Gesprächs: geplante Punkte abhaken, Eindrücke und /// Ergänzungen festhalten, als Protokoll speichern. /// public partial class ParentCallSessionViewModel : ObservableObject { private readonly Documentation _documentation; public string StudentTitle { get; } public ObservableCollection Points { get; } = []; [ObservableProperty] private string _impressions; public Documentation? Result { get; private set; } public ParentCallSessionViewModel(Documentation documentation, string studentTitle) { _documentation = documentation; StudentTitle = studentTitle; _impressions = documentation.ParentCallData?.Impressions ?? ""; foreach (var p in documentation.ParentCallData?.Points ?? []) Points.Add(new ParentCallPointItem(p)); } public void SaveProtocol() { _documentation.ParentCallData = new ParentCallData { Points = Points.Select(p => new ParentCallPoint { Id = p.Id, Text = p.Text, IsDone = p.IsDone }).ToList(), Impressions = Impressions.Trim(), IsConducted = true, ConductedDate = DateOnly.FromDateTime(DateTime.Today), }; Result = _documentation; } }