CI / build-and-test (push) Canceled after 0s
Dashboard warnings (attendance, homework, lateness) get a "Details" flyout with key figures, a list of dates and the compact month calendar from the class teacher overview, now extracted as a shared control. The calendar now aligns days under their weekday (Mo-So header, blank leading cells). Creating Vorgänge and documentation is supported by quick blocks with the current figures, dated standard phrases (e.g. "Klassenleitung informiert") and documentation templates (status snapshot, conversation, informing the class/subject teachers, parent call, parent letter). The class teacher Vorgänge tab uses WebUntis figures (absences across all subjects, class register) for the same blocks and templates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.9 KiB
C#
69 lines
2.9 KiB
C#
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;
|
|
|
|
public partial class ClassTeacherCasesView : UserControl
|
|
{
|
|
public ClassTeacherCasesView() => InitializeComponent();
|
|
|
|
protected override void OnDataContextChanged(EventArgs e)
|
|
{
|
|
base.OnDataContextChanged(e);
|
|
if (DataContext is not ClassTeacherCasesViewModel vm) return;
|
|
vm.OnEditVorgang = ShowVorgangDialog;
|
|
vm.OnConfirmDeleteVorgang = ShowDeleteVorgangDialog;
|
|
vm.OnEditDocumentation = ShowDocumentationDialog;
|
|
}
|
|
|
|
private async Task<Vorgang?> ShowVorgangDialog(List<StudentOption> rosterStudents, Vorgang? editing)
|
|
{
|
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
|
if (owner is null) return null;
|
|
|
|
var cases = DataContext as ClassTeacherCasesViewModel;
|
|
var vm = new VorgangDialogViewModel(rosterStudents, editing,
|
|
phraseBlocks: VorgangPhraseBlocks.ForClassTeacher(DateOnly.FromDateTime(DateTime.Today)),
|
|
studentQuickBlocks: cases is null ? null : cases.QuickBlocksFor);
|
|
var dialog = new VorgangDialog { DataContext = vm };
|
|
var saved = await dialog.ShowDialog<bool>(owner);
|
|
return saved ? vm.Result : null;
|
|
}
|
|
|
|
private async Task<bool> ShowDeleteVorgangDialog(VorgangItem item)
|
|
{
|
|
var info = new ConfirmDialogInfo
|
|
{
|
|
Title = "Vorgang löschen?",
|
|
Message = $"\"{item.Model.Title}\" wird als gelöscht markiert und nicht mehr angezeigt. " +
|
|
"Verknüpfte Dokumentation bleibt erhalten.",
|
|
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);
|
|
}
|
|
|
|
private async Task<Documentation?> ShowDocumentationDialog(
|
|
Guid defaultStudentId, List<StudentOption> studentOptions, Documentation? editing)
|
|
{
|
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
|
if (owner is null) return null;
|
|
|
|
var isNewDraft = editing is not null
|
|
&& (DataContext as ClassTeacherCasesViewModel)?.IsNewDocumentationDraft(editing) == true;
|
|
var vm = new DocumentationDialogViewModel(defaultStudentId, editing,
|
|
App.Services.GetRequiredService<IAttachmentStorage>(), studentOptions, isNewDraft: isNewDraft);
|
|
var dialog = new DocumentationDialog { DataContext = vm };
|
|
var saved = await dialog.ShowDialog<bool>(owner);
|
|
if (!saved) vm.DiscardUnsavedAttachments();
|
|
return saved ? vm.Result : null;
|
|
}
|
|
}
|