Unterrichtsplanung: Serienerzeugung, Stundenraster, Aufsichten & Vertretung (Kapitel 4.2/4.3 Nachtrag)

Stunden serienweise aus dem Stundenplan erzeugen (4.2.5); Stundenraster
(Uhrzeiten je Stunde) in den Einstellungen mit Zeitbedarf-Rückmeldung im
Verlaufsplan-Editor; wiederkehrende Pausenaufsicht; neuer "Vertretung
eintragen"-Dialog für einmalige Vertretungsaufsicht, Vertretungsstunde,
Sondereinsätze (Ausflüge, Berufsmessen) und schlichten Stundenausfall.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-15 21:59:07 +02:00
co-authored by Claude Sonnet 5
parent 99b2de6519
commit d6dee72acc
30 changed files with 2743 additions and 48 deletions
@@ -0,0 +1,36 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
x:Class="LehrerApp.Desktop.Views.Groups.GenerateLessonSeriesDialog"
x:DataType="vm:GenerateLessonSeriesDialogViewModel"
Title="Stunden aus Stundenplan erzeugen"
Width="420" Height="300" MinWidth="380" MinHeight="280"
CanResize="False" WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="*,Auto" Margin="24">
<StackPanel Grid.Row="0" Spacing="14">
<TextBlock Text="Stunden aus Stundenplan erzeugen" Classes="dialogtitle"/>
<TextBlock FontSize="12" Opacity="0.6" TextWrapping="Wrap"
Text="Legt für jeden Wochentag/Stunde aus dem Stundenplan dieser Gruppe eine neue Stunde im gewählten Zeitraum an. Schulferien und Feiertage werden übersprungen, bereits vorhandene Termine nicht doppelt angelegt."/>
<Grid ColumnDefinitions="*,8,*">
<StackPanel Grid.Column="0" Spacing="4">
<TextBlock Text="Von *" FontSize="12" Opacity="0.7"/>
<TextBox Text="{Binding FromDateText}" PlaceholderText="TT.MM.JJJJ"/>
</StackPanel>
<StackPanel Grid.Column="2" Spacing="4">
<TextBlock Text="Bis *" FontSize="12" Opacity="0.7"/>
<TextBox Text="{Binding ToDateText}" PlaceholderText="TT.MM.JJJJ"/>
</StackPanel>
</Grid>
<TextBlock Text="{Binding DateError}" Foreground="Red" FontSize="11"
TextWrapping="Wrap"
IsVisible="{Binding DateError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
</StackPanel>
<Grid Grid.Row="1" ColumnDefinitions="*,8,*" Margin="0,20,0,0">
<Button Grid.Column="0" Content="Abbrechen" HorizontalAlignment="Stretch" Click="OnCancel"/>
<Button Grid.Column="2" Content="Erzeugen" HorizontalAlignment="Stretch" Click="OnSave"/>
</Grid>
</Grid>
</Window>
@@ -0,0 +1,21 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using LehrerApp.Desktop.ViewModels.Groups;
namespace LehrerApp.Desktop.Views.Groups;
public partial class GenerateLessonSeriesDialog : Window
{
public GenerateLessonSeriesDialog() => InitializeComponent();
private void OnSave(object? s, RoutedEventArgs e)
{
if (DataContext is GenerateLessonSeriesDialogViewModel vm && vm.SaveCommand.CanExecute(null))
{
vm.SaveCommand.Execute(null);
if (vm.Result is not null) Close(true);
}
}
private void OnCancel(object? s, RoutedEventArgs e) => Close(false);
}
@@ -50,7 +50,13 @@
<Grid ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="10" VerticalAlignment="Center">
<TextBlock Text="Verlaufsplan" FontSize="14" FontWeight="SemiBold"/>
<TextBlock Text="{Binding TotalDurationDisplay}" FontSize="12" Opacity="0.6"/>
<TextBlock Text="{Binding TotalDurationDisplay}" FontSize="12" Opacity="0.6"
IsVisible="{Binding !HasTimeBudgetInfo}"/>
<Border Background="{Binding TimeBudgetColorHex}" CornerRadius="10" Padding="9,3"
IsVisible="{Binding HasTimeBudgetInfo}"
ToolTip.Tip="Geplante Zeit im Vergleich zur laut Stundenraster (Einstellungen) verfügbaren Zeit — bei Doppelstunden werden beide Perioden zusammengezählt.">
<TextBlock Text="{Binding TimeBudgetLabel}" FontSize="12" FontWeight="SemiBold" Foreground="White"/>
</Border>
</StackPanel>
<Button Grid.Column="1" Content=" Phase" Command="{Binding AddPhaseCommand}"/>
</Grid>
@@ -63,6 +63,8 @@
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="8">
<Button Content=" Stunde" Command="{Binding AddLessonCommand}"/>
<Button Content="Serie erzeugen" Command="{Binding GenerateLessonSeriesCommand}"
ToolTip.Tip="Stunden für alle Termine aus dem Stundenplan im gewählten Zeitraum anlegen."/>
<Button Content="Anzeigen" Command="{Binding ShowLessonCommand}"
ToolTip.Tip="Verlaufsplan schreibgeschützt und größer anzeigen — zum Mitnehmen in den Unterricht."/>
<Button Content="Bearbeiten" Command="{Binding EditLessonCommand}"/>
@@ -1,6 +1,8 @@
using Avalonia.Controls;
using LehrerApp.Core.Interfaces;
using LehrerApp.Core.Models;
using LehrerApp.Core.Services;
using LehrerApp.Desktop.Services;
using LehrerApp.Desktop.ViewModels.Groups;
using LehrerApp.Desktop.Views.Shared;
using Microsoft.Extensions.DependencyInjection;
@@ -27,6 +29,7 @@ public partial class PlanningTabView : UserControl
vm.OnConfirmDeleteLesson = ShowDeleteLessonDialog;
vm.OnPickMoveTarget = ShowMoveLessonDialog;
vm.OnShowLesson = ShowLessonViewerDialog;
vm.OnGenerateLessonSeries = ShowGenerateLessonSeriesDialog;
}
}
@@ -80,6 +83,8 @@ public partial class PlanningTabView : UserControl
App.Services.GetRequiredService<ILessonRepository>(),
App.Services.GetRequiredService<IShorthandCodeRepository>(),
App.Services.GetRequiredService<IAlternativeLessonPathRepository>(),
App.Services.GetRequiredService<ITimetableSlotRepository>(),
App.Services.GetRequiredService<PeriodScheduleService>(),
unitId, groupId, materialSuggestions, shorthandHistorySuggestions, editingLesson);
var dialog = new LessonDialog { DataContext = dialogVm };
@@ -122,4 +127,24 @@ public partial class PlanningTabView : UserControl
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is not null) await dialog.ShowDialog(owner);
}
private async Task<LessonSeriesResult?> ShowGenerateLessonSeriesDialog(Unit unit)
{
var dialogVm = new GenerateLessonSeriesDialogViewModel(
App.Services.GetRequiredService<ITimetableSlotRepository>(),
App.Services.GetRequiredService<ILessonRepository>(),
App.Services.GetRequiredService<ISchoolHolidayRepository>(),
App.Services.GetRequiredService<PublicHolidayService>(),
App.Services.GetRequiredService<SchoolCalendarSettingsService>(),
unit.Id, unit.GroupId, unit.StartDate, unit.EndDate);
var dialog = new GenerateLessonSeriesDialog { DataContext = dialogVm };
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return null;
var ok = await dialog.ShowDialog<bool>(owner);
if (ok && dialogVm.Result is { } result)
App.Services.GetRequiredService<NotificationService>().ShowSuccess(result.Summary);
return ok ? dialogVm.Result : null;
}
}