Dashboard und Schnellnavigation fix
This commit is contained in:
@@ -170,6 +170,7 @@ public class App : Application
|
||||
};
|
||||
search.OnQuickAddTask = startAsReminder => ShowQuickTaskDialog(startAsReminder, dash);
|
||||
search.OnQuickAddStudent = ShowAddStudentDialog;
|
||||
search.OnQuickAddGroupDocumentation = () => ShowQuickGroupDocumentationDialog(dash);
|
||||
|
||||
// StudentList → StudentDetail + Anlegen
|
||||
var sl = Services.GetRequiredService<StudentListViewModel>();
|
||||
@@ -203,4 +204,26 @@ public class App : Application
|
||||
dashboard.RefreshCommand.Execute(null);
|
||||
Services.GetRequiredService<WorkTaskListViewModel>().Load();
|
||||
}
|
||||
|
||||
private static async Task ShowQuickGroupDocumentationDialog(DashboardViewModel dashboard)
|
||||
{
|
||||
if (Application.Current?.ApplicationLifetime is not IClassicDesktopStyleApplicationLifetime
|
||||
{ MainWindow: { } owner }) return;
|
||||
|
||||
var subjects = Services.GetRequiredService<ISubjectRepository>().GetAll()
|
||||
.ToDictionary(s => s.Id);
|
||||
var options = Services.GetRequiredService<IGroupRepository>().GetAll()
|
||||
.Where(g => g.IsActive)
|
||||
.OrderBy(g => g.Name)
|
||||
.Select(g => new GroupDocumentationOption(g.Id,
|
||||
g.SubjectId is { } subjectId && subjects.TryGetValue(subjectId, out var subject)
|
||||
? $"{g.Name} · {(string.IsNullOrWhiteSpace(subject.ShortName) ? subject.Name : subject.ShortName)}"
|
||||
: g.Name));
|
||||
var vm = new GroupDocumentationQuickViewModel(options);
|
||||
var dialog = new Views.Students.GroupDocumentationQuickDialog { DataContext = vm };
|
||||
if (!await dialog.ShowDialog<bool>(owner) || vm.Result is null) return;
|
||||
|
||||
Services.GetRequiredService<IDocumentationRepository>().Save(vm.Result);
|
||||
dashboard.RefreshCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user