Dashboard und Schnellnavigation fix
This commit is contained in:
@@ -17,7 +17,7 @@ public record StudentOption(Guid Id, string Name);
|
||||
public static class DocumentationTypeDisplay
|
||||
{
|
||||
public static string[] Options { get; } =
|
||||
["Gespräch", "Vorkommnis", "Förderplan", "Fehlzeit", "Elternanruf", "Elternbrief"];
|
||||
["Gespräch", "Vorkommnis", "Förderplan", "Fehlzeit", "Elternanruf", "Elternbrief", "Planung / Erinnerung"];
|
||||
|
||||
public static string Label(DocumentationType t) => t switch
|
||||
{
|
||||
@@ -27,6 +27,7 @@ public static class DocumentationTypeDisplay
|
||||
DocumentationType.Absence => "Fehlzeit",
|
||||
DocumentationType.ParentCall => "Elternanruf",
|
||||
DocumentationType.ParentLetter => "Elternbrief",
|
||||
DocumentationType.Planning => "Planung / Erinnerung",
|
||||
_ => "",
|
||||
};
|
||||
|
||||
@@ -37,6 +38,7 @@ public static class DocumentationTypeDisplay
|
||||
"Fehlzeit" => DocumentationType.Absence,
|
||||
"Elternanruf" => DocumentationType.ParentCall,
|
||||
"Elternbrief" => DocumentationType.ParentLetter,
|
||||
"Planung / Erinnerung" => DocumentationType.Planning,
|
||||
_ => DocumentationType.Conversation,
|
||||
};
|
||||
}
|
||||
@@ -301,7 +303,7 @@ public partial class DocumentationDialogViewModel : ObservableObject
|
||||
LetterSentDateError = ""; LetterResponseDateError = "";
|
||||
var valid = true;
|
||||
|
||||
if (CanPickStudent && SelectedStudent is null) { StudentError = "Schüler auswählen."; valid = false; }
|
||||
if (CanPickStudent && SelectedStudent is null) { StudentError = "Bezug auswählen."; valid = false; }
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Title)) { TitleError = "Titel erforderlich."; valid = false; }
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user