Edit Stammdaten Mitarbeitsessions

This commit is contained in:
2026-08-19 12:47:09 +02:00
parent b2c1b15167
commit 9106b4b0e1
6 changed files with 131 additions and 8 deletions
@@ -3,13 +3,13 @@
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
x:Class="LehrerApp.Desktop.Views.Groups.AddSessionDialog"
x:DataType="vm:AddSessionDialogViewModel"
Title="Bewertungszeitpunkt anlegen"
Title="{Binding DialogTitle}"
Width="380" SizeToContent="Height"
CanResize="False" WindowStartupLocation="CenterOwner">
<Grid RowDefinitions="*,Auto" Margin="24">
<StackPanel Grid.Row="0" Spacing="14">
<TextBlock Text="Neuer Bewertungszeitpunkt" Classes="dialogtitle"/>
<TextBlock Text="{Binding DialogTitle}" Classes="dialogtitle"/>
<StackPanel Spacing="4">
<TextBlock Text="Datum *" FontSize="12" Opacity="0.7"/>
@@ -20,13 +20,14 @@
<StackPanel Spacing="4">
<TextBlock Text="Kommentar (optional)" FontSize="12" Opacity="0.7"/>
<TextBox Text="{Binding Comment}" PlaceholderText="z. B. Stunde 12 Säure-Base-Reaktion"/>
<TextBox Text="{Binding Comment}" PlaceholderText="z. B. Stunde 12 Säure-Base-Reaktion"
x:Name="CommentBox"/>
</StackPanel>
</StackPanel>
<Grid Grid.Row="1" ColumnDefinitions="*,8,*" Margin="0,20,0,0">
<Button Grid.Column="0" Content="Abbrechen" HorizontalAlignment="Stretch" Click="OnCancel"/>
<Button Grid.Column="2" Content="Anlegen" HorizontalAlignment="Stretch" Click="OnSave"/>
<Button Grid.Column="2" Content="{Binding SaveButtonText}" HorizontalAlignment="Stretch" Click="OnSave"/>
</Grid>
</Grid>
</Window>
@@ -11,7 +11,16 @@ public partial class AddSessionDialog : Window
protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
this.FindControl<TextBox>("DateBox")?.Focus();
if (DataContext is AddSessionDialogViewModel { IsEditing: true })
{
var commentBox = this.FindControl<TextBox>("CommentBox");
commentBox?.Focus();
commentBox?.SelectAll();
}
else
{
this.FindControl<TextBox>("DateBox")?.Focus();
}
}
private void OnSave(object? s, RoutedEventArgs e)
@@ -53,13 +53,16 @@
Text="{Binding SelectedSessionDisplay}"
FontSize="13" FontWeight="SemiBold"
VerticalAlignment="Center"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6"
IsVisible="{Binding HasCompetencyCatalog}">
<StackPanel Grid.Column="1" Orientation="Horizontal" Spacing="6">
<Button Content="✎ Sitzung bearbeiten" Command="{Binding EditSessionCommand}"
IsVisible="{Binding !IsReadOnly}" FontSize="11" Padding="8,3"/>
<ToggleButton Content="◇ Kompetenzen"
IsChecked="{Binding CompetencyTagsVisible}"
IsVisible="{Binding HasCompetencyCatalog}"
FontSize="11" Padding="8,3"/>
<ToggleButton Content="◈ Schüler-Bewertungen"
IsChecked="{Binding StudentCompetencyRatingsVisible}"
IsVisible="{Binding HasCompetencyCatalog}"
FontSize="11" Padding="8,3"/>
</StackPanel>
</Grid>
@@ -23,6 +23,7 @@ public partial class ParticipationTabView : UserControl
{
_vm = vm;
vm.OnAddSession = ShowAddSessionDialog;
vm.OnEditSession = ShowEditSessionDialog;
vm.OnQuickInput = ShowQuickInputDialog;
vm.OnStatusQuickInput = ShowStatusQuickInputDialog;
vm.OnComputeGrade = ShowComputeGradeDialog;
@@ -283,6 +284,17 @@ public partial class ParticipationTabView : UserControl
return ok ? vm.Result : null;
}
private async Task<LehrerApp.Core.Models.ParticipationSession?> ShowEditSessionDialog(
LehrerApp.Core.Models.ParticipationSession session)
{
var vm = new AddSessionDialogViewModel(session);
var dialog = new AddSessionDialog { DataContext = vm };
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return null;
var ok = await dialog.ShowDialog<bool>(owner);
return ok ? vm.Result : null;
}
private async Task ShowQuickInputDialog(ParticipationTabViewModel tabVm)
{
if (tabVm.StudentRows.Count == 0) return;