Add warning detail popup and quick blocks for Vorgänge
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>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-09-26 11:16:13 +02:00
1 parent 0f6cadc9c8
commit aa326cf8b6
25 files changed
+1571 -75

No files matched your search

@@ -0,0 +1,67 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LehrerApp.Desktop.Views.Shared"
x:Class="LehrerApp.Desktop.Views.Shared.CompactMonthCalendar"
x:Name="Root">
<!-- Verdichtete Monatsansicht: exakt eine Zelle je Kalendertag, nach Wochentag ausgerichtet
(Leerzellen vor dem 1., siehe CompactMonthCalendar.BuildCells). Ohne Ereignis bleibt nur die
Tageszahl sichtbar; bei Auffälligkeiten ersetzt das stärkste Statuskürzel die Zahl. Alle
Details bleiben per Tooltip erhalten. Aus ClassTeacherOverviewView herausgelöst, damit das
Detail-Popup der Dashboard-Warnungen dasselbe Widget wiederverwendet. -->
<UserControl.Styles>
<Style Selector="Border.compactDay">
<Setter Property="Width" Value="28"/>
<Setter Property="Height" Value="28"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Background" Value="{DynamicResource AppChipBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AppCardBorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Margin" Value="2"/>
</Style>
<Style Selector="Border.compactDay.today">
<Setter Property="BorderBrush" Value="{DynamicResource AppAccentTextBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
</Style>
</UserControl.Styles>
<StackPanel HorizontalAlignment="Center">
<ItemsControl ItemsSource="{x:Static local:CompactMonthCalendar.WeekdayHeaders}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate><UniformGrid Columns="7"/></ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" FontSize="9" FontWeight="Bold" Opacity="0.5"
Width="32" TextAlignment="Center"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl ItemsSource="{Binding #Root.Cells}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate><UniformGrid Columns="7"/></ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="local:CompactMonthCell">
<Panel Width="32" Height="32">
<Border Classes="compactDay" Classes.today="{Binding Day.IsToday, FallbackValue=False}"
IsVisible="{Binding IsDay}" ToolTip.Tip="{Binding Day.Tooltip}">
<Grid>
<TextBlock Text="{Binding Day.DayNumber}" FontSize="11" Opacity="0.7"
HorizontalAlignment="Center" VerticalAlignment="Center"
IsVisible="{Binding !Day.HasSignal, FallbackValue=False}"/>
<Border Background="{Binding Day.SignalColorHex}" CornerRadius="5"
IsVisible="{Binding Day.HasSignal, FallbackValue=False}">
<TextBlock Text="{Binding Day.SignalCode}" Foreground="White" FontSize="11"
FontWeight="Bold" HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
</Grid>
</Border>
</Panel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</UserControl>
@@ -0,0 +1,78 @@
using System.Collections;
using System.Collections.Specialized;
using Avalonia;
using Avalonia.Controls;
using LehrerApp.Desktop.ViewModels.ClassTeacher;
namespace LehrerApp.Desktop.Views.Shared;
/// <summary>Eine Rasterzelle des kompakten Monatskalenders; <see cref="Day"/> ist null für die
/// Leerzellen vor dem Monatsersten.</summary>
public sealed record CompactMonthCell(ClassTeacherCompactCalendarDay? Day)
{
public bool IsPlaceholder => Day is null;
public bool IsDay => Day is not null;
}
/// <summary>Kompakter Monatskalender (eine Zelle je Tag, Statuskürzel statt Tageszahl) — erwartet
/// <see cref="ClassTeacherCompactCalendarDay"/>-Einträge in <see cref="Days"/>, genau einen je
/// Kalendertag ab dem Monatsersten. Genutzt von der Klassenlehrer-Übersicht und dem Detail-Popup der
/// Dashboard-Warnungen.
/// Nutzer-Feedback: vorher begann jeder Monat oben links, der 1. stand also unabhängig vom
/// Wochentag in der Montags-Spalte. Die Ausrichtung passiert bewusst hier in der Anzeige (Leerzellen
/// vor dem Monatsersten + Kopfzeile Mo–So) statt in den beiden Buildern — deren Ergebnis bleibt
/// "ein Eintrag je Kalendertag" und damit für Tests/Aufrufer unverändert.</summary>
public partial class CompactMonthCalendar : UserControl
{
public static readonly StyledProperty<IEnumerable?> DaysProperty =
AvaloniaProperty.Register<CompactMonthCalendar, IEnumerable?>(nameof(Days));
public static readonly DirectProperty<CompactMonthCalendar, IReadOnlyList<CompactMonthCell>> CellsProperty =
AvaloniaProperty.RegisterDirect<CompactMonthCalendar, IReadOnlyList<CompactMonthCell>>(nameof(Cells), c => c.Cells);
public static string[] WeekdayHeaders { get; } = ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"];
private IReadOnlyList<CompactMonthCell> _cells = [];
private INotifyCollectionChanged? _observed;
public IEnumerable? Days
{
get => GetValue(DaysProperty);
set => SetValue(DaysProperty, value);
}
public IReadOnlyList<CompactMonthCell> Cells
{
get => _cells;
private set => SetAndRaise(CellsProperty, ref _cells, value);
}
public CompactMonthCalendar() => InitializeComponent();
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
if (change.Property != DaysProperty) return;
// Beide Aufrufer befüllen eine ObservableCollection per Clear/Add neu (Monat blättern,
// Schülerauswahl) — deshalb auf Änderungen der Sammlung selbst lauschen, nicht nur auf
// einen neuen Days-Wert.
if (_observed is not null) _observed.CollectionChanged -= OnDaysCollectionChanged;
_observed = Days as INotifyCollectionChanged;
if (_observed is not null) _observed.CollectionChanged += OnDaysCollectionChanged;
RebuildCells();
}
private void OnDaysCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) => RebuildCells();
private void RebuildCells() => Cells = BuildCells(Days?.OfType<ClassTeacherCompactCalendarDay>() ?? []);
public static IReadOnlyList<CompactMonthCell> BuildCells(IEnumerable<ClassTeacherCompactCalendarDay> days)
{
var list = days.ToList();
if (list.Count == 0) return [];
var leading = ((int)list[0].Date.DayOfWeek + 6) % 7; // Montag = 0 … Sonntag = 6
return Enumerable.Repeat(new CompactMonthCell(null), leading)
.Concat(list.Select(d => new CompactMonthCell(d)))
.ToList();
}
}
@@ -0,0 +1,70 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels"
xmlns:svc="clr-namespace:LehrerApp.Desktop.Services"
xmlns:shared="clr-namespace:LehrerApp.Desktop.Views.Shared"
x:Class="LehrerApp.Desktop.Views.Shared.StudentWarningDetailView"
x:DataType="vm:StudentWarningDetailViewModel"
Width="320">
<!-- Inhalt des "Details"-Popups einer Dashboard-Warnung (Fehlzeiten/Hausaufgaben/Verspätungen). -->
<StackPanel Spacing="10">
<StackPanel Spacing="2">
<TextBlock Text="{Binding Header}" FontSize="14" FontWeight="SemiBold"/>
<TextBlock Text="{Binding Summary}" FontSize="11" Opacity="0.65" TextWrapping="Wrap"/>
</StackPanel>
<ItemsControl ItemsSource="{Binding Figures}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate><WrapPanel ItemSpacing="6" LineSpacing="6"/></ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:WarningDetailFigure">
<Border Background="{DynamicResource AppChipBackgroundBrush}" CornerRadius="6" Padding="8,4">
<StackPanel>
<TextBlock Text="{Binding Value}" FontSize="15" FontWeight="SemiBold"/>
<TextBlock Text="{Binding Label}" FontSize="10" Opacity="0.6"/>
</StackPanel>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<Grid ColumnDefinitions="Auto,*,Auto">
<Button Grid.Column="0" Content="‹" Padding="8,2" Command="{Binding PreviousMonthCommand}"
ToolTip.Tip="Vorheriger Monat" AutomationProperties.Name="Vorheriger Monat"/>
<TextBlock Grid.Column="1" Text="{Binding MonthLabel}" FontSize="12" FontWeight="SemiBold"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Grid.Column="2" Content="›" Padding="8,2" Command="{Binding NextMonthCommand}"
ToolTip.Tip="Nächster Monat" AutomationProperties.Name="Nächster Monat"/>
</Grid>
<shared:CompactMonthCalendar Days="{Binding CalendarDays}"/>
<TextBlock Text="{Binding Legend}" FontSize="9" Opacity="0.5" TextWrapping="Wrap"/>
<StackPanel Spacing="3" IsVisible="{Binding HasEvents}">
<TextBlock Text="{Binding ListHeader}" FontSize="11" FontWeight="SemiBold" Opacity="0.7"/>
<ItemsControl ItemsSource="{Binding Events}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="svc:StudentEvidenceEvent">
<Grid ColumnDefinitions="18,62,*" Margin="0,1">
<Border Width="14" Height="14" CornerRadius="7" Background="{Binding ColorHex}"
VerticalAlignment="Center">
<TextBlock Text="{Binding Code}" Foreground="White" FontSize="8" FontWeight="Bold"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<TextBlock Grid.Column="1" Text="{Binding DateLabel}" FontSize="11" Opacity="0.65"
VerticalAlignment="Center"/>
<TextBlock Grid.Column="2" FontSize="11" TextTrimming="CharacterEllipsis" VerticalAlignment="Center"
ToolTip.Tip="{Binding ListLine}">
<Run Text="{Binding GroupName}" FontWeight="SemiBold"/>
<Run Text=" · "/>
<Run Text="{Binding Label}"/>
</TextBlock>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Text="{Binding MoreEventsHint}" FontSize="10" Opacity="0.55" IsVisible="{Binding HasMoreEvents}"/>
</StackPanel>
</StackPanel>
</UserControl>
@@ -0,0 +1,8 @@
using Avalonia.Controls;
namespace LehrerApp.Desktop.Views.Shared;
public partial class StudentWarningDetailView : UserControl
{
public StudentWarningDetailView() => InitializeComponent();
}