Files
LehrerApp/LehrerApp.Desktop/Views/Exams/ExamsOverviewView.axaml

229 lines
12 KiB
XML

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:LehrerApp.Desktop.ViewModels.Exams"
xmlns:vmg="clr-namespace:LehrerApp.Desktop.ViewModels.Groups"
xmlns:shared="clr-namespace:LehrerApp.Desktop.Views.Shared"
x:Class="LehrerApp.Desktop.Views.Exams.ExamsOverviewView"
x:DataType="vm:ExamsOverviewViewModel">
<!-- Statusfarben kommen wie im Klassenlehrer-Bereich aus Styles/SemanticBrushes.axaml (siehe
ClassTeacherOverviewView) — Basis ist hier aber "neutral" statt "ok", weil geplante bzw.
hängengebliebene Klausuren (ExamPriorityService.CorrectionStuck) hier den Normalfall
bilden, nicht ein positives Ergebnis. -->
<UserControl.Styles>
<Style Selector="Border.examStatusBar">
<Setter Property="Background" Value="{DynamicResource AppListRowBorderBrush}"/>
</Style>
<Style Selector="Border.examStatusBar.ok">
<Setter Property="Background" Value="{DynamicResource AppStatusOkBrush}"/>
</Style>
<Style Selector="Border.examStatusBar.info">
<Setter Property="Background" Value="{DynamicResource AppStatusInfoBrush}"/>
</Style>
<Style Selector="Border.examStatusBar.warning">
<Setter Property="Background" Value="{DynamicResource AppStatusWarningBrush}"/>
</Style>
<Style Selector="Border.examStatusBar.danger">
<Setter Property="Background" Value="{DynamicResource AppStatusDangerBrush}"/>
</Style>
<Style Selector="Border.examStatusPill">
<Setter Property="Background" Value="{DynamicResource AppChipBackgroundBrush}"/>
<Setter Property="CornerRadius" Value="4"/>
<Setter Property="Padding" Value="8,2"/>
</Style>
<Style Selector="Border.examStatusPill TextBlock">
<Setter Property="FontSize" Value="12"/>
</Style>
<Style Selector="Border.examStatusPill.ok">
<Setter Property="Background" Value="{DynamicResource AppStatusOkBrush}"/>
</Style>
<Style Selector="Border.examStatusPill.ok TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style>
<Style Selector="Border.examStatusPill.info">
<Setter Property="Background" Value="{DynamicResource AppStatusInfoBrush}"/>
</Style>
<Style Selector="Border.examStatusPill.info TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style>
<Style Selector="Border.examStatusPill.warning">
<Setter Property="Background" Value="{DynamicResource AppStatusWarningBrush}"/>
</Style>
<Style Selector="Border.examStatusPill.warning TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style>
<Style Selector="Border.examStatusPill.danger">
<Setter Property="Background" Value="{DynamicResource AppStatusDangerBrush}"/>
</Style>
<Style Selector="Border.examStatusPill.danger TextBlock">
<Setter Property="Foreground" Value="White"/>
</Style>
<Style Selector="Button.examRow">
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Background" Value="{DynamicResource AppListRowBackgroundBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource AppListRowBorderBrush}"/>
<Setter Property="BorderThickness" Value="1,0,1,1"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="CornerRadius" Value="0"/>
</Style>
<Style Selector="Button.examRow:pointerover /template/ ContentPresenter">
<Setter Property="Background" Value="{DynamicResource AppListRowHoverBrush}"/>
</Style>
<Style Selector="Button.siblingPill">
<Setter Property="Padding" Value="10,4"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="CornerRadius" Value="12"/>
</Style>
</UserControl.Styles>
<Grid RowDefinitions="Auto,Auto,*">
<Border Grid.Row="0" Padding="20,16"
BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
BorderThickness="0,0,0,1">
<Grid ColumnDefinitions="*,Auto">
<shared:PageHeader Grid.Column="0" Title="Klausuren"
Subtitle="Alle Klausuren des Schuljahres, nach Dringlichkeit sortiert"/>
<Button Grid.Column="1" Content="↻ Aktualisieren" Command="{Binding LoadCommand}"
VerticalAlignment="Center"/>
</Grid>
</Border>
<!-- Detailbereich zur ausgewählten Klausur ─────────────────────────────────── -->
<Border Grid.Row="1" Margin="20,16,20,10" Padding="18"
Background="{DynamicResource AppCardBackgroundBrush}"
BorderBrush="{DynamicResource AppCardBorderBrush}" BorderThickness="1" CornerRadius="10"
IsVisible="{Binding HasSelection}">
<StackPanel Spacing="12">
<Grid ColumnDefinitions="*,Auto">
<StackPanel Grid.Column="0" Spacing="2">
<TextBlock Text="{Binding SelectedRow.Title}" FontSize="16" FontWeight="SemiBold"/>
<TextBlock FontSize="13" Opacity="0.6">
<Run Text="{Binding SelectedRow.GroupLabel}"/>
<Run Text=" · "/>
<Run Text="{Binding SelectedRow.SubLabel}"/>
</TextBlock>
</StackPanel>
<Border Grid.Column="1" Classes="examStatusPill" VerticalAlignment="Top"
Classes.ok="{Binding SelectedRow.IsOk}" Classes.info="{Binding SelectedRow.IsInfo}"
Classes.warning="{Binding SelectedRow.IsWarning}" Classes.danger="{Binding SelectedRow.IsDanger}">
<TextBlock Text="{Binding SelectedRow.StatusLabel}"/>
</Border>
</Grid>
<!-- Parallelkurs-Umschalter -->
<ItemsControl ItemsSource="{Binding Siblings}" IsVisible="{Binding SelectedRow.HasSibling}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" Spacing="8"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:ExamListRowViewModel">
<Button Classes="siblingPill"
Command="{Binding $parent[ItemsControl].((vm:ExamsOverviewViewModel)DataContext).SelectExamCommand}"
CommandParameter="{Binding}">
<TextBlock>
<Run Text="{Binding GroupLabel}"/>
<Run Text=" · "/>
<Run Text="{Binding Evaluated}"/>
<Run Text="/"/>
<Run Text="{Binding Expected}"/>
</TextBlock>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- Korrekturfortschritt -->
<StackPanel Spacing="6" IsVisible="{Binding ShowCorrectionProgress}">
<TextBlock Text="{Binding ProgressLabel}" FontSize="13"/>
<Border Width="240" Height="6" CornerRadius="3" HorizontalAlignment="Left"
Background="{DynamicResource AppTrackBackgroundBrush}">
<Border Width="{Binding ProgressBarWidth}" Height="6" CornerRadius="3"
HorizontalAlignment="Left" Background="{DynamicResource AppStatusWarningBrush}"/>
</Border>
</StackPanel>
<!-- Notenspiegel -->
<StackPanel Spacing="6" IsVisible="{Binding ShowGradeSummary}">
<TextBlock Text="{Binding AverageLabel}" FontSize="14" FontWeight="SemiBold"/>
<ItemsControl ItemsSource="{Binding DetailGradeDistribution}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vmg:GradeBarItem">
<Grid ColumnDefinitions="30,*,60" Margin="0,1">
<TextBlock Grid.Column="0" Text="{Binding Grade}" FontSize="12" VerticalAlignment="Center"/>
<Border Grid.Column="1" Height="14" Width="{Binding BarWidth}" HorizontalAlignment="Left"
Background="{DynamicResource AppAccentTextBrush}" CornerRadius="3"/>
<TextBlock Grid.Column="2" Text="{Binding CountDisplay}" FontSize="11" Opacity="0.6"
VerticalAlignment="Center"/>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
<!-- Genehmigung / Ankündigung -->
<StackPanel Orientation="Horizontal" Spacing="10">
<Button Content="{Binding ApprovalLabel}" Command="{Binding ToggleApprovalCommand}" FontSize="12"/>
<Button Content="{Binding AnnouncementLabel}" Command="{Binding ToggleAnnouncementCommand}" FontSize="12"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<Button Content="Punkte eingeben" Command="{Binding GradeSelectedCommand}"
IsVisible="{Binding ShowCorrectionProgress}"/>
<Button Content="Auswertung" Command="{Binding EvaluateSelectedCommand}"
IsVisible="{Binding ShowGradeSummary}"/>
<Button Content="Zum Kurs →" Command="{Binding GoToGroupCommand}" HorizontalAlignment="Right"/>
</StackPanel>
</StackPanel>
</Border>
<!-- Liste aller Klausuren, nach Priorität sortiert (nicht nach Datum) ─────────── -->
<ScrollViewer Grid.Row="2" Margin="20,0,20,16">
<StackPanel>
<StackPanel Margin="0,28,0,0" Spacing="10" HorizontalAlignment="Center"
IsVisible="{Binding HasNoExams}">
<TextBlock Text="Noch keine Klausuren im aktuellen Schuljahr." Classes="emptyhint"
FontSize="15" TextAlignment="Center"/>
<TextBlock Text="Klausuren werden im jeweiligen Kurs angelegt." FontSize="12" Opacity="0.55"/>
<Button Content="Zu den Lerngruppen" Command="{Binding GoToGroupsCommand}"
HorizontalAlignment="Center"/>
</StackPanel>
<ItemsControl ItemsSource="{Binding Rows}">
<ItemsControl.ItemTemplate>
<DataTemplate x:DataType="vm:ExamListRowViewModel">
<Button Classes="examRow"
Command="{Binding $parent[ItemsControl].((vm:ExamsOverviewViewModel)DataContext).SelectExamCommand}"
CommandParameter="{Binding}">
<Grid ColumnDefinitions="4,*,Auto,Auto" MinHeight="52">
<Border Grid.Column="0" Classes="examStatusBar" Classes.ok="{Binding IsOk}"
Classes.info="{Binding IsInfo}" Classes.warning="{Binding IsWarning}"
Classes.danger="{Binding IsDanger}"/>
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="12,6" Spacing="2">
<StackPanel Orientation="Horizontal" Spacing="6">
<TextBlock Text="{Binding Title}" FontSize="14" FontWeight="Medium"/>
<TextBlock Text="🔗" FontSize="11" Opacity="0.5" IsVisible="{Binding HasSibling}"
ToolTip.Tip="Parallelkurs vorhanden"/>
</StackPanel>
<TextBlock FontSize="12" Opacity="0.6">
<Run Text="{Binding GroupLabel}"/>
<Run Text=" · "/>
<Run Text="{Binding SubLabel}"/>
</TextBlock>
</StackPanel>
<Border Grid.Column="3" Classes="examStatusPill" VerticalAlignment="Center" Margin="0,0,12,0"
Classes.ok="{Binding IsOk}" Classes.info="{Binding IsInfo}"
Classes.warning="{Binding IsWarning}" Classes.danger="{Binding IsDanger}">
<TextBlock Text="{Binding StatusLabel}"/>
</Border>
</Grid>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
</Grid>
</UserControl>