Vernetzung Stundenplan ↔ Unterrichtsplanung: Terminvorschlag, Lesson-Viewer-Sprung, Verzweigung (4.5.1–4.5.3)

4.5.1: Terminvorschlag für neue Stunden schlägt jetzt auch die Stundennummer
vor (bei Doppelstunden die erste Periode), nicht nur den Wochentag —
zieht über den bestehenden LessonNumber-Changed-Hook automatisch auch den
Stundenbeginn nach.

4.5.2 (teilweise): Klick auf eine Stunde im Stundenplan ("Heute"-Liste und
read-only Wochenraster) springt bei bereits vorhandener Lesson direkt in
den Verlaufsplan-Viewer statt nur grob zum Planung-Tab. Das Anlegen einer
neuen Lesson direkt aus dem Stundenplan bleibt bewusst offen (ungeklärte
Unit-Zuordnung, siehe TODO.md).

4.5.3: Der Lesson-Viewer hat jetzt Buttons "Zur Mitarbeit"/"Zu den Noten"
zum Weiterverzweigen in die Lerngruppe.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-19 23:39:27 +02:00
co-authored by Claude Sonnet 5
parent 52a1d45539
commit 391628ae36
10 changed files with 280 additions and 31 deletions
@@ -85,6 +85,13 @@
</StackPanel>
</ScrollViewer>
<Button Grid.Row="2" Content="Schließen" HorizontalAlignment="Right" Margin="0,16,0,0" Click="OnClose"/>
<Grid Grid.Row="2" ColumnDefinitions="*,Auto" Margin="0,16,0,0">
<StackPanel Grid.Column="0" Orientation="Horizontal" Spacing="8">
<Button Content="Zur Mitarbeit" Command="{Binding NavigateToParticipationCommand}"
ToolTip.Tip="Springt zum Tab 'Mitarbeit' der Lerngruppe — dort auch Anwesenheit/Hausaufgaben."/>
<Button Content="Zu den Noten" Command="{Binding NavigateToGradesCommand}"/>
</StackPanel>
<Button Grid.Column="1" Content="Schließen" Click="OnClose"/>
</Grid>
</Grid>
</Window>
@@ -1,5 +1,8 @@
using Avalonia.Controls;
using Avalonia.Interactivity;
using LehrerApp.Desktop.ViewModels;
using LehrerApp.Desktop.ViewModels.Groups;
using Microsoft.Extensions.DependencyInjection;
namespace LehrerApp.Desktop.Views.Groups;
@@ -7,5 +10,16 @@ public partial class LessonViewerDialog : Window
{
public LessonViewerDialog() => InitializeComponent();
protected override void OnDataContextChanged(EventArgs e)
{
base.OnDataContextChanged(e);
if (DataContext is LessonViewerViewModel vm)
vm.OnNavigateToTab = tabIndex =>
{
Close();
App.Services.GetRequiredService<MainWindowViewModel>().NavigateToGroupDetail(vm.GroupId, tabIndex);
};
}
private void OnClose(object? s, RoutedEventArgs e) => Close();
}
@@ -100,10 +100,10 @@
Foreground="#8E6C00" FontWeight="SemiBold"
IsVisible="{Binding HasUnhandledHomework}"/>
</StackPanel>
<Button Grid.Column="3" Content="Zur Lerngruppe" FontSize="11" Padding="9,4"
<Button Grid.Column="3" Content="{Binding OpenButtonLabel}" FontSize="11" Padding="9,4"
VerticalAlignment="Center" IsVisible="{Binding HasGroupId}"
Command="{Binding $parent[ItemsControl].((vm:TimetableViewModel)DataContext).OpenGroupCommand}"
CommandParameter="{Binding GroupId}"/>
Command="{Binding $parent[ItemsControl].((vm:TimetableViewModel)DataContext).OpenTodayLessonCommand}"
CommandParameter="{Binding}"/>
</Grid>
</Border>
</DataTemplate>
@@ -177,8 +177,8 @@
<Button Background="{Binding ColorHex}" IsVisible="{Binding IsAssigned}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
HorizontalContentAlignment="Stretch" CornerRadius="6" Padding="6"
Command="{Binding $parent[ItemsControl;1].((vm:TimetableViewModel)DataContext).OpenGroupCommand}"
CommandParameter="{Binding GroupId}">
Command="{Binding $parent[ItemsControl;1].((vm:TimetableViewModel)DataContext).OpenWeekCellCommand}"
CommandParameter="{Binding}">
<StackPanel Spacing="1">
<TextBlock FontSize="11" FontWeight="Bold" Foreground="White" TextWrapping="Wrap">
<Run Text="{Binding SubjectLabel}"/><Run Text=" · "/><Run Text="{Binding GroupName}"/>
@@ -1,7 +1,10 @@
using Avalonia.Controls;
using LehrerApp.Core.Interfaces;
using LehrerApp.Core.Models;
using LehrerApp.Core.Services;
using LehrerApp.Desktop.ViewModels.Planning;
using LehrerApp.Desktop.ViewModels.Groups;
using LehrerApp.Desktop.Views.Groups;
using Microsoft.Extensions.DependencyInjection;
namespace LehrerApp.Desktop.Views.Planning;
@@ -17,9 +20,21 @@ public partial class TimetableView : UserControl
{
vm.OnEditSlot = ShowSlotDialog;
vm.OnAddSubstitution = ShowSubstitutionDialog;
vm.OnOpenLessonViewer = ShowLessonViewerDialog;
}
}
private async Task ShowLessonViewerDialog(Lesson lesson)
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return;
var viewerVm = new LessonViewerViewModel(lesson,
App.Services.GetRequiredService<IAlternativeLessonPathRepository>());
var dialog = new LessonViewerDialog { DataContext = viewerVm };
await dialog.ShowDialog(owner);
}
private async Task ShowSlotDialog(TimetableCellItem cell)
{
var owner = TopLevel.GetTopLevel(this) as Window;