Schülerberichte und erweiterte Deckblatt-Bausteine ergänzen
CI / build-and-test (push) Canceled after 0s

This commit is contained in:
admin committed 2026-10-22 11:24:43 +02:00
1 parent 336869e75f
commit e2f019667a
31 files changed
+961 -14

No files matched your search

@@ -29,6 +29,8 @@
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8" VerticalAlignment="Top">
<TextBlock Text="{Binding StudentStatus}" VerticalAlignment="Center" Opacity="0.65"/>
<Button Content="Schülerbericht" Command="{Binding CreateStudentReportCommand}"
IsVisible="{Binding !IsEditing}"/>
<Button Content="PDF-Brief" Command="{Binding CreateLetterCommand}"
IsVisible="{Binding !IsEditing}"/>
<Button Content="Bearbeiten" Command="{Binding StartEditCommand}"
@@ -27,6 +27,7 @@ public partial class StudentDetailView : UserControl
vm.OnConductParentCall = ShowParentCallSessionDialog;
vm.OnManageStudent = ShowManageStudentDialog;
vm.OnCreateLetter = ShowCreateLetterDialog;
vm.OnCreateStudentReport = ShowStudentReportDialog;
}
private async Task<Contact?> ShowContactDialog(Contact? contact)
@@ -58,6 +59,22 @@ public partial class StudentDetailView : UserControl
await LetterDialogs.ShowCreateLetterDialogAsync(owner, student);
}
private async Task ShowStudentReportDialog()
{
if (TopLevel.GetTopLevel(this) is not Window owner ||
DataContext is not StudentDetailViewModel { Student: { } student }) return;
var vm = new StudentReportDialogViewModel(student,
App.Services.GetRequiredService<IGroupMembershipRepository>(),
App.Services.GetRequiredService<IGroupRepository>(),
App.Services.GetRequiredService<IInterimGradeRepository>(),
App.Services.GetRequiredService<StudentReportService>(),
App.Services.GetRequiredService<LehrerApp.Templating.ITemplateRenderer>(),
App.Services.GetRequiredService<LehrerApp.Core.Services.SchoolYearService>(),
[App.Services.GetRequiredService<LehrerApp.Templating.TemplateStore>(),
App.Services.GetRequiredService<LehrerApp.Templating.WorksheetTemplateStore>().Store]);
await new StudentReportDialog { DataContext = vm }.ShowDialog(owner);
}
private void ShowAddressViewer(ContactItem contact)
{
if (!contact.HasAddress) return;
@@ -0,0 +1,56 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Students"
x:Class="LehrerApp.Desktop.Views.Students.StudentReportDialog"
x:DataType="vm:StudentReportDialogViewModel"
Title="Schülerbericht" Width="560" Height="760" MinWidth="460" MinHeight="500"
WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="Auto,*,Auto" Margin="24">
<StackPanel Spacing="4" Margin="0,0,0,16">
<TextBlock Text="Schülerbericht" Classes="dialogtitle"/>
<TextBlock Text="{Binding StudentName}"/>
</StackPanel>
<ScrollViewer Grid.Row="1">
<StackPanel Spacing="12" IsEnabled="{Binding !IsGenerating}">
<TextBlock Text="Lerngruppe und Schuljahr" FontWeight="SemiBold"/>
<ComboBox ItemsSource="{Binding Groups}" SelectedItem="{Binding SelectedGroup}"
DisplayMemberBinding="{Binding Display}" HorizontalAlignment="Stretch"/>
<TextBlock Text="Vorlage" FontWeight="SemiBold"/>
<ComboBox ItemsSource="{Binding Templates}" SelectedItem="{Binding SelectedTemplate}"
DisplayMemberBinding="{Binding Name}" HorizontalAlignment="Stretch"/>
<Grid ColumnDefinitions="*,12,*">
<StackPanel Spacing="4">
<TextBlock Text="Von (TT.MM.JJJJ)"/>
<TextBox Text="{Binding From}"/>
</StackPanel>
<StackPanel Grid.Column="2" Spacing="4">
<TextBlock Text="Bis (TT.MM.JJJJ)"/>
<TextBox Text="{Binding To}"/>
</StackPanel>
</Grid>
<CheckBox Content="Notenzwischenstand" IsChecked="{Binding IncludeInterim}"/>
<ComboBox ItemsSource="{Binding Interims}" SelectedItem="{Binding SelectedInterim}"
DisplayMemberBinding="{Binding Label}" HorizontalAlignment="Stretch"
PlaceholderText="Gespeicherten Zwischenstand auswählen" IsVisible="{Binding IncludeInterim}"/>
<CheckBox Content="Mitarbeitsgraph mit gewichteter Mitarbeit und Einzelaspekten" IsChecked="{Binding IncludeParticipation}"/>
<CheckBox Content="Kompetenzbewertungen" IsChecked="{Binding IncludeCompetencies}"/>
<CheckBox Content="Hausaufgabenkontrollen" IsChecked="{Binding IncludeHomework}"/>
<CheckBox Content="Klassenbucheinträge und Unterrichtsnotizen" IsChecked="{Binding IncludeDocumentation}"/>
<CheckBox Content="Vertrauliche Dokumentation einschließen" IsChecked="{Binding IncludeConfidential}"
IsVisible="{Binding IncludeDocumentation}"/>
<TextBlock Text="Dokumentation wird auf die gewählte Lerngruppe begrenzt. Entwürfe werden ausgelassen."
TextWrapping="Wrap" FontSize="12" Opacity="0.65"/>
<TextBlock Text="Ergänzender Text" FontWeight="SemiBold"/>
<TextBox Text="{Binding Comment}" AcceptsReturn="True" TextWrapping="Wrap" MinHeight="90"/>
</StackPanel>
</ScrollViewer>
<StackPanel Grid.Row="2" Spacing="10" Margin="0,12,0,0">
<ProgressBar IsVisible="{Binding IsGenerating}" IsIndeterminate="True" Height="6"/>
<TextBlock Text="{Binding StatusMessage}" TextWrapping="Wrap"/>
<Grid ColumnDefinitions="*,12,*">
<Button Content="Schließen" Click="OnClose" IsEnabled="{Binding !IsGenerating}" HorizontalAlignment="Stretch"/>
<Button Grid.Column="2" Content="PDF erzeugen…" Click="OnGenerate" IsEnabled="{Binding CanGenerate}" HorizontalAlignment="Stretch"/>
</Grid>
</StackPanel>
</Grid>
</Window>
@@ -0,0 +1,28 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
using LehrerApp.Desktop.ViewModels.Students;
namespace LehrerApp.Desktop.Views.Students;
public partial class StudentReportDialog : Window
{
public StudentReportDialog()
{
InitializeComponent();
Closing += (_, e) => e.Cancel = DataContext is StudentReportDialogViewModel { IsGenerating: true };
}
private void OnClose(object? sender, RoutedEventArgs e) => Close();
private async void OnGenerate(object? sender, RoutedEventArgs e)
{
if (DataContext is not StudentReportDialogViewModel vm) return;
var file = await StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{
Title = "Schülerbericht speichern", SuggestedFileName = vm.SuggestedFileName,
DefaultExtension = "pdf", FileTypeChoices = [new FilePickerFileType("PDF") { Patterns = ["*.pdf"] }],
});
if (file is null) return;
if (await vm.GenerateAsync(file.Path.LocalPath))
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(file.Path.LocalPath) { UseShellExecute = true });
}
}