feat: add planning JSON exchange

This commit is contained in:
2026-08-17 02:04:29 +02:00
parent 50f3b2d6a9
commit 8efeb68e93
8 changed files with 797 additions and 2 deletions
@@ -49,6 +49,10 @@ public partial class PlanningTabViewModel : ObservableObject
// Gruppenwechsel/Laden kurzzeitig null — ein verschachtelter Pfad würde dafür jedes Mal
// einen Binding-Fehler loggen (siehe GroupDetailViewModel.IsDifferentiated für dasselbe Muster).
public string SelectedUnitTitleSuffix => SelectedUnit is null ? "" : $" {SelectedUnit.Title}";
public bool HasUnitSelection => SelectedUnit is not null;
public bool HasLessonSelection => SelectedLesson is not null;
public bool CanImportUnitPlanning => !IsReadOnly;
public bool CanImportLessonPlanning => !IsReadOnly && SelectedUnit is not null;
public ObservableCollection<UnitSummary> Units { get; } = [];
public ObservableCollection<LessonSummary> Lessons { get; } = [];
@@ -123,6 +127,8 @@ public partial class PlanningTabViewModel : ObservableObject
{
LoadLessons();
OnPropertyChanged(nameof(SelectedUnitTitleSuffix));
OnPropertyChanged(nameof(HasUnitSelection));
OnPropertyChanged(nameof(CanImportLessonPlanning));
EditUnitCommand.NotifyCanExecuteChanged();
DeleteUnitCommand.NotifyCanExecuteChanged();
CopyUnitCommand.NotifyCanExecuteChanged();
@@ -143,6 +149,7 @@ public partial class PlanningTabViewModel : ObservableObject
partial void OnSelectedLessonChanged(LessonSummary? value)
{
OnPropertyChanged(nameof(HasLessonSelection));
ShowLessonCommand.NotifyCanExecuteChanged();
EditLessonCommand.NotifyCanExecuteChanged();
DeleteLessonCommand.NotifyCanExecuteChanged();
@@ -150,6 +157,23 @@ public partial class PlanningTabViewModel : ObservableObject
AdvanceLessonStatusCommand.NotifyCanExecuteChanged();
}
partial void OnIsReadOnlyChanged(bool value)
{
OnPropertyChanged(nameof(CanImportUnitPlanning));
OnPropertyChanged(nameof(CanImportLessonPlanning));
}
public void RefreshPlanning(Guid? selectUnitId = null, Guid? selectLessonId = null)
{
selectUnitId ??= SelectedUnit?.Id;
selectLessonId ??= SelectedLesson?.Id;
LoadUnits();
if (selectUnitId is Guid unitId)
SelectedUnit = Units.FirstOrDefault(u => u.Id == unitId) ?? SelectedUnit;
if (selectLessonId is Guid lessonId)
SelectedLesson = Lessons.FirstOrDefault(l => l.Id == lessonId);
}
private bool HasSelectedUnit() => SelectedUnit is not null;
private bool HasSelectedLesson() => SelectedLesson is not null;
private bool CanAiAssist() => SelectedUnit is not null && _aiSettings.Enabled;