Mitarbeits Wizzard und neue Statuslabels für Anwesenheit und Hausaufgaben

This commit is contained in:
2026-08-13 01:49:40 +02:00
parent febcb0855a
commit 741586846a
10 changed files with 1160 additions and 144 deletions
@@ -23,6 +23,7 @@ public partial class ParticipationTabView : UserControl
_vm = vm;
vm.OnAddSession = ShowAddSessionDialog;
vm.OnQuickInput = ShowQuickInputDialog;
vm.OnStatusQuickInput = ShowStatusQuickInputDialog;
vm.OnComputeGrade = ShowComputeGradeDialog;
vm.OnOpenWizard = ShowWizardDialog;
vm.Aspects.CollectionChanged += (_, _) => BuildColumns();
@@ -141,17 +142,34 @@ public partial class ParticipationTabView : UserControl
var btn = new Button
{
Content = "HA vergessen",
FontSize = 10,
Padding = new Avalonia.Thickness(5, 1),
Opacity = row.HomeworkMissing ? 1.0 : 0.25,
FontSize = 12,
Width = 30,
Height = 26,
Padding = new Avalonia.Thickness(3, 1),
Command = row.ToggleHomeworkCommand,
};
ToolTip.SetTip(btn, "Hausaufgaben vergessen (an/aus)");
void RefreshHomework()
{
btn.Content = row.HomeworkSymbol;
ToolTip.SetTip(btn, row.HomeworkTooltip + " klicken für nächsten Status");
if (row.Homework is null)
{
btn.ClearValue(Button.BackgroundProperty);
btn.ClearValue(Button.ForegroundProperty);
btn.Opacity = 0.38;
}
else
{
btn.Background = new Avalonia.Media.SolidColorBrush(Avalonia.Media.Color.Parse(HomeworkDisplay.Color(row.Homework)));
btn.Foreground = Avalonia.Media.Brushes.White;
btn.Opacity = 1;
}
}
RefreshHomework();
row.PropertyChanged += (_, pe) =>
{
if (pe.PropertyName == nameof(ParticipationStudentRow.HomeworkMissing))
btn.Opacity = row.HomeworkMissing ? 1.0 : 0.25;
if (pe.PropertyName == nameof(ParticipationStudentRow.HomeworkSymbol))
RefreshHomework();
};
return new StackPanel
{
@@ -170,19 +188,34 @@ public partial class ParticipationTabView : UserControl
var btn = new Button
{
Content = string.IsNullOrEmpty(row.AttendanceLabel) ? "anwesend" : row.AttendanceLabel,
FontSize = 10,
Padding = new Avalonia.Thickness(5, 1),
FontSize = 12,
Width = 30,
Height = 26,
Padding = new Avalonia.Thickness(3, 1),
Command = row.CycleAttendanceCommand,
};
ToolTip.SetTip(btn, row.AttendanceTooltip);
void RefreshAttendance()
{
btn.Content = string.IsNullOrEmpty(row.AttendanceLabel) ? "·" : row.AttendanceLabel;
ToolTip.SetTip(btn, row.AttendanceTooltip + " klicken für nächsten Status");
if (row.Attendance is null)
{
btn.ClearValue(Button.BackgroundProperty);
btn.ClearValue(Button.ForegroundProperty);
btn.Opacity = 0.38;
}
else
{
btn.Background = new Avalonia.Media.SolidColorBrush(Avalonia.Media.Color.Parse(AttendanceDisplay.Color(row.Attendance)));
btn.Foreground = Avalonia.Media.Brushes.White;
btn.Opacity = 1;
}
}
RefreshAttendance();
row.PropertyChanged += (_, pe) =>
{
if (pe.PropertyName == nameof(ParticipationStudentRow.AttendanceLabel))
{
btn.Content = string.IsNullOrEmpty(row.AttendanceLabel) ? "anwesend" : row.AttendanceLabel;
ToolTip.SetTip(btn, row.AttendanceTooltip);
}
RefreshAttendance();
};
return new StackPanel
{
@@ -220,6 +253,17 @@ public partial class ParticipationTabView : UserControl
await dialog.ShowDialog(owner);
}
private async Task ShowStatusQuickInputDialog(ParticipationTabViewModel tabVm)
{
if (tabVm.StudentRows.Count == 0 || tabVm.SelectedSession is null) return;
var quickVm = new AttendanceHomeworkQuickInputViewModel(
tabVm.StudentRows, tabVm.SelectedSessionDisplay);
var dialog = new AttendanceHomeworkQuickInputDialog { DataContext = quickVm };
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is not null)
await dialog.ShowDialog(owner);
}
private async Task ShowComputeGradeDialog(ParticipationTabViewModel tabVm)
{
var dialogVm = new ParticipationGradeDialogViewModel(