Kapitel 3.1: Mitarbeit-Aspekte pro Gruppe verwalten (3.1.1/3.1.2/3.1.4)
Neuer Button "Aspekte verwalten" im Mitarbeit-Tab öffnet ParticipationAspectsDialog: Anlegen, Bezeichnung/Typ/Gewichtung/Aktiv-Status bearbeiten (speichert sofort, gleiches Muster wie die bestehende Gewichtungs-Bearbeitung in 3.2.1), Hoch/Runter-Reihenfolge, Löschen mit Rückfrage. Verwaltet bewusst nur die gruppenspezifischen Aspekte, nicht den bislang nirgends befüllten globalen Standardkatalog. Schlüssel ist nur beim Neuanlegen editierbar - er verknüpft AspectRating mit dem Aspekt per Key, ein nachträgliches Umbenennen würde historische Bewertungen unauffindbar machen. IParticipationAspectRepository.Save validiert jetzt Pflichtfelder und Schlüssel-Eindeutigkeit gegen globale Standards UND eigene Gruppen-Aspekte zusammen, da beide im Bewertungsraster kombiniert verwendet werden. Neue GetAllByGroup-Methode (inkl. inaktiver) für die Verwaltungsansicht. 3.1.3 (Scale3/Binary/Points im Bewertungsraster selbst) bewusst nicht angefasst - eigener, größerer Eingriff in die Bewertungs-UI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
|
||||
x:Class="LehrerApp.Desktop.Views.Groups.ParticipationAspectsDialog"
|
||||
x:DataType="vm:ParticipationAspectsDialogViewModel"
|
||||
Title="Mitarbeit-Aspekte verwalten"
|
||||
Width="620" Height="620" MinWidth="520" MinHeight="380"
|
||||
CanResize="True" WindowStartupLocation="CenterOwner">
|
||||
|
||||
<Grid RowDefinitions="*,Auto" Margin="24">
|
||||
<ScrollViewer Grid.Row="0">
|
||||
<StackPanel Spacing="14" Margin="0,0,12,0">
|
||||
<TextBlock Text="Mitarbeit-Aspekte" Classes="dialogtitle"/>
|
||||
<TextBlock Text="Gilt nur für diese Gruppe, zusätzlich zu den globalen Standardaspekten (Qualität, Quantität, Arbeitsphase)."
|
||||
FontSize="12" Opacity="0.6" TextWrapping="Wrap"/>
|
||||
|
||||
<ItemsControl ItemsSource="{Binding Aspects}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate x:DataType="vm:AspectEditItem">
|
||||
<Border BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,0,1" Padding="0,8">
|
||||
<StackPanel Spacing="4">
|
||||
<Grid ColumnDefinitions="70,*,120,80,60,26,26,26">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Key}" FontSize="12" Opacity="0.6"
|
||||
VerticalAlignment="Center" Margin="0,0,8,0" TextTrimming="CharacterEllipsis"
|
||||
ToolTip.Tip="Schlüssel, nach dem Neuanlegen nicht mehr änderbar (Verknüpfung zu bereits erfassten Bewertungen)."/>
|
||||
<TextBox Grid.Column="1" Text="{Binding Label}" Margin="0,0,6,0"/>
|
||||
<ComboBox Grid.Column="2" ItemsSource="{Binding ValueTypeOptions}"
|
||||
SelectedItem="{Binding ValueTypeName}" Margin="0,0,6,0"/>
|
||||
<NumericUpDown Grid.Column="3" Value="{Binding Weight}" Minimum="0" Maximum="10"
|
||||
FormatString="0.0" Increment="0.1" ShowButtonSpinner="False" Margin="0,0,6,0"/>
|
||||
<CheckBox Grid.Column="4" Content="Aktiv" IsChecked="{Binding IsActive}"
|
||||
VerticalAlignment="Center" Margin="0,0,4,0"
|
||||
ToolTip.Tip="Deaktivieren statt löschen, damit bereits erfasste Bewertungen dieses Aspekts gültig bleiben."/>
|
||||
<Button Grid.Column="5" Content="↑" Command="{Binding MoveUpCommand}" Padding="4,2"
|
||||
ToolTip.Tip="Nach oben"/>
|
||||
<Button Grid.Column="6" Content="↓" Command="{Binding MoveDownCommand}" Padding="4,2"
|
||||
Margin="2,0,0,0" ToolTip.Tip="Nach unten"/>
|
||||
<Button Grid.Column="7" Content="✕" Command="{Binding DeleteCommand}" Padding="4,2"
|
||||
Margin="2,0,0,0" ToolTip.Tip="Endgültig löschen"/>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding ErrorMessage}" Foreground="Red" FontSize="11"
|
||||
IsVisible="{Binding ErrorMessage, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Text="Noch keine gruppenspezifischen Aspekte." Classes="emptyhint"
|
||||
IsVisible="{Binding !Aspects.Count}"/>
|
||||
|
||||
<Separator Margin="0,4"/>
|
||||
|
||||
<TextBlock Text="Neuer Aspekt" FontSize="14" FontWeight="SemiBold"/>
|
||||
<Grid ColumnDefinitions="*,12,*,12,160">
|
||||
<StackPanel Grid.Column="0" Spacing="4">
|
||||
<TextBlock Text="Schlüssel *" FontSize="12" Opacity="0.7"/>
|
||||
<TextBox Text="{Binding NewKey}" PlaceholderText="z.B. experiment"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Spacing="4">
|
||||
<TextBlock Text="Bezeichnung *" FontSize="12" Opacity="0.7"/>
|
||||
<TextBox Text="{Binding NewLabel}" PlaceholderText="z.B. Experiment"/>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="4" Spacing="4">
|
||||
<TextBlock Text="Typ" FontSize="12" Opacity="0.7"/>
|
||||
<ComboBox ItemsSource="{Binding ValueTypeOptions}" SelectedItem="{Binding NewValueTypeName}"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding NewAspectError}" Foreground="Red" FontSize="12"
|
||||
IsVisible="{Binding NewAspectError, Converter={x:Static StringConverters.IsNotNullOrEmpty}}"/>
|
||||
<Button Content="+ Aspekt hinzufügen" Command="{Binding AddAspectCommand}" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
|
||||
<Button Grid.Row="1" Content="Fertig" HorizontalAlignment="Right" Margin="0,20,0,0" Click="OnClose"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,35 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using LehrerApp.Desktop.ViewModels.Groups;
|
||||
using LehrerApp.Desktop.Views.Shared;
|
||||
|
||||
namespace LehrerApp.Desktop.Views.Groups;
|
||||
|
||||
public partial class ParticipationAspectsDialog : Window
|
||||
{
|
||||
public ParticipationAspectsDialog() => InitializeComponent();
|
||||
|
||||
protected override void OnDataContextChanged(EventArgs e)
|
||||
{
|
||||
base.OnDataContextChanged(e);
|
||||
if (DataContext is ParticipationAspectsDialogViewModel vm)
|
||||
vm.OnConfirmDelete = ConfirmDelete;
|
||||
}
|
||||
|
||||
private async Task<bool> ConfirmDelete(AspectEditItem item)
|
||||
{
|
||||
var info = new ConfirmDialogInfo
|
||||
{
|
||||
Title = "Aspekt endgültig löschen?",
|
||||
Message = $"„{item.Label}“ wird endgültig gelöscht. Falls er bereits in Bewertungen " +
|
||||
"verwendet wurde, bleiben diese Werte in der Historie erhalten, sind dort " +
|
||||
"aber keinem Aspekt mehr zuordenbar. Zum Erhalt der Zuordnung stattdessen " +
|
||||
"deaktivieren statt löschen.",
|
||||
ConfirmText = "Endgültig löschen",
|
||||
};
|
||||
var dialog = new ConfirmDialog { DataContext = info };
|
||||
return await dialog.ShowDialog<bool>(this);
|
||||
}
|
||||
|
||||
private void OnClose(object? s, RoutedEventArgs e) => Close();
|
||||
}
|
||||
@@ -10,7 +10,7 @@
|
||||
<Border Grid.Column="0"
|
||||
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
BorderThickness="0,0,1,0">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,*">
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,*">
|
||||
|
||||
<Button Grid.Row="0" Content="+ Sitzung" Command="{Binding AddSessionCommand}"
|
||||
HorizontalAlignment="Stretch" Margin="10,10,10,6" IsEnabled="{Binding !IsReadOnly}"/>
|
||||
@@ -27,7 +27,10 @@
|
||||
<Button Grid.Row="3" Content="Mitarbeits-Assistent" Command="{Binding OpenWizardCommand}"
|
||||
HorizontalAlignment="Stretch" Margin="10,0,10,6" IsEnabled="{Binding !IsReadOnly}"/>
|
||||
|
||||
<ListBox Grid.Row="4"
|
||||
<Button Grid.Row="4" Content="Aspekte verwalten" Command="{Binding ManageAspectsCommand}"
|
||||
HorizontalAlignment="Stretch" Margin="10,0,10,6" IsEnabled="{Binding !IsReadOnly}"/>
|
||||
|
||||
<ListBox Grid.Row="5"
|
||||
ItemsSource="{Binding Sessions}"
|
||||
SelectedItem="{Binding SelectedSession}"
|
||||
BorderThickness="0">
|
||||
|
||||
@@ -26,6 +26,7 @@ public partial class ParticipationTabView : UserControl
|
||||
vm.OnStatusQuickInput = ShowStatusQuickInputDialog;
|
||||
vm.OnComputeGrade = ShowComputeGradeDialog;
|
||||
vm.OnOpenWizard = ShowWizardDialog;
|
||||
vm.OnManageAspects = ShowManageAspectsDialog;
|
||||
vm.Aspects.CollectionChanged += (_, _) => BuildColumns();
|
||||
vm.PropertyChanged += (_, pe) =>
|
||||
{
|
||||
@@ -305,4 +306,15 @@ public partial class ParticipationTabView : UserControl
|
||||
if (owner is not null)
|
||||
await dialog.ShowDialog(owner);
|
||||
}
|
||||
|
||||
private async Task ShowManageAspectsDialog(ParticipationTabViewModel tabVm)
|
||||
{
|
||||
var dialogVm = new ParticipationAspectsDialogViewModel(
|
||||
App.Services.GetRequiredService<IParticipationAspectRepository>(), tabVm.GroupId);
|
||||
|
||||
var dialog = new ParticipationAspectsDialog { DataContext = dialogVm };
|
||||
var owner = TopLevel.GetTopLevel(this) as Window;
|
||||
if (owner is not null)
|
||||
await dialog.ShowDialog(owner);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user