feat: unbenutzte Sitzplätze ausblenden können
Manche Räume sind unregelmäßig bestückt (z.B. eine Klasse mit 3 Reihen, in zwei davon fehlt ein Einzeltisch) - das feste Rows x Columns-Raster kennt aber keine per-Reihe abweichende Spaltenzahl. Neues Feld SeatingPlan.HiddenSeats für Plätze ohne physischen Tisch. Ein ausgeblendeter Platz bleibt Teil des Rasters (für die Spalten-/Reihenausrichtung von SeatingPlanPanel), wird im Ansichtsmodus aber nicht gerendert; im Bearbeitungsmodus bleibt er sichtbar (abgeblendet) mit einem Umschalt-Button direkt auf dem Platz. Nur leere Plätze lassen sich ausblenden; Zuweisen/ Verschieben eines Schülers auf einen ausgeblendeten Platz wird sowohl im ViewModel als auch im Drag&Drop-Ziel-Check verhindert. SeatingPlanRepository.Save filtert HiddenSeats zusätzlich auf das gültige Raster und blendet einen Platz automatisch wieder ein, falls er trotzdem belegt wird. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,11 @@
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SystemAccentColor}"/>
|
||||
<Setter Property="BorderThickness" Value="2"/>
|
||||
</Style>
|
||||
<Style Selector="Border.seat.hidden">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundBaseLowBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
</Style>
|
||||
</UserControl.Styles>
|
||||
<Grid ColumnDefinitions="260,*">
|
||||
<Border Grid.Column="0" BorderBrush="{DynamicResource SystemControlForegroundBaseLowBrush}"
|
||||
@@ -108,6 +113,8 @@
|
||||
<DataTemplate x:DataType="vm:SeatCellViewModel">
|
||||
<Border Classes="seat" Classes.occupied="{Binding IsOccupied}"
|
||||
Classes.droptarget="{Binding IsDropTarget}"
|
||||
Classes.hidden="{Binding IsHidden}"
|
||||
IsVisible="{Binding ShowSeat}"
|
||||
Width="190" MinHeight="76" Margin="5" Padding="10"
|
||||
CornerRadius="7"
|
||||
DragDrop.AllowDrop="True"
|
||||
@@ -118,7 +125,7 @@
|
||||
PointerPressed="OnDragSourcePressed"
|
||||
PointerMoved="OnDragSourceMoved"
|
||||
PointerReleased="OnDragSourceReleased"
|
||||
Tapped="OnSeatTapped" Opacity="{Binding LessonOpacity}">
|
||||
Tapped="OnSeatTapped" Opacity="{Binding DisplayOpacity}">
|
||||
<StackPanel Spacing="5">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBlock Text="{Binding PositionLabel}" FontSize="10" Opacity="0.5"/>
|
||||
@@ -126,6 +133,9 @@
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding StudentName}" FontWeight="SemiBold" FontSize="13"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Button Content="{Binding HiddenToggleLabel}"
|
||||
Command="{Binding ToggleHiddenCommand}" FontSize="9" Padding="6,2"
|
||||
HorizontalAlignment="Center" IsVisible="{Binding CanToggleHidden}"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="5"
|
||||
IsVisible="{Binding ShowLessonOverview}">
|
||||
<Border Background="#1976D2" CornerRadius="8" Padding="6,1"
|
||||
|
||||
@@ -134,7 +134,7 @@ public partial class SeatingPlanTabView : UserControl
|
||||
}
|
||||
|
||||
private bool CanDropOn(SeatCellViewModel target) =>
|
||||
DataContext is SeatingPlanTabViewModel { CanEditLayout: true }
|
||||
DataContext is SeatingPlanTabViewModel { CanEditLayout: true } && !target.IsHidden
|
||||
&& ((_draggedSeat is not null && _draggedSeat != target) || _draggedStudent?.StudentId is not null);
|
||||
|
||||
private void OnUnassignedDragOver(object? sender, DragEventArgs e) =>
|
||||
|
||||
Reference in New Issue
Block a user