feat: add seating plans for learning groups

This commit is contained in:
2026-08-17 01:01:40 +02:00
parent fbf70df439
commit fe36f51886
19 changed files with 771 additions and 6 deletions
@@ -0,0 +1,46 @@
using Avalonia.Controls;
using LehrerApp.Core.Models;
using LehrerApp.Desktop.ViewModels.Groups;
using LehrerApp.Desktop.Views.Shared;
namespace LehrerApp.Desktop.Views.Groups;
public partial class SeatingPlanTabView : UserControl
{
public SeatingPlanTabView() => InitializeComponent();
protected override void OnDataContextChanged(EventArgs e)
{
base.OnDataContextChanged(e);
if (DataContext is SeatingPlanTabViewModel vm)
{
vm.OnEditPlan = ShowPlanDialog;
vm.OnConfirmDelete = ShowDeleteConfirmDialog;
}
}
private async Task<SeatingPlan?> ShowPlanDialog(SeatingPlan? plan)
{
if (DataContext is not SeatingPlanTabViewModel vm) return null;
var dialogVm = vm.CreateDialogViewModel(plan);
var dialog = new SeatingPlanDialog { DataContext = dialogVm };
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null || !await dialog.ShowDialog<bool>(owner)) return null;
return dialogVm.Result;
}
private async Task<bool> ShowDeleteConfirmDialog(SeatingPlanSummary plan)
{
var dialog = new ConfirmDialog
{
DataContext = new ConfirmDialogInfo
{
Title = "Sitzplan löschen?",
Message = $"Der Sitzplan „{plan.Name}“ und seine Zuordnungen werden gelöscht.",
ConfirmText = "Löschen",
},
};
var owner = TopLevel.GetTopLevel(this) as Window;
return owner is not null && await dialog.ShowDialog<bool>(owner);
}
}