feat: Formulare-Menü mit Elternbrief-Einstieg + Arbeitsblatt-Personalisierung (Nutzer-Feedback)
CI / build-and-test (push) Canceled after 0s

Neue Menü-Kategorie "Formulare" in der Menüleiste: "Elternbrief erzeugen..." öffnet
jetzt einen Schüler-Picker statt nur aus der Schülerdetailansicht erreichbar zu sein,
"Arbeitsblatt personalisieren..." ist aktiv, sobald eine einzelne Lerngruppe geöffnet
ist, und erzeugt aus einer in TemplateDesigner gebauten .lavorlage-Vorlage ein PDF je
aktivem Gruppenmitglied - über eine von den Elternbrief-Vorlagen getrennte
WorksheetTemplateStore-Bibliothek.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-13 00:21:08 +02:00
co-authored by Claude Sonnet 5
parent bfe214ecf2
commit 56ab5067e6
22 changed files with 715 additions and 17 deletions
@@ -1,10 +1,17 @@
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Threading;
using LehrerApp.Core.Interfaces;
using LehrerApp.Core.Models;
using LehrerApp.Desktop.Services;
using LehrerApp.Desktop.ViewModels;
using LehrerApp.Desktop.ViewModels.Groups;
using LehrerApp.Desktop.ViewModels.Students;
using LehrerApp.Desktop.Views.Groups;
using LehrerApp.Desktop.Views.Students;
using LehrerApp.Desktop.Views.UntisHub;
using LehrerApp.Sync;
using LehrerApp.Templating;
using Microsoft.Extensions.DependencyInjection;
namespace LehrerApp.Desktop.Views;
@@ -45,6 +52,25 @@ public partial class MainWindow : Window
await UntisHubActions.RunHausaufgabenAsync(this, App.Services.GetRequiredService<UntisHubService>());
}
private async void OnCreateParentLetter(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
var picker = new StudentPickerDialog
{ DataContext = new StudentPickerDialogViewModel(App.Services.GetRequiredService<IStudentRepository>()) };
if (await picker.ShowDialog<Student?>(this) is { } student)
await LetterDialogs.ShowCreateLetterDialogAsync(this, student);
}
private async void OnPersonalizeWorksheet(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
{
if (DataContext is not MainWindowViewModel { CurrentGroupDetail.Group: { } group } vm) return;
var studentIds = vm.CurrentGroupDetail!.Students.Select(s => s.Id).ToList();
var dialogVm = new PersonalizeWorksheetDialogViewModel(group, studentIds,
App.Services.GetRequiredService<IStudentRepository>(),
App.Services.GetRequiredService<WorksheetTemplateStore>(),
App.Services.GetRequiredService<ITemplateRenderer>());
await new PersonalizeWorksheetDialog { DataContext = dialogVm }.ShowDialog(this);
}
private void OnWindowKeyDown(object? sender, KeyEventArgs e)
{
if (DataContext is not MainWindowViewModel vm) return;