Dashboard und Schnellnavigation fix

This commit is contained in:
2026-08-29 19:35:05 +02:00
parent 7d3d021d09
commit b7a105af73
18 changed files with 368 additions and 31 deletions
@@ -0,0 +1,46 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using LehrerApp.Core.Models;
using System.Globalization;
namespace LehrerApp.Desktop.ViewModels.Students;
public sealed record GroupDocumentationOption(Guid Id, string DisplayName);
/// Kompakte Erfassung einer gruppenweiten Planungsnotiz aus der globalen Befehlspalette.
public partial class GroupDocumentationQuickViewModel(IEnumerable<GroupDocumentationOption> groups)
: ObservableObject
{
public List<GroupDocumentationOption> Groups { get; } = groups.ToList();
[ObservableProperty] private GroupDocumentationOption? _selectedGroup;
[ObservableProperty] private string _title = "";
[ObservableProperty] private string _content = "";
[ObservableProperty] private string _dateText = DateOnly.FromDateTime(DateTime.Today).ToString("dd.MM.yyyy");
[ObservableProperty] private string _groupError = "";
[ObservableProperty] private string _titleError = "";
[ObservableProperty] private string _dateError = "";
public Documentation? Result { get; private set; }
[RelayCommand]
private void Save()
{
GroupError = TitleError = DateError = "";
if (SelectedGroup is null) GroupError = "Lerngruppe auswählen.";
if (string.IsNullOrWhiteSpace(Title)) TitleError = "Titel erforderlich.";
if (!DateOnly.TryParseExact(DateText, "dd.MM.yyyy", null, DateTimeStyles.None, out var date))
DateError = "Format TT.MM.JJJJ.";
if (GroupError.Length > 0 || TitleError.Length > 0 || DateError.Length > 0) return;
Result = new Documentation
{
StudentId = Guid.Empty,
GroupId = SelectedGroup!.Id,
Type = DocumentationType.Planning,
Date = date,
Title = Title.Trim(),
Content = Content.Trim(),
ExcludeFromWebUntisSync = true,
};
}
}