Planung: Stunde einer anderen Einheit zuweisen ("Einheit wechseln")

Bisher war die Einheit einer Stunde nach dem Anlegen fix - bei falscher
Auswahl im Erstellen-Dialog blieb nur Löschen+Neuanlegen. Neuer Button
öffnet einen Dialog zur Auswahl der Ziel-Einheit; die Ansicht springt
danach automatisch dorthin mit der Stunde vorausgewählt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-02 20:07:53 +02:00
co-authored by Claude Sonnet 5
parent 0a419c4c11
commit 988a293c42
6 changed files with 161 additions and 0 deletions
@@ -38,6 +38,7 @@ public partial class PlanningTabView : UserControl
ShowLessonDialog(lesson.UnitId, lesson.GroupId, materials, shorthands, editingLesson: lesson);
vm.OnConfirmDeleteLesson = ShowDeleteLessonDialog;
vm.OnPickMoveTarget = ShowMoveLessonDialog;
vm.OnPickUnitChange = ShowChangeLessonUnitDialog;
vm.OnShowLesson = ShowLessonViewerDialog;
vm.OnGenerateLessonSeries = ShowGenerateLessonSeriesDialog;
vm.OnAiAssist = ShowAiAssistDialog;
@@ -136,6 +137,20 @@ public partial class PlanningTabView : UserControl
return ok ? dialogVm.Result : null;
}
private async Task<Unit?> ShowChangeLessonUnitDialog(Lesson lesson)
{
var dialogVm = new ChangeLessonUnitDialogViewModel(
App.Services.GetRequiredService<IUnitRepository>(),
lesson.GroupId, lesson.UnitId,
(DataContext as PlanningTabViewModel)?.SelectedUnit?.Title ?? "");
var dialog = new ChangeLessonUnitDialog { DataContext = dialogVm };
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return null;
var ok = await dialog.ShowDialog<bool>(owner);
return ok ? dialogVm.Result : null;
}
private async Task ShowLessonViewerDialog(Lesson lesson)
{
var viewerVm = new LessonViewerViewModel(lesson,