Umschalter zwischen WebUntis-Klassenbuch und eigener Dokumentation statt Merge beider strukturell unterschiedlicher Datensätze, mit Zahlen-Badges je Quelle (kritisch/Nacharbeit hervorgehoben) im Tab und an der "Klassenbuch öffnen"-Aktion der Übersicht. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -584,4 +584,68 @@ public sealed class ClassTeacherViewModelsTests
|
|||||||
|
|
||||||
private static UntisStudentRosterCacheEntry Student(int? externKey, string displayName) =>
|
private static UntisStudentRosterCacheEntry Student(int? externKey, string displayName) =>
|
||||||
new() { ClassName = "6a", ExternKey = externKey, DisplayName = displayName };
|
new() { ClassName = "6a", ExternKey = externKey, DisplayName = displayName };
|
||||||
|
|
||||||
|
// ── Klassenbuch-Tab als Dokumentations-Hub: eigene Dokumentation neben WebUntis ─────────────
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FilterOwnDocumentation_ZeigtNurEintraegeZugeordneterSchuelerImZeitraum()
|
||||||
|
{
|
||||||
|
var ada = Guid.NewGuid();
|
||||||
|
var fremd = Guid.NewGuid();
|
||||||
|
var rosterMatches = new List<(Guid StudentId, string DisplayName)> { (ada, "Ada Müller") };
|
||||||
|
var docs = new List<Documentation>
|
||||||
|
{
|
||||||
|
new() { StudentId = ada, Date = new DateOnly(2026, 8, 20), Title = "Im Zeitraum" },
|
||||||
|
new() { StudentId = ada, Date = new DateOnly(2026, 7, 1), Title = "Vor dem Zeitraum" },
|
||||||
|
new() { StudentId = fremd, Date = new DateOnly(2026, 8, 20), Title = "Anderer Schüler" },
|
||||||
|
new() { StudentId = ada, Date = new DateOnly(2026, 8, 21), Title = "Gelöscht", IsDeleted = true },
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = ClassTeacherDetailsViewModel.FilterOwnDocumentation(docs, rosterMatches,
|
||||||
|
new DateOnly(2026, 8, 1), new DateOnly(2026, 8, 31), "");
|
||||||
|
|
||||||
|
Assert.Equal(["Im Zeitraum"], result.Select(d => d.Title));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FilterOwnDocumentation_SortiertEntwuerfeVorNeuestenZuerst()
|
||||||
|
{
|
||||||
|
var id = Guid.NewGuid();
|
||||||
|
var rosterMatches = new List<(Guid StudentId, string DisplayName)> { (id, "Ada Müller") };
|
||||||
|
var docs = new List<Documentation>
|
||||||
|
{
|
||||||
|
new() { StudentId = id, Date = new DateOnly(2026, 8, 25), Title = "Neu, fertig" },
|
||||||
|
new() { StudentId = id, Date = new DateOnly(2026, 8, 10), Title = "Alt, Entwurf", IsDraft = true },
|
||||||
|
new() { StudentId = id, Date = new DateOnly(2026, 8, 20), Title = "Mittel, fertig" },
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = ClassTeacherDetailsViewModel.FilterOwnDocumentation(docs, rosterMatches,
|
||||||
|
new DateOnly(2026, 8, 1), new DateOnly(2026, 8, 31), "");
|
||||||
|
|
||||||
|
Assert.Equal(["Alt, Entwurf", "Neu, fertig", "Mittel, fertig"], result.Select(d => d.Title));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void FilterOwnDocumentation_SchuelerfilterErkenntVertauschteReihenfolge()
|
||||||
|
{
|
||||||
|
// Derselbe Namensabgleich wie bei den WebUntis-Klassenbuchzeilen (siehe
|
||||||
|
// RosterBuild_ErkenntNamenAuchInVertauschterReihenfolge) - der Filter kommt aus der
|
||||||
|
// Übersicht als "Nachname Vorname" oder "Vorname Nachname" je nach Bericht.
|
||||||
|
var ada = Guid.NewGuid();
|
||||||
|
var ben = Guid.NewGuid();
|
||||||
|
var rosterMatches = new List<(Guid StudentId, string DisplayName)>
|
||||||
|
{
|
||||||
|
(ada, "Ada Müller"), (ben, "Ben Schmidt"),
|
||||||
|
};
|
||||||
|
var docs = new List<Documentation>
|
||||||
|
{
|
||||||
|
new() { StudentId = ada, Date = new DateOnly(2026, 8, 20), Title = "Ada" },
|
||||||
|
new() { StudentId = ben, Date = new DateOnly(2026, 8, 20), Title = "Ben" },
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = ClassTeacherDetailsViewModel.FilterOwnDocumentation(docs, rosterMatches,
|
||||||
|
new DateOnly(2026, 8, 1), new DateOnly(2026, 8, 31), "Müller Ada");
|
||||||
|
|
||||||
|
Assert.Equal(["Ada"], result.Select(d => d.Title));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
using CommunityToolkit.Mvvm.Input;
|
||||||
|
using LehrerApp.Core.Interfaces;
|
||||||
|
using LehrerApp.Core.Models;
|
||||||
using LehrerApp.Desktop.Services;
|
using LehrerApp.Desktop.Services;
|
||||||
|
using LehrerApp.Desktop.ViewModels.Students;
|
||||||
|
|
||||||
namespace LehrerApp.Desktop.ViewModels.ClassTeacher;
|
namespace LehrerApp.Desktop.ViewModels.ClassTeacher;
|
||||||
|
|
||||||
@@ -130,11 +133,21 @@ public sealed record ClassAbsenceDaySummaryRow(DateOnly Date, string StudentName
|
|||||||
public partial class ClassTeacherDetailsViewModel : ObservableObject
|
public partial class ClassTeacherDetailsViewModel : ObservableObject
|
||||||
{
|
{
|
||||||
private readonly UntisReportCacheService _cache;
|
private readonly UntisReportCacheService _cache;
|
||||||
|
private readonly IDocumentationRepository _documentation;
|
||||||
|
private readonly IStudentRepository _students;
|
||||||
private string _className = "";
|
private string _className = "";
|
||||||
|
private DateOnly _loadedStart;
|
||||||
|
private DateOnly _loadedEnd;
|
||||||
|
/// Schüler*innen der Klasse, per Namensabgleich (<see cref="UntisNameMatching"/>) den lokalen
|
||||||
|
/// <see cref="Student"/>-Datensätzen zugeordnet — Grundlage für die "Eigene Dokumentation"-Ansicht,
|
||||||
|
/// die es (anders als der WebUntis-Klassenbuchbericht) nur lokal gibt. Nach jedem <see cref="LoadInternal"/>
|
||||||
|
/// neu aufgebaut.
|
||||||
|
private List<(Guid StudentId, string DisplayName)> _rosterMatches = [];
|
||||||
|
|
||||||
public ObservableCollection<ClassTeacherClassRegisterRow> Entries { get; } = [];
|
public ObservableCollection<ClassTeacherClassRegisterRow> Entries { get; } = [];
|
||||||
public ObservableCollection<ClassAbsenceDaySummaryRow> AbsenceEntries { get; } = [];
|
public ObservableCollection<ClassAbsenceDaySummaryRow> AbsenceEntries { get; } = [];
|
||||||
public ObservableCollection<ClassTeacherCategoryAggregateRow> CategoryAggregates { get; } = [];
|
public ObservableCollection<ClassTeacherCategoryAggregateRow> CategoryAggregates { get; } = [];
|
||||||
|
public ObservableCollection<DocumentationItem> OwnDocumentationEntries { get; } = [];
|
||||||
|
|
||||||
[ObservableProperty] private DateTimeOffset _startDate = DateTimeOffset.Now.AddDays(-6);
|
[ObservableProperty] private DateTimeOffset _startDate = DateTimeOffset.Now.AddDays(-6);
|
||||||
[ObservableProperty] private DateTimeOffset _endDate = DateTimeOffset.Now;
|
[ObservableProperty] private DateTimeOffset _endDate = DateTimeOffset.Now;
|
||||||
@@ -143,16 +156,32 @@ public partial class ClassTeacherDetailsViewModel : ObservableObject
|
|||||||
/// Von der Übersicht gesetzt (Klick auf eine Roster-Zeile) - leer zeigt alle Schüler*innen.
|
/// Von der Übersicht gesetzt (Klick auf eine Roster-Zeile) - leer zeigt alle Schüler*innen.
|
||||||
[ObservableProperty] private string _studentFilter = "";
|
[ObservableProperty] private string _studentFilter = "";
|
||||||
[ObservableProperty] private int _quickRangeIndex = 1;
|
[ObservableProperty] private int _quickRangeIndex = 1;
|
||||||
|
/// Umschalter Klassenbuch (WebUntis, andere Lehrkräfte) ↔ eigene Dokumentation.
|
||||||
|
[ObservableProperty] private bool _showOwnDocumentation;
|
||||||
|
[ObservableProperty] private int _ownDocumentationCount;
|
||||||
|
[ObservableProperty] private int _ownDocumentationFollowUpCount;
|
||||||
|
[ObservableProperty] private int _ownDocumentationCriticalCount;
|
||||||
|
|
||||||
|
public Func<List<StudentOption>, Documentation?, Task<Documentation?>>? OnEditOwnDocumentation { get; set; }
|
||||||
|
public Func<DocumentationItem, Task<bool>>? OnConfirmDeleteOwnDocumentation { get; set; }
|
||||||
|
|
||||||
public bool HasEntries => Entries.Count > 0;
|
public bool HasEntries => Entries.Count > 0;
|
||||||
public bool HasAbsenceEntries => AbsenceEntries.Count > 0;
|
public bool HasAbsenceEntries => AbsenceEntries.Count > 0;
|
||||||
public bool HasCategoryAggregates => CategoryAggregates.Count > 0;
|
public bool HasCategoryAggregates => CategoryAggregates.Count > 0;
|
||||||
|
public bool HasOwnDocumentationEntries => OwnDocumentationEntries.Count > 0;
|
||||||
|
/// Die Kategorien-Chipreihe fasst nur WebUntis-Kategorien zusammen (<see cref="CategoryAggregates"/>)
|
||||||
|
/// — im Modus "Eigene Dokumentation" ausgeblendet, dort gibt es kein Äquivalent zu CategoryGroup.
|
||||||
|
public bool ShowCategoryAggregates => HasCategoryAggregates && !ShowOwnDocumentation;
|
||||||
|
public int UntisCriticalCount => Entries.Count(e => e.IsDangerStatus);
|
||||||
public string ActiveFilterLabel => string.IsNullOrWhiteSpace(StudentFilter)
|
public string ActiveFilterLabel => string.IsNullOrWhiteSpace(StudentFilter)
|
||||||
? "Alle Schüler*innen" : StudentFilter;
|
? "Alle Schüler*innen" : StudentFilter;
|
||||||
|
|
||||||
public ClassTeacherDetailsViewModel(UntisReportCacheService cache)
|
public ClassTeacherDetailsViewModel(UntisReportCacheService cache, IDocumentationRepository documentation,
|
||||||
|
IStudentRepository students)
|
||||||
{
|
{
|
||||||
_cache = cache;
|
_cache = cache;
|
||||||
|
_documentation = documentation;
|
||||||
|
_students = students;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(string className)
|
public void Initialize(string className)
|
||||||
@@ -162,12 +191,16 @@ public partial class ClassTeacherDetailsViewModel : ObservableObject
|
|||||||
Entries.Clear();
|
Entries.Clear();
|
||||||
AbsenceEntries.Clear();
|
AbsenceEntries.Clear();
|
||||||
CategoryAggregates.Clear();
|
CategoryAggregates.Clear();
|
||||||
|
OwnDocumentationEntries.Clear();
|
||||||
|
_rosterMatches = [];
|
||||||
Status = "Zeitraum wählen und laden.";
|
Status = "Zeitraum wählen und laden.";
|
||||||
NotifyListState();
|
NotifyListState();
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnStudentFilterChanged(string value) => OnPropertyChanged(nameof(ActiveFilterLabel));
|
partial void OnStudentFilterChanged(string value) => OnPropertyChanged(nameof(ActiveFilterLabel));
|
||||||
|
|
||||||
|
partial void OnShowOwnDocumentationChanged(bool value) => OnPropertyChanged(nameof(ShowCategoryAggregates));
|
||||||
|
|
||||||
partial void OnQuickRangeIndexChanged(int value)
|
partial void OnQuickRangeIndexChanged(int value)
|
||||||
{
|
{
|
||||||
var days = value switch { 0 => 0, 1 => 6, 2 => 29, _ => 6 };
|
var days = value switch { 0 => 0, 1 => 6, 2 => 29, _ => 6 };
|
||||||
@@ -178,6 +211,9 @@ public partial class ClassTeacherDetailsViewModel : ObservableObject
|
|||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
private Task Load() => LoadInternal(forceRefresh: false);
|
private Task Load() => LoadInternal(forceRefresh: false);
|
||||||
|
|
||||||
|
[RelayCommand] private void ShowUntisRegister() => ShowOwnDocumentation = false;
|
||||||
|
[RelayCommand] private void ShowOwnDocs() => ShowOwnDocumentation = true;
|
||||||
|
|
||||||
/// Umgeht bewusst die Stunden-Sperre von <see cref="UntisReportCacheService"/> — für den Fall,
|
/// Umgeht bewusst die Stunden-Sperre von <see cref="UntisReportCacheService"/> — für den Fall,
|
||||||
/// dass man sicher weiß, dass sich seit dem letzten automatischen Abruf etwas geändert hat.
|
/// dass man sicher weiß, dass sich seit dem letzten automatischen Abruf etwas geändert hat.
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
@@ -200,12 +236,15 @@ public partial class ClassTeacherDetailsViewModel : ObservableObject
|
|||||||
if (end < start) { Status = "Das Enddatum darf nicht vor dem Startdatum liegen."; return; }
|
if (end < start) { Status = "Das Enddatum darf nicht vor dem Startdatum liegen."; return; }
|
||||||
if (string.IsNullOrWhiteSpace(_className)) { Status = "Keine Klasse ausgewählt."; return; }
|
if (string.IsNullOrWhiteSpace(_className)) { Status = "Keine Klasse ausgewählt."; return; }
|
||||||
|
|
||||||
Busy = true; Entries.Clear(); AbsenceEntries.Clear(); CategoryAggregates.Clear(); NotifyListState();
|
Busy = true;
|
||||||
|
Entries.Clear(); AbsenceEntries.Clear(); CategoryAggregates.Clear(); OwnDocumentationEntries.Clear();
|
||||||
|
NotifyListState();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var classRegisterTask = _cache.GetClassRegisterEventsAsync(_className, start, end, forceRefresh);
|
var classRegisterTask = _cache.GetClassRegisterEventsAsync(_className, start, end, forceRefresh);
|
||||||
var absencesTask = _cache.GetAbsencesAsync(_className, start, end, forceRefresh);
|
var absencesTask = _cache.GetAbsencesAsync(_className, start, end, forceRefresh);
|
||||||
await Task.WhenAll(classRegisterTask, absencesTask);
|
var rosterTask = _cache.GetStudentRosterAsync(_className);
|
||||||
|
await Task.WhenAll(classRegisterTask, absencesTask, rosterTask);
|
||||||
|
|
||||||
var ordered = classRegisterTask.Result
|
var ordered = classRegisterTask.Result
|
||||||
.Where(MatchesStudentFilter)
|
.Where(MatchesStudentFilter)
|
||||||
@@ -223,14 +262,103 @@ public partial class ClassTeacherDetailsViewModel : ObservableObject
|
|||||||
foreach (var row in ClassAbsenceDaySummaryRow.GroupByStudentAndDay(absences))
|
foreach (var row in ClassAbsenceDaySummaryRow.GroupByStudentAndDay(absences))
|
||||||
AbsenceEntries.Add(row);
|
AbsenceEntries.Add(row);
|
||||||
|
|
||||||
|
var localStudents = _students.GetAll();
|
||||||
|
_rosterMatches = rosterTask.Result
|
||||||
|
.Select(r => (Roster: r, Student: ClassTeacherOverviewViewModel.MatchStudent(r.DisplayName, localStudents)))
|
||||||
|
.Where(x => x.Student is not null)
|
||||||
|
.Select(x => (StudentId: x.Student!.Id, DisplayName: x.Roster.DisplayName))
|
||||||
|
.DistinctBy(x => x.StudentId)
|
||||||
|
.ToList();
|
||||||
|
_loadedStart = start;
|
||||||
|
_loadedEnd = end;
|
||||||
|
LoadOwnDocumentationEntries();
|
||||||
|
|
||||||
Status = $"{Entries.Count} Klassenbucheinträge anderer Lehrkräfte, " +
|
Status = $"{Entries.Count} Klassenbucheinträge anderer Lehrkräfte, " +
|
||||||
$"{AbsenceEntries.Count} Fehlzeiten-Tage im Zeitraum.";
|
$"{AbsenceEntries.Count} Fehlzeiten-Tage, {OwnDocumentationEntries.Count} eigene Dokumentation im Zeitraum.";
|
||||||
NotifyListState();
|
NotifyListState();
|
||||||
}
|
}
|
||||||
catch (WebUntisIntegrationException ex) { Status = ex.Message; }
|
catch (WebUntisIntegrationException ex) { Status = ex.Message; }
|
||||||
finally { Busy = false; NotifyListState(); }
|
finally { Busy = false; NotifyListState(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Baut <see cref="OwnDocumentationEntries"/> aus <see cref="_rosterMatches"/> und dem zuletzt
|
||||||
|
/// geladenen Zeitraum neu auf — separat von <see cref="LoadInternal"/>, damit Anlegen/Bearbeiten/
|
||||||
|
/// Löschen eines eigenen Eintrags nicht auch die WebUntis-Berichte neu abruft. Die eigentliche
|
||||||
|
/// Filter-/Sortierlogik steckt in der reinen, ohne Repository-Zugriff testbaren
|
||||||
|
/// <see cref="FilterOwnDocumentation"/> — analog zu <see cref="ClassTeacherRosterRow.Build"/>.
|
||||||
|
private void LoadOwnDocumentationEntries()
|
||||||
|
{
|
||||||
|
OwnDocumentationEntries.Clear();
|
||||||
|
var entries = FilterOwnDocumentation(_documentation.GetAll(), _rosterMatches,
|
||||||
|
_loadedStart, _loadedEnd, StudentFilter);
|
||||||
|
foreach (var d in entries)
|
||||||
|
{
|
||||||
|
var name = _rosterMatches.First(m => m.StudentId == d.StudentId).DisplayName;
|
||||||
|
OwnDocumentationEntries.Add(new DocumentationItem(d, name));
|
||||||
|
}
|
||||||
|
OwnDocumentationCount = OwnDocumentationEntries.Count;
|
||||||
|
OwnDocumentationFollowUpCount = entries.Count(d => d.IsDraft);
|
||||||
|
OwnDocumentationCriticalCount = entries.Count(d =>
|
||||||
|
d.Tags.Any(t => string.Equals(t, "Kritisch", StringComparison.OrdinalIgnoreCase)));
|
||||||
|
OnPropertyChanged(nameof(HasOwnDocumentationEntries));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Eigene Dokumentation zu Schüler*innen der Klasse im gewählten Zeitraum: nur Einträge
|
||||||
|
/// (nicht gelöschter) Schüler*innen, die sich per Namensabgleich der WebUntis-Klasse zuordnen
|
||||||
|
/// ließen (<paramref name="rosterMatches"/>, siehe <see cref="ClassTeacherOverviewViewModel.MatchStudent"/>),
|
||||||
|
/// mit demselben Schülerfilter wie die WebUntis-Klassenbuchzeilen. Entwürfe ("Nacharbeiten")
|
||||||
|
/// zuerst, danach neueste zuerst.
|
||||||
|
public static List<Documentation> FilterOwnDocumentation(IReadOnlyList<Documentation> all,
|
||||||
|
IReadOnlyList<(Guid StudentId, string DisplayName)> rosterMatches,
|
||||||
|
DateOnly start, DateOnly end, string studentFilter)
|
||||||
|
{
|
||||||
|
var matchedIds = rosterMatches.Select(m => m.StudentId).ToHashSet();
|
||||||
|
return all
|
||||||
|
.Where(d => !d.IsDeleted && matchedIds.Contains(d.StudentId) && d.Date >= start && d.Date <= end)
|
||||||
|
.Where(d => MatchesOwnDocStudentFilter(d, rosterMatches, studentFilter))
|
||||||
|
.OrderByDescending(d => d.IsDraft).ThenByDescending(d => d.Date)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool MatchesOwnDocStudentFilter(Documentation d,
|
||||||
|
IReadOnlyList<(Guid StudentId, string DisplayName)> rosterMatches, string studentFilter)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(studentFilter)) return true;
|
||||||
|
var name = rosterMatches.FirstOrDefault(m => m.StudentId == d.StudentId).DisplayName;
|
||||||
|
return name is not null && UntisNameMatching.NamesMatch(name, studentFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task AddOwnDocumentation()
|
||||||
|
{
|
||||||
|
if (OnEditOwnDocumentation is null) return;
|
||||||
|
var options = _rosterMatches.Select(m => new StudentOption(m.StudentId, m.DisplayName)).ToList();
|
||||||
|
var result = await OnEditOwnDocumentation(options, null);
|
||||||
|
if (result is null) return;
|
||||||
|
_documentation.Save(result);
|
||||||
|
LoadOwnDocumentationEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task EditOwnDocumentation(DocumentationItem? item)
|
||||||
|
{
|
||||||
|
if (item is null || OnEditOwnDocumentation is null) return;
|
||||||
|
var options = _rosterMatches.Select(m => new StudentOption(m.StudentId, m.DisplayName)).ToList();
|
||||||
|
var result = await OnEditOwnDocumentation(options, item.Model);
|
||||||
|
if (result is null) return;
|
||||||
|
_documentation.Save(result);
|
||||||
|
LoadOwnDocumentationEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
private async Task DeleteOwnDocumentation(DocumentationItem? item)
|
||||||
|
{
|
||||||
|
if (item is null) return;
|
||||||
|
if (OnConfirmDeleteOwnDocumentation is not null && !await OnConfirmDeleteOwnDocumentation(item)) return;
|
||||||
|
_documentation.Delete(item.Model.Id);
|
||||||
|
LoadOwnDocumentationEntries();
|
||||||
|
}
|
||||||
|
|
||||||
// WebUntis liefert Namen je nach Bericht in anderer Reihenfolge als der Schülerreport, aus dem
|
// WebUntis liefert Namen je nach Bericht in anderer Reihenfolge als der Schülerreport, aus dem
|
||||||
// StudentFilter beim Klick in der Übersicht gesetzt wird (siehe UntisNameMatching) - ein
|
// StudentFilter beim Klick in der Übersicht gesetzt wird (siehe UntisNameMatching) - ein
|
||||||
// exakter String-Vergleich hier ließ die gefilterten Listen fälschlich leer erscheinen.
|
// exakter String-Vergleich hier ließ die gefilterten Listen fälschlich leer erscheinen.
|
||||||
@@ -248,5 +376,8 @@ public partial class ClassTeacherDetailsViewModel : ObservableObject
|
|||||||
OnPropertyChanged(nameof(HasEntries));
|
OnPropertyChanged(nameof(HasEntries));
|
||||||
OnPropertyChanged(nameof(HasAbsenceEntries));
|
OnPropertyChanged(nameof(HasAbsenceEntries));
|
||||||
OnPropertyChanged(nameof(HasCategoryAggregates));
|
OnPropertyChanged(nameof(HasCategoryAggregates));
|
||||||
|
OnPropertyChanged(nameof(ShowCategoryAggregates));
|
||||||
|
OnPropertyChanged(nameof(HasOwnDocumentationEntries));
|
||||||
|
OnPropertyChanged(nameof(UntisCriticalCount));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
private readonly SchoolYearService _schoolYear;
|
private readonly SchoolYearService _schoolYear;
|
||||||
private readonly IWorkTaskRepository _workTasks;
|
private readonly IWorkTaskRepository _workTasks;
|
||||||
private readonly IStudentRepository _students;
|
private readonly IStudentRepository _students;
|
||||||
|
private readonly IDocumentationRepository _documentation;
|
||||||
private readonly IParticipationRepository _participation;
|
private readonly IParticipationRepository _participation;
|
||||||
private readonly IParticipationSessionRepository _participationSessions;
|
private readonly IParticipationSessionRepository _participationSessions;
|
||||||
private readonly AppLogger? _logger;
|
private readonly AppLogger? _logger;
|
||||||
@@ -244,6 +245,12 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
[ObservableProperty] private int _unexcusedAbsenceCount;
|
[ObservableProperty] private int _unexcusedAbsenceCount;
|
||||||
[ObservableProperty] private string _lastUpdatedLabel = "Noch nicht aktualisiert";
|
[ObservableProperty] private string _lastUpdatedLabel = "Noch nicht aktualisiert";
|
||||||
[ObservableProperty] private int _openExcuseOverflowCount;
|
[ObservableProperty] private int _openExcuseOverflowCount;
|
||||||
|
/// Eigene Dokumentation zu Schüler*innen der Klasse mit "Nacharbeiten"-Status bzw. dem
|
||||||
|
/// "Kritisch"-Tag — Kurzform derselben Zählung wie im Klassenbuch-Tab (siehe
|
||||||
|
/// <see cref="ClassTeacherDetailsViewModel.OwnDocumentationFollowUpCount"/>), hier direkt an
|
||||||
|
/// den "Klassenbuch öffnen"-Button gehängt statt in einer eigenen Kennzahlkarte.
|
||||||
|
[ObservableProperty] private int _ownDocumentationFollowUpCount;
|
||||||
|
[ObservableProperty] private int _ownDocumentationCriticalCount;
|
||||||
|
|
||||||
public bool HomeroomClassConfigured => !string.IsNullOrWhiteSpace(HomeroomClassName);
|
public bool HomeroomClassConfigured => !string.IsNullOrWhiteSpace(HomeroomClassName);
|
||||||
public bool HasPrimaryRoster => PrimaryRoster.Count > 0;
|
public bool HasPrimaryRoster => PrimaryRoster.Count > 0;
|
||||||
@@ -252,6 +259,7 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
public bool HasPatternNotices => PatternNotices.Count > 0;
|
public bool HasPatternNotices => PatternNotices.Count > 0;
|
||||||
public bool HasOpenExcuses => OpenExcuses.Count > 0;
|
public bool HasOpenExcuses => OpenExcuses.Count > 0;
|
||||||
public bool HasOpenExcuseOverflow => OpenExcuseOverflowCount > 0;
|
public bool HasOpenExcuseOverflow => OpenExcuseOverflowCount > 0;
|
||||||
|
public bool HasOwnDocumentationAlerts => OwnDocumentationFollowUpCount > 0 || OwnDocumentationCriticalCount > 0;
|
||||||
public bool AlertsFilterSelected => SelectedRosterFilter == 0;
|
public bool AlertsFilterSelected => SelectedRosterFilter == 0;
|
||||||
public bool ClassRegisterFilterSelected => SelectedRosterFilter == 1;
|
public bool ClassRegisterFilterSelected => SelectedRosterFilter == 1;
|
||||||
public bool AllFilterSelected => SelectedRosterFilter == 2;
|
public bool AllFilterSelected => SelectedRosterFilter == 2;
|
||||||
@@ -289,7 +297,7 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
|
|
||||||
public ClassTeacherOverviewViewModel(WebUntisSettingsService settings, WebUntisIntegrationService untis,
|
public ClassTeacherOverviewViewModel(WebUntisSettingsService settings, WebUntisIntegrationService untis,
|
||||||
UntisReportCacheService cache, SchoolYearService schoolYear, IWorkTaskRepository workTasks,
|
UntisReportCacheService cache, SchoolYearService schoolYear, IWorkTaskRepository workTasks,
|
||||||
IStudentRepository students, IParticipationRepository participation,
|
IStudentRepository students, IDocumentationRepository documentation, IParticipationRepository participation,
|
||||||
IParticipationSessionRepository participationSessions, ClassTeacherDetailsViewModel detailsTab,
|
IParticipationSessionRepository participationSessions, ClassTeacherDetailsViewModel detailsTab,
|
||||||
AppLogger? logger = null)
|
AppLogger? logger = null)
|
||||||
{
|
{
|
||||||
@@ -299,6 +307,7 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
_schoolYear = schoolYear;
|
_schoolYear = schoolYear;
|
||||||
_workTasks = workTasks;
|
_workTasks = workTasks;
|
||||||
_students = students;
|
_students = students;
|
||||||
|
_documentation = documentation;
|
||||||
_participation = participation;
|
_participation = participation;
|
||||||
_participationSessions = participationSessions;
|
_participationSessions = participationSessions;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
@@ -307,6 +316,8 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
|
|
||||||
partial void OnHomeroomClassNameChanged(string? value) => OnPropertyChanged(nameof(HomeroomClassConfigured));
|
partial void OnHomeroomClassNameChanged(string? value) => OnPropertyChanged(nameof(HomeroomClassConfigured));
|
||||||
partial void OnOpenExcuseOverflowCountChanged(int value) => OnPropertyChanged(nameof(HasOpenExcuseOverflow));
|
partial void OnOpenExcuseOverflowCountChanged(int value) => OnPropertyChanged(nameof(HasOpenExcuseOverflow));
|
||||||
|
partial void OnOwnDocumentationFollowUpCountChanged(int value) => OnPropertyChanged(nameof(HasOwnDocumentationAlerts));
|
||||||
|
partial void OnOwnDocumentationCriticalCountChanged(int value) => OnPropertyChanged(nameof(HasOwnDocumentationAlerts));
|
||||||
partial void OnSearchTextChanged(string value) => ApplyRosterFilter();
|
partial void OnSearchTextChanged(string value) => ApplyRosterFilter();
|
||||||
partial void OnSelectedRosterFilterChanged(int value)
|
partial void OnSelectedRosterFilterChanged(int value)
|
||||||
{
|
{
|
||||||
@@ -372,6 +383,7 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
BuildPatternNotices(absenceDaysYear, sevenDayStart);
|
BuildPatternNotices(absenceDaysYear, sevenDayStart);
|
||||||
BuildWeekdayPatternNotices(absenceDaysYear);
|
BuildWeekdayPatternNotices(absenceDaysYear);
|
||||||
BuildAttendanceParticipationNotices();
|
BuildAttendanceParticipationNotices();
|
||||||
|
BuildOwnDocumentationCounts();
|
||||||
BuildOpenExcuses(absenceDaysYear, today);
|
BuildOpenExcuses(absenceDaysYear, today);
|
||||||
LastUpdatedLabel = $"Zuletzt aktualisiert: Heute, {DateTime.Now:HH:mm}";
|
LastUpdatedLabel = $"Zuletzt aktualisiert: Heute, {DateTime.Now:HH:mm}";
|
||||||
Status = $"{StudentCount} Schüler*innen · {TodayAlertCount} heute auffällig";
|
Status = $"{StudentCount} Schüler*innen · {TodayAlertCount} heute auffällig";
|
||||||
@@ -687,6 +699,25 @@ public partial class ClassTeacherOverviewViewModel : ObservableObject
|
|||||||
OnPropertyChanged(nameof(HasPatternNotices));
|
OnPropertyChanged(nameof(HasPatternNotices));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Nacharbeiten-/Kritisch-Zählung für die eigene Dokumentation der Klasse — bewusst nicht auf
|
||||||
|
/// die letzten 7 Tage begrenzt wie <see cref="RecentClassRegisterCount"/>: ein seit Wochen
|
||||||
|
/// offener Entwurf oder ein als "Kritisch" markierter Eintrag soll nicht aus der Kennzahl
|
||||||
|
/// verschwinden, nur weil er nicht mehr taufrisch ist. Selbe Namensabgleich-Logik wie
|
||||||
|
/// <see cref="BuildAttendanceParticipationNotices"/>.
|
||||||
|
private void BuildOwnDocumentationCounts()
|
||||||
|
{
|
||||||
|
var students = _students.GetAll();
|
||||||
|
var matchedIds = Roster
|
||||||
|
.Select(r => MatchStudent(r.StudentName, students))
|
||||||
|
.Where(s => s is not null)
|
||||||
|
.Select(s => s!.Id)
|
||||||
|
.ToHashSet();
|
||||||
|
var docs = _documentation.GetAll().Where(d => !d.IsDeleted && matchedIds.Contains(d.StudentId)).ToList();
|
||||||
|
OwnDocumentationFollowUpCount = docs.Count(d => d.IsDraft);
|
||||||
|
OwnDocumentationCriticalCount = docs.Count(d =>
|
||||||
|
d.Tags.Any(t => string.Equals(t, "Kritisch", StringComparison.OrdinalIgnoreCase)));
|
||||||
|
}
|
||||||
|
|
||||||
/// Reine, ohne Repository-Zugriff testbare Zuordnungslogik. Nutzt <c>FirstName</c>/<c>LastName</c>
|
/// Reine, ohne Repository-Zugriff testbare Zuordnungslogik. Nutzt <c>FirstName</c>/<c>LastName</c>
|
||||||
/// statt <see cref="Student.FullName"/>, weil dessen "Nachname, Vorname"-Format mit Komma den
|
/// statt <see cref="Student.FullName"/>, weil dessen "Nachname, Vorname"-Format mit Komma den
|
||||||
/// leerzeichenbasierten Wortabgleich in <see cref="UntisNameMatching"/> verfälschen würde
|
/// leerzeichenbasierten Wortabgleich in <see cref="UntisNameMatching"/> verfälschen würde
|
||||||
|
|||||||
@@ -464,6 +464,22 @@
|
|||||||
<StackPanel Spacing="8">
|
<StackPanel Spacing="8">
|
||||||
<TextBlock Text="Nächste Schritte" FontSize="14" FontWeight="SemiBold"/>
|
<TextBlock Text="Nächste Schritte" FontSize="14" FontWeight="SemiBold"/>
|
||||||
<Button Content="Klassenbuch öffnen" Command="{Binding OpenClassRegisterCommand}" HorizontalAlignment="Stretch"/>
|
<Button Content="Klassenbuch öffnen" Command="{Binding OpenClassRegisterCommand}" HorizontalAlignment="Stretch"/>
|
||||||
|
<!-- Nutzer-Feedback: Zahlen-Badges für offene eigene Dokumentation direkt am
|
||||||
|
Button, der zum Klassenbuch-Tab (jetzt Dokumentations-Hub) führt, statt in
|
||||||
|
einer eigenen Kennzahlkarte in der bereits vollen 4-Spalten-Reihe oben. -->
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="6" Margin="0,-4,0,0"
|
||||||
|
IsVisible="{Binding HasOwnDocumentationAlerts}">
|
||||||
|
<Border Background="#FB8C00" CornerRadius="9" Padding="7,2"
|
||||||
|
IsVisible="{Binding !!OwnDocumentationFollowUpCount}">
|
||||||
|
<TextBlock Text="{Binding OwnDocumentationFollowUpCount, StringFormat='Nacharbeit: {0}'}"
|
||||||
|
Foreground="White" FontSize="10" FontWeight="SemiBold"/>
|
||||||
|
</Border>
|
||||||
|
<Border Background="#E53935" CornerRadius="9" Padding="7,2"
|
||||||
|
IsVisible="{Binding !!OwnDocumentationCriticalCount}">
|
||||||
|
<TextBlock Text="{Binding OwnDocumentationCriticalCount, StringFormat='kritisch: {0}'}"
|
||||||
|
Foreground="White" FontSize="10" FontWeight="SemiBold"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
<Button Content="Fehlzeiten öffnen" Command="{Binding OpenAbsencesCommand}" HorizontalAlignment="Stretch"/>
|
<Button Content="Fehlzeiten öffnen" Command="{Binding OpenAbsencesCommand}" HorizontalAlignment="Stretch"/>
|
||||||
<Button Content="Aufgaben & Wiedervorlagen" Command="{Binding GoToWorkloadCommand}"
|
<Button Content="Aufgaben & Wiedervorlagen" Command="{Binding GoToWorkloadCommand}"
|
||||||
HorizontalAlignment="Stretch" Background="Transparent"/>
|
HorizontalAlignment="Stretch" Background="Transparent"/>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<UserControl xmlns="https://github.com/avaloniaui"
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.ClassTeacher"
|
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.ClassTeacher"
|
||||||
|
xmlns:svm="clr-namespace:LehrerApp.Desktop.ViewModels.Students"
|
||||||
x:Class="LehrerApp.Desktop.Views.ClassTeacher.ClassTeacherRegisterView"
|
x:Class="LehrerApp.Desktop.Views.ClassTeacher.ClassTeacherRegisterView"
|
||||||
x:DataType="vm:ClassTeacherDetailsViewModel">
|
x:DataType="vm:ClassTeacherDetailsViewModel">
|
||||||
|
|
||||||
@@ -26,19 +27,77 @@
|
|||||||
<Style Selector="TextBlock.status.danger">
|
<Style Selector="TextBlock.status.danger">
|
||||||
<Setter Property="Foreground" Value="{DynamicResource AppStatusDangerBrush}"/>
|
<Setter Property="Foreground" Value="{DynamicResource AppStatusDangerBrush}"/>
|
||||||
</Style>
|
</Style>
|
||||||
|
<Style Selector="Button.regSource">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource AppFilterBorderBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="CornerRadius" Value="6"/>
|
||||||
|
<Setter Property="Padding" Value="14,6"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Button.regSource.active">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource AppFilterActiveBackgroundBrush}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource AppFilterActiveBorderBrush}"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource AppFilterActiveForegroundBrush}"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Border.countBadge">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource AppChipBackgroundBrush}"/>
|
||||||
|
<Setter Property="CornerRadius" Value="11"/>
|
||||||
|
<Setter Property="Padding" Value="9,3"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Border.countBadge.attention">
|
||||||
|
<Setter Property="Background" Value="#E53935"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Border.countBadge TextBlock">
|
||||||
|
<Setter Property="FontSize" Value="11"/>
|
||||||
|
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="Border.countBadge.attention TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="White"/>
|
||||||
|
</Style>
|
||||||
</UserControl.Styles>
|
</UserControl.Styles>
|
||||||
|
|
||||||
<Grid RowDefinitions="Auto,Auto,Auto,*,Auto" Margin="16" RowSpacing="10">
|
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*,Auto" Margin="16" RowSpacing="10">
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="*,Auto">
|
<Grid Grid.Row="0" ColumnDefinitions="*,Auto">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Klassenbucheinträge" FontSize="22" FontWeight="SemiBold"/>
|
<TextBlock Text="Klassenbuch" FontSize="22" FontWeight="SemiBold"/>
|
||||||
<TextBlock Text="Einträge anderer Lehrkräfte – nur zur Ansicht" FontSize="12" Opacity="0.55"/>
|
<TextBlock Text="Einträge anderer Lehrkräfte – nur zur Ansicht" FontSize="12" Opacity="0.55"
|
||||||
|
IsVisible="{Binding !ShowOwnDocumentation}"/>
|
||||||
|
<TextBlock Text="Eigene Dokumentation zu Schüler*innen dieser Klasse" FontSize="12" Opacity="0.55"
|
||||||
|
IsVisible="{Binding ShowOwnDocumentation}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button Grid.Column="1" Content="↻ Aus WebUntis aktualisieren" Command="{Binding RefreshCommand}"
|
<Button Grid.Column="1" Content="↻ Aus WebUntis aktualisieren" Command="{Binding RefreshCommand}"
|
||||||
IsEnabled="{Binding !Busy}" Background="Transparent" Foreground="{DynamicResource AppAccentTextBrush}" VerticalAlignment="Center"/>
|
IsEnabled="{Binding !Busy}" Background="Transparent" Foreground="{DynamicResource AppAccentTextBrush}" VerticalAlignment="Center"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Border Grid.Row="1" Classes="filterCard">
|
<!-- Nutzer-Feedback: Klassenbuch-Tab als Dokumentations-Hub — Umschalter zwischen dem
|
||||||
|
WebUntis-Bericht anderer Lehrkräfte und der eigenen Dokumentation zu Schüler*innen dieser
|
||||||
|
Klasse, statt beide (strukturell unterschiedliche) Datensätze in eine Liste zu zwingen.
|
||||||
|
Zahlen-Badges links/rechts zeigen die Anzahl je Quelle, in Rot hervorgehoben, wenn kritische
|
||||||
|
bzw. nacharbeitsbedürftige Einträge dabei sind. -->
|
||||||
|
<StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="10" HorizontalAlignment="Center">
|
||||||
|
<Border Classes="countBadge" Classes.attention="{Binding !!UntisCriticalCount}">
|
||||||
|
<TextBlock Text="{Binding Entries.Count, StringFormat='Klassenbuch: {0}'}"/>
|
||||||
|
</Border>
|
||||||
|
<Border Classes="countBadge" Classes.attention="{Binding !!UntisCriticalCount}" IsVisible="{Binding !!UntisCriticalCount}">
|
||||||
|
<TextBlock Text="{Binding UntisCriticalCount, StringFormat='davon kritisch: {0}'}"/>
|
||||||
|
</Border>
|
||||||
|
<Button Classes="regSource" Classes.active="{Binding !ShowOwnDocumentation}"
|
||||||
|
Content="Klassenbuch (Untis)" Command="{Binding ShowUntisRegisterCommand}"/>
|
||||||
|
<Button Classes="regSource" Classes.active="{Binding ShowOwnDocumentation}"
|
||||||
|
Content="Eigene Dokumentation" Command="{Binding ShowOwnDocsCommand}"/>
|
||||||
|
<Border Classes="countBadge">
|
||||||
|
<TextBlock Text="{Binding OwnDocumentationCount, StringFormat='Dokumentation: {0}'}"/>
|
||||||
|
</Border>
|
||||||
|
<Border Classes="countBadge attention" IsVisible="{Binding !!OwnDocumentationFollowUpCount}">
|
||||||
|
<TextBlock Text="{Binding OwnDocumentationFollowUpCount, StringFormat='Nacharbeit: {0}'}"/>
|
||||||
|
</Border>
|
||||||
|
<Border Classes="countBadge attention" IsVisible="{Binding !!OwnDocumentationCriticalCount}">
|
||||||
|
<TextBlock Text="{Binding OwnDocumentationCriticalCount, StringFormat='kritisch: {0}'}"/>
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Border Grid.Row="2" Classes="filterCard">
|
||||||
<Grid RowDefinitions="Auto,Auto" RowSpacing="8">
|
<Grid RowDefinitions="Auto,Auto" RowSpacing="8">
|
||||||
<Grid Grid.Row="0" ColumnDefinitions="155,Auto,*,Auto,*" ColumnSpacing="8">
|
<Grid Grid.Row="0" ColumnDefinitions="155,Auto,*,Auto,*" ColumnSpacing="8">
|
||||||
<ComboBox Grid.Column="0" SelectedIndex="{Binding QuickRangeIndex, Mode=TwoWay}">
|
<ComboBox Grid.Column="0" SelectedIndex="{Binding QuickRangeIndex, Mode=TwoWay}">
|
||||||
@@ -62,7 +121,7 @@
|
|||||||
Kategorie ("Hausaufgaben fehlen: 12× — 5× Ben Schmidt, 3× Ada Müller") ist die eigentlich
|
Kategorie ("Hausaufgaben fehlen: 12× — 5× Ben Schmidt, 3× Ada Müller") ist die eigentlich
|
||||||
interessante Information. Als Chip-Reihe statt eigener Spalte in der Tabelle, damit die
|
interessante Information. Als Chip-Reihe statt eigener Spalte in der Tabelle, damit die
|
||||||
bestehenden Spalten unangetastet bleiben. -->
|
bestehenden Spalten unangetastet bleiben. -->
|
||||||
<Border Grid.Row="2" Classes="filterCard" IsVisible="{Binding HasCategoryAggregates}">
|
<Border Grid.Row="3" Classes="filterCard" IsVisible="{Binding ShowCategoryAggregates}">
|
||||||
<StackPanel Spacing="6">
|
<StackPanel Spacing="6">
|
||||||
<TextBlock Text="Kategorien im Zeitraum" FontSize="12" FontWeight="SemiBold" Opacity="0.7"/>
|
<TextBlock Text="Kategorien im Zeitraum" FontSize="12" FontWeight="SemiBold" Opacity="0.7"/>
|
||||||
<ItemsControl ItemsSource="{Binding CategoryAggregates}">
|
<ItemsControl ItemsSource="{Binding CategoryAggregates}">
|
||||||
@@ -86,7 +145,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<Grid Grid.Row="3">
|
<Grid Grid.Row="4" IsVisible="{Binding !ShowOwnDocumentation}">
|
||||||
<DataGrid ItemsSource="{Binding Entries}" AutoGenerateColumns="False" IsReadOnly="True"
|
<DataGrid ItemsSource="{Binding Entries}" AutoGenerateColumns="False" IsReadOnly="True"
|
||||||
GridLinesVisibility="Horizontal" BorderBrush="{DynamicResource AppCardBorderBrush}" BorderThickness="1"
|
GridLinesVisibility="Horizontal" BorderBrush="{DynamicResource AppCardBorderBrush}" BorderThickness="1"
|
||||||
CanUserResizeColumns="True" CanUserSortColumns="True" RowHeight="46">
|
CanUserResizeColumns="True" CanUserSortColumns="True" RowHeight="46">
|
||||||
@@ -105,6 +164,77 @@
|
|||||||
<TextBlock Text="Passe Zeitraum oder Schülerfilter an." FontSize="12" Opacity="0.55"/>
|
<TextBlock Text="Passe Zeitraum oder Schülerfilter an." FontSize="12" Opacity="0.55"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Grid.Row="4" Text="{Binding Status}" FontSize="11" Opacity="0.6"/>
|
|
||||||
|
<Grid Grid.Row="4" IsVisible="{Binding ShowOwnDocumentation}" RowDefinitions="Auto,*">
|
||||||
|
<Button Grid.Row="0" Content="+ Eintrag" Command="{Binding AddOwnDocumentationCommand}"
|
||||||
|
HorizontalAlignment="Right" Margin="0,0,0,8"/>
|
||||||
|
<ScrollViewer Grid.Row="1">
|
||||||
|
<StackPanel>
|
||||||
|
<ItemsControl ItemsSource="{Binding OwnDocumentationEntries}">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate DataType="svm:DocumentationItem">
|
||||||
|
<Border Background="{DynamicResource SystemControlBackgroundAltHighBrush}"
|
||||||
|
CornerRadius="6" Padding="12,10" Margin="0,0,0,8">
|
||||||
|
<StackPanel Spacing="4">
|
||||||
|
<Grid ColumnDefinitions="80,*,Auto,Auto,Auto,Auto">
|
||||||
|
<TextBlock Grid.Column="0" Text="{Binding DateDisplay}" Opacity="0.5" FontSize="12"/>
|
||||||
|
<StackPanel Grid.Column="1" Margin="8,0">
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="6">
|
||||||
|
<Border Background="#FB8C00" CornerRadius="8" Padding="6,1"
|
||||||
|
IsVisible="{Binding IsDraft}">
|
||||||
|
<TextBlock Text="ENTWURF" Foreground="White" FontSize="9" FontWeight="Bold"/>
|
||||||
|
</Border>
|
||||||
|
<TextBlock Text="{Binding StudentName}" FontWeight="SemiBold" FontSize="13"/>
|
||||||
|
<TextBlock Text="{Binding Model.Title}" FontSize="13" Opacity="0.8"
|
||||||
|
IsVisible="{Binding IsRevealed}"/>
|
||||||
|
<TextBlock Text="Vertraulich" FontSize="13" Opacity="0.6"
|
||||||
|
IsVisible="{Binding !IsRevealed}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Text="{Binding TypeLabel}" FontSize="11" Opacity="0.5"/>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Grid.Column="2" Text="🔒" FontSize="14" VerticalAlignment="Center"
|
||||||
|
IsVisible="{Binding IsConfidential}" ToolTip.Tip="Vertraulich"/>
|
||||||
|
<Button Grid.Column="3" Content="Anzeigen" FontSize="11" Padding="8,3" Margin="6,0,0,0"
|
||||||
|
Command="{Binding RevealCommand}" IsVisible="{Binding !IsRevealed}"/>
|
||||||
|
<StackPanel Grid.Column="4" Orientation="Horizontal" Spacing="4" Margin="6,0,0,0"
|
||||||
|
IsVisible="{Binding IsRevealed}">
|
||||||
|
<Button Content="Bearbeiten" FontSize="11" Padding="8,3"
|
||||||
|
Command="{Binding $parent[ItemsControl].((vm:ClassTeacherDetailsViewModel)DataContext).EditOwnDocumentationCommand}"
|
||||||
|
CommandParameter="{Binding}"/>
|
||||||
|
<Button Content="Löschen" FontSize="11" Padding="8,3"
|
||||||
|
Command="{Binding $parent[ItemsControl].((vm:ClassTeacherDetailsViewModel)DataContext).DeleteOwnDocumentationCommand}"
|
||||||
|
CommandParameter="{Binding}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Text="{Binding Model.Content}" FontSize="12" TextWrapping="Wrap" Opacity="0.8"
|
||||||
|
IsVisible="{Binding IsRevealed}"/>
|
||||||
|
<StackPanel Orientation="Horizontal" Spacing="8" IsVisible="{Binding IsRevealed}">
|
||||||
|
<TextBlock Text="{Binding StatusLabel}" FontSize="11" Opacity="0.55"
|
||||||
|
IsVisible="{Binding StatusLabel, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||||
|
<TextBlock Text="📎 Anhang" FontSize="11" Opacity="0.55" IsVisible="{Binding HasAttachments}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ItemsControl ItemsSource="{Binding TagChips}" IsVisible="{Binding IsRevealed}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate><WrapPanel ItemSpacing="6" LineSpacing="4"/></ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate DataType="svm:TagChip">
|
||||||
|
<Border Background="{Binding ColorHex}" CornerRadius="10" Padding="8,2">
|
||||||
|
<TextBlock Text="{Binding Text}" FontSize="10" Foreground="White"/>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
<TextBlock Text="Keine eigene Dokumentation im gewählten Zeitraum." Classes="emptyhint"
|
||||||
|
IsVisible="{Binding !HasOwnDocumentationEntries}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock Grid.Row="5" Text="{Binding Status}" FontSize="11" Opacity="0.6"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -1,8 +1,50 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
|
using LehrerApp.Core.Interfaces;
|
||||||
|
using LehrerApp.Core.Models;
|
||||||
|
using LehrerApp.Desktop.ViewModels.ClassTeacher;
|
||||||
|
using LehrerApp.Desktop.ViewModels.Students;
|
||||||
|
using LehrerApp.Desktop.Views.Shared;
|
||||||
|
using LehrerApp.Desktop.Views.Students;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace LehrerApp.Desktop.Views.ClassTeacher;
|
namespace LehrerApp.Desktop.Views.ClassTeacher;
|
||||||
|
|
||||||
public partial class ClassTeacherRegisterView : UserControl
|
public partial class ClassTeacherRegisterView : UserControl
|
||||||
{
|
{
|
||||||
public ClassTeacherRegisterView() => InitializeComponent();
|
public ClassTeacherRegisterView() => InitializeComponent();
|
||||||
|
|
||||||
|
protected override void OnDataContextChanged(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnDataContextChanged(e);
|
||||||
|
if (DataContext is not ClassTeacherDetailsViewModel vm) return;
|
||||||
|
vm.OnEditOwnDocumentation = ShowDocumentationDialog;
|
||||||
|
vm.OnConfirmDeleteOwnDocumentation = ShowDeleteDocumentationDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<Documentation?> ShowDocumentationDialog(
|
||||||
|
List<StudentOption> studentOptions, Documentation? editing)
|
||||||
|
{
|
||||||
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||||
|
if (owner is null) return null;
|
||||||
|
|
||||||
|
var vm = new DocumentationDialogViewModel(editing?.StudentId ?? Guid.Empty, editing,
|
||||||
|
App.Services.GetRequiredService<IAttachmentStorage>(), studentOptions);
|
||||||
|
var dialog = new DocumentationDialog { DataContext = vm };
|
||||||
|
var saved = await dialog.ShowDialog<bool>(owner);
|
||||||
|
if (!saved) vm.DiscardUnsavedAttachments();
|
||||||
|
return saved ? vm.Result : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> ShowDeleteDocumentationDialog(DocumentationItem item)
|
||||||
|
{
|
||||||
|
var info = new ConfirmDialogInfo
|
||||||
|
{
|
||||||
|
Title = "Eintrag löschen?",
|
||||||
|
Message = $"\"{item.Model.Title}\" ({item.StudentName}) wird als gelöscht markiert und nicht mehr angezeigt.",
|
||||||
|
ConfirmText = "Löschen",
|
||||||
|
};
|
||||||
|
var dialog = new ConfirmDialog { DataContext = info };
|
||||||
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||||
|
return owner is not null && await dialog.ShowDialog<bool>(owner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1761,6 +1761,33 @@ eigenen Unterricht abfragt und deshalb mit den regulären Lehrkraft-Rechten funk
|
|||||||
Fehlzeiten-Einträge an Tagen mit tatsächlichem Unterricht) — von echter Anwesenheit ist das aus
|
Fehlzeiten-Einträge an Tagen mit tatsächlichem Unterricht) — von echter Anwesenheit ist das aus
|
||||||
dem WebUntis-Fehlzeitenbericht allein nicht unterscheidbar, dafür bräuchte es Daten darüber, ob
|
dem WebUntis-Fehlzeitenbericht allein nicht unterscheidbar, dafür bräuchte es Daten darüber, ob
|
||||||
für eine Stunde überhaupt eine Anwesenheitsprüfung stattfand.
|
für eine Stunde überhaupt eine Anwesenheitsprüfung stattfand.
|
||||||
|
- [x] **"Klassenlehrer"-Feature — Klassenbuch-Tab als Dokumentations-Hub (September 2026):**
|
||||||
|
Nutzer-Feedback: der Klassenbuch-Tab zeigte bisher nur den WebUntis-Bericht anderer Lehrkräfte —
|
||||||
|
die eigene Dokumentation zu Schüler*innen der Klasse (Gespräche, Vorkommnisse, Förderpläne, …)
|
||||||
|
hatte dort keinen Platz, obwohl der reale Arbeitsablauf beides mischt. Erwogen wurde ein Merge
|
||||||
|
beider Datensätze in eine Liste, verworfen: `ClassTeacherClassRegisterRow` (flache,
|
||||||
|
ID-lose WebUntis-Berichtszeile) und `Documentation` (LiteDB-Entität mit typspezifischen
|
||||||
|
Unterdaten, Anhängen, Vertraulichkeits-Freigabe, Tags) sind strukturell zu verschieden — ein
|
||||||
|
Merge hätte genau die vom Nutzer selbst befürchtete fummelige Konverter-Klasse gebraucht, für
|
||||||
|
zwei Dinge, die inhaltlich verschieden sind (was eine Kollegin notiert hat vs. was ich selbst
|
||||||
|
dokumentiert habe).
|
||||||
|
Stattdessen ein Umschalter `ClassTeacherDetailsViewModel.ShowOwnDocumentation` zwischen
|
||||||
|
"Klassenbuch (Untis)" und "Eigene Dokumentation", mit Zahlen-Badges links/rechts (Gesamtzahl je
|
||||||
|
Quelle, in Rot hervorgehoben bei kritischen WebUntis-Kategorien bzw. eigenen Einträgen mit dem
|
||||||
|
Tag "Kritisch"/`IsDraft`-Status "Nacharbeiten") — dieselben Badges zusätzlich klein am
|
||||||
|
"Klassenbuch öffnen"-Button der Übersicht (`ClassTeacherOverviewViewModel.BuildOwnDocumentationCounts`).
|
||||||
|
Die eigene Dokumentation gibt es nur lokal, nicht in WebUntis — `Documentation.StudentId` lässt
|
||||||
|
sich der (rein WebUntis-basierten) Klasse deshalb nur über denselben Namensabgleich zuordnen, den
|
||||||
|
die Übersicht schon für ihr Roster nutzt (`ClassTeacherOverviewViewModel.MatchStudent`). Liste,
|
||||||
|
Anlegen/Bearbeiten/Löschen und Vertraulichkeits-Freigabe sind eins zu eins vom Gruppen-Tab
|
||||||
|
übernommen (`DocumentationItem`, `DocumentationDialogViewModel`/`DocumentationDialog`,
|
||||||
|
`ConfirmDialog`) statt neu gebaut. Die Filter-/Sortierlogik steckt in der reinen, ohne
|
||||||
|
Repository-Zugriff testbaren `ClassTeacherDetailsViewModel.FilterOwnDocumentation` (gleiches
|
||||||
|
Muster wie `ClassTeacherRosterRow.Build`), damit Anlegen/Bearbeiten/Löschen eines eigenen
|
||||||
|
Eintrags nicht auch die WebUntis-Berichte neu abruft.
|
||||||
|
**Bewusst zurückgestellt:** Kategorien-Chipreihe (bisher nur WebUntis-`CategoryGroup`) auf eigene
|
||||||
|
Tags erweitern; "Gespräch begleiten" (Elternanruf-Durchführung) aus dem Gruppen-Tab wurde hier
|
||||||
|
nicht übernommen, da dieser Hub bewusst schlank gehalten wurde.
|
||||||
|
|
||||||
### 4.4 Wochen-/Tagesansicht
|
### 4.4 Wochen-/Tagesansicht
|
||||||
- [x] **4.4.1** Kalenderansicht über alle Gruppen: Woche und Tag — siehe Nachtrag zu 4.3
|
- [x] **4.4.1** Kalenderansicht über alle Gruppen: Woche und Tag — siehe Nachtrag zu 4.3
|
||||||
|
|||||||
Reference in New Issue
Block a user