Notenverwaltung (Kapitel 2) und Mitarbeits-Assistent
Notenübersicht der Gruppe (Matrix, Gesamt-Spalte, Sortierung, Halbjahresfilter), Einzelnoten-Pflege samt Sammelerfassung, Gewichtungsschema mit Voreinstellung je Gruppentyp, Zeugnisnoten-Berechnung mit Übersteuern/Festschreiben/Export und Notenentwicklung im Schülerdetail. Dazu Anwesenheits-/Hausaufgaben-Tracking je Mitarbeit-Sitzung, ein neuer Mitarbeits-Assistent (Zeitleiste mit Abschnitten, automatischer Notenvorschlag, Zusammenzug zur Halbjahresnote) und eine Dashboard-Kachel für offene Entschuldigungen. Außerdem: verbliebene englische Begriffe in Auswahlfeldern und Buttons auf Deutsch umgestellt.
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data;
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Services;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
|
||||
public partial class GradeOverviewTabView : UserControl
|
||||
{
|
||||
private GradeOverviewTabViewModel? _vm;
|
||||
|
||||
public GradeOverviewTabView() => InitializeComponent();
|
||||
|
||||
protected override void OnDataContextChanged(EventArgs e)
|
||||
{
|
||||
base.OnDataContextChanged(e);
|
||||
|
||||
if (DataContext is GradeOverviewTabViewModel vm)
|
||||
{
|
||||
_vm = vm;
|
||||
vm.OnManageStudentGrades = ShowStudentGradesDialog;
|
||||
vm.OnCollectiveGrade = ShowCollectiveGradeDialog;
|
||||
vm.OnReportGrades = ShowReportGradesDialog;
|
||||
vm.PropertyChanged += (_, pe) =>
|
||||
{
|
||||
if (pe.PropertyName == nameof(GradeOverviewTabViewModel.RebuildColumnsSignal))
|
||||
BuildColumns();
|
||||
};
|
||||
BuildColumns();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ShowStudentGradesDialog(GradeOverviewRow row)
|
||||
{
|
||||
var dialogVm = new StudentGradesDialogViewModel(
|
||||
App.Services.GetRequiredService<IGradeRepository>(),
|
||||
row.StudentId, _vm!.GroupId, row.Name);
|
||||
|
||||
var dialog = new StudentGradesDialog { DataContext = dialogVm };
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
if (owner is not null) await dialog.ShowDialog(owner);
|
||||
}
|
||||
|
||||
private async Task ShowCollectiveGradeDialog()
|
||||
{
|
||||
var dialogVm = new CollectiveGradeDialogViewModel(
|
||||
App.Services.GetRequiredService<IGradeRepository>(),
|
||||
App.Services.GetRequiredService<IStudentRepository>(),
|
||||
_vm!.GroupId);
|
||||
|
||||
var dialog = new CollectiveGradeDialog { DataContext = dialogVm };
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
if (owner is not null) await dialog.ShowDialog(owner);
|
||||
}
|
||||
|
||||
private async Task ShowReportGradesDialog()
|
||||
{
|
||||
var dialogVm = new ReportGradeDialogViewModel(
|
||||
App.Services.GetRequiredService<IGradeRepository>(),
|
||||
App.Services.GetRequiredService<IExamRepository>(),
|
||||
App.Services.GetRequiredService<IExamResultRepository>(),
|
||||
App.Services.GetRequiredService<IStudentRepository>(),
|
||||
App.Services.GetRequiredService<IGroupMembershipRepository>(),
|
||||
App.Services.GetRequiredService<IGradingSchemeRepository>(),
|
||||
App.Services.GetRequiredService<IReportGradeRepository>(),
|
||||
App.Services.GetRequiredService<GradingService>(),
|
||||
_vm!.GroupId, _vm.GroupType, _vm.GradingSystem, _vm.GroupLabel);
|
||||
|
||||
var dialog = new ReportGradeDialog { DataContext = dialogVm };
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
if (owner is not null) await dialog.ShowDialog(owner);
|
||||
}
|
||||
|
||||
private void BuildColumns()
|
||||
{
|
||||
var grid = this.FindControl<DataGrid>("GradesGrid");
|
||||
if (grid is null || _vm is null) return;
|
||||
|
||||
grid.Columns.Clear();
|
||||
grid.Columns.Add(new DataGridTextColumn
|
||||
{
|
||||
Header = "Schüler",
|
||||
Binding = new Binding("Name"),
|
||||
Width = new DataGridLength(160, DataGridLengthUnitType.Pixel),
|
||||
});
|
||||
|
||||
foreach (var (col, i) in _vm.Columns.Select((c, i) => (c, i)))
|
||||
{
|
||||
var idx = i;
|
||||
grid.Columns.Add(new DataGridTextColumn
|
||||
{
|
||||
Header = col.Header,
|
||||
Binding = new Binding($"Cells[{idx}]"),
|
||||
Width = new DataGridLength(120, DataGridLengthUnitType.Pixel),
|
||||
});
|
||||
}
|
||||
|
||||
grid.Columns.Add(new DataGridTextColumn
|
||||
{
|
||||
Header = "Gesamt",
|
||||
Binding = new Binding("TotalDisplay"),
|
||||
Width = new DataGridLength(80, DataGridLengthUnitType.Pixel),
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user