238 lines
13 KiB
XML
238 lines
13 KiB
XML
|
|
<UserControl xmlns="https://github.com/avaloniaui"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||
|
|
xmlns:vm="using:TournamentOrganizer.ViewModels"
|
||
|
|
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="600"
|
||
|
|
x:Class="TournamentOrganizer.Views.TournamentsView"
|
||
|
|
x:DataType="vm:TournamentsViewModel">
|
||
|
|
<Design.DataContext>
|
||
|
|
<vm:TournamentsViewModel />
|
||
|
|
</Design.DataContext>
|
||
|
|
|
||
|
|
<UserControl.Styles>
|
||
|
|
<Style Selector="ListBoxItem.dropdown-item">
|
||
|
|
<Setter Property="Padding" Value="8,4"/>
|
||
|
|
<Setter Property="Cursor" Value="Hand"/>
|
||
|
|
</Style>
|
||
|
|
<Style Selector="ListBoxItem.dropdown-item:selected">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundListLowBrush}"/>
|
||
|
|
</Style>
|
||
|
|
<Style Selector="ListBoxItem.dropdown-item:pointerover">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundListLowBrush}"/>
|
||
|
|
</Style>
|
||
|
|
<Style Selector="Button.dropdown-action">
|
||
|
|
<Setter Property="Padding" Value="8,4"/>
|
||
|
|
<Setter Property="BorderThickness" Value="0"/>
|
||
|
|
<Setter Property="Background" Value="Transparent"/>
|
||
|
|
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||
|
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||
|
|
</Style>
|
||
|
|
<Style Selector="Button.dropdown-action:pointerover">
|
||
|
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundListLowBrush}"/>
|
||
|
|
</Style>
|
||
|
|
</UserControl.Styles>
|
||
|
|
|
||
|
|
<Grid RowDefinitions="Auto,*,Auto" ColumnDefinitions="*,*">
|
||
|
|
<TextBlock Grid.ColumnSpan="2" Grid.Row="0" Text="Tournament Management" FontSize="20" FontWeight="Bold" Margin="16,16,16,8"/>
|
||
|
|
|
||
|
|
<!-- Left Panel: Filters and Matches -->
|
||
|
|
<Border Grid.Column="0" Grid.Row="1" BorderBrush="Gray" BorderThickness="1" Margin="8" CornerRadius="4" Padding="8">
|
||
|
|
<DockPanel>
|
||
|
|
<TextBlock DockPanel.Dock="Top" Text="Matches" FontSize="16" FontWeight="SemiBold" Margin="0,0,0,8"/>
|
||
|
|
|
||
|
|
<!-- Filters -->
|
||
|
|
<StackPanel DockPanel.Dock="Top" Spacing="6" Margin="0,0,0,8">
|
||
|
|
<TextBlock Text="Filters" FontWeight="SemiBold" FontSize="12"/>
|
||
|
|
|
||
|
|
<!-- Event Filter Dropdown -->
|
||
|
|
<Panel Name="EventFilterPanel">
|
||
|
|
<ToggleButton Name="EventFilterToggle" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" Padding="8,6"
|
||
|
|
IsChecked="{Binding IsEventDropdownOpen}">
|
||
|
|
<ToggleButton.Template>
|
||
|
|
<ControlTemplate TargetType="ToggleButton">
|
||
|
|
<Border Background="{TemplateBinding Background}" BorderBrush="Gray" BorderThickness="1" CornerRadius="4">
|
||
|
|
<ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Left"/>
|
||
|
|
</Border>
|
||
|
|
</ControlTemplate>
|
||
|
|
</ToggleButton.Template>
|
||
|
|
<ToggleButton.Content>
|
||
|
|
<Panel>
|
||
|
|
<TextBlock Text="{Binding SelectedEvent.DisplayName, Mode=OneWay}" IsVisible="{Binding SelectedEvent, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||
|
|
<TextBlock Text="Select an event..." Foreground="Gray" IsVisible="{Binding SelectedEvent, Converter={x:Static ObjectConverters.IsNull}}"/>
|
||
|
|
</Panel>
|
||
|
|
</ToggleButton.Content>
|
||
|
|
</ToggleButton>
|
||
|
|
<Popup IsOpen="{Binding IsEventDropdownOpen}" PlacementTarget="{Binding #EventFilterToggle}" Width="{Binding Bounds.Width, ElementName=EventFilterToggle}">
|
||
|
|
<Border Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}" BorderBrush="Gray" BorderThickness="1" CornerRadius="4">
|
||
|
|
<DockPanel MaxHeight="200">
|
||
|
|
<TextBox DockPanel.Dock="Top" Text="{Binding EventFilterSearch}" Watermark="Search events..." Margin="4" Padding="6,4"/>
|
||
|
|
<Button DockPanel.Dock="Bottom" Content="All" Classes="dropdown-action" Foreground="Gray" Margin="4,0,4,4"
|
||
|
|
Click="OnClearEventFilter"/>
|
||
|
|
<ListBox ItemsSource="{Binding FilteredEvents}" MaxHeight="160" SelectionMode="Single" Classes="dropdown-item"
|
||
|
|
SelectionChanged="OnEventSelectionChanged">
|
||
|
|
<ListBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:EventOption">
|
||
|
|
<TextBlock Text="{Binding DisplayName}"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ListBox.ItemTemplate>
|
||
|
|
</ListBox>
|
||
|
|
</DockPanel>
|
||
|
|
</Border>
|
||
|
|
</Popup>
|
||
|
|
</Panel>
|
||
|
|
|
||
|
|
<!-- Tournament Filter Dropdown -->
|
||
|
|
<Panel Name="TournamentFilterPanel">
|
||
|
|
<ToggleButton Name="TournamentFilterToggle" HorizontalContentAlignment="Left" HorizontalAlignment="Stretch" Padding="8,6"
|
||
|
|
IsChecked="{Binding IsTournamentDropdownOpen}" IsEnabled="{Binding IsTournamentFilterEnabled}">
|
||
|
|
<ToggleButton.Template>
|
||
|
|
<ControlTemplate TargetType="ToggleButton">
|
||
|
|
<Border Background="{TemplateBinding Background}" BorderBrush="Gray" BorderThickness="1" CornerRadius="4">
|
||
|
|
<ContentPresenter Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}" HorizontalAlignment="Left"/>
|
||
|
|
</Border>
|
||
|
|
</ControlTemplate>
|
||
|
|
</ToggleButton.Template>
|
||
|
|
<ToggleButton.Content>
|
||
|
|
<Panel>
|
||
|
|
<TextBlock Text="{Binding SelectedTournament.DisplayName, Mode=OneWay}" IsVisible="{Binding SelectedTournament, Converter={x:Static ObjectConverters.IsNotNull}}"/>
|
||
|
|
<TextBlock Text="Select an event first..." Foreground="Gray" IsVisible="{Binding SelectedTournament, Converter={x:Static ObjectConverters.IsNull}}"/>
|
||
|
|
</Panel>
|
||
|
|
</ToggleButton.Content>
|
||
|
|
</ToggleButton>
|
||
|
|
<Popup IsOpen="{Binding IsTournamentDropdownOpen}" PlacementTarget="{Binding #TournamentFilterToggle}" Width="{Binding Bounds.Width, ElementName=TournamentFilterToggle}">
|
||
|
|
<Border Background="{DynamicResource SystemControlBackgroundChromeMediumBrush}" BorderBrush="Gray" BorderThickness="1" CornerRadius="4">
|
||
|
|
<DockPanel MaxHeight="200">
|
||
|
|
<TextBox DockPanel.Dock="Top" Text="{Binding TournamentFilterSearch}" Watermark="Search tournaments..." Margin="4" Padding="6,4"/>
|
||
|
|
<Button DockPanel.Dock="Bottom" Content="All" Classes="dropdown-action" Foreground="Gray" Margin="4,0,4,4"
|
||
|
|
Click="OnClearTournamentFilter"/>
|
||
|
|
<ListBox ItemsSource="{Binding FilteredTournaments}" MaxHeight="160" SelectionMode="Single" Classes="dropdown-item"
|
||
|
|
SelectionChanged="OnTournamentSelectionChanged">
|
||
|
|
<ListBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:TournamentOption">
|
||
|
|
<TextBlock Text="{Binding DisplayName}"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ListBox.ItemTemplate>
|
||
|
|
</ListBox>
|
||
|
|
</DockPanel>
|
||
|
|
</Border>
|
||
|
|
</Popup>
|
||
|
|
</Panel>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Matches List -->
|
||
|
|
<ListBox ItemsSource="{Binding Matches}"
|
||
|
|
SelectedItem="{Binding SelectedMatch}">
|
||
|
|
<ListBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:MatchDisplay">
|
||
|
|
<StackPanel Spacing="2">
|
||
|
|
<TextBlock Text="{Binding TeamsText}" FontWeight="SemiBold"/>
|
||
|
|
<TextBlock Text="{Binding State}" FontSize="11" Foreground="Gray"/>
|
||
|
|
</StackPanel>
|
||
|
|
</DataTemplate>
|
||
|
|
</ListBox.ItemTemplate>
|
||
|
|
</ListBox>
|
||
|
|
</DockPanel>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- Right Panel: Tournament Editor and Teams -->
|
||
|
|
<Border Grid.Column="1" Grid.Row="1" BorderBrush="Gray" BorderThickness="1" Margin="8" CornerRadius="4" Padding="8">
|
||
|
|
<DockPanel>
|
||
|
|
<TextBlock DockPanel.Dock="Top" Text="Tournament Details" FontSize="16" FontWeight="SemiBold" Margin="0,0,0,8"/>
|
||
|
|
|
||
|
|
<Button DockPanel.Dock="Bottom" Content="Save Tournament" Command="{Binding SaveTournamentCommand}" HorizontalAlignment="Stretch" IsEnabled="{Binding IsEditing}" Margin="0,8,0,0"/>
|
||
|
|
|
||
|
|
<ScrollViewer>
|
||
|
|
<StackPanel Spacing="8" IsEnabled="{Binding IsEditing}">
|
||
|
|
<!-- Dates -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Start Date" FontWeight="SemiBold"/>
|
||
|
|
<CalendarDatePicker SelectedDate="{Binding TournamentStart}"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="End Date" FontWeight="SemiBold"/>
|
||
|
|
<CalendarDatePicker SelectedDate="{Binding TournamentEnd}"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Stage 1 Rule Set -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Stage 1 Rule Set" FontWeight="SemiBold"/>
|
||
|
|
<ComboBox ItemsSource="{Binding S1RuleSetOptions}" SelectedItem="{Binding SelectedS1RuleSet}">
|
||
|
|
<ComboBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:RuleSetOption">
|
||
|
|
<TextBlock Text="{Binding Label}"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ComboBox.ItemTemplate>
|
||
|
|
</ComboBox>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Stage 1 Groups (only if Stage 2 is set) -->
|
||
|
|
<StackPanel Spacing="4" IsVisible="{Binding SelectedS2RuleSet.Value, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||
|
|
<TextBlock Text="Stage 1 Groups" FontWeight="SemiBold"/>
|
||
|
|
<NumericUpDown Value="{Binding S1Groups}" Minimum="1" Maximum="100"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<StackPanel Spacing="4" IsVisible="{Binding SelectedS2RuleSet.Value, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||
|
|
<TextBlock Text="Stage 1 Group Advances" FontWeight="SemiBold"/>
|
||
|
|
<NumericUpDown Value="{Binding S1GroupAdvances}" Minimum="1" Maximum="100"/>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Stage 2 Rule Set -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Stage 2 Rule Set (optional)" FontWeight="SemiBold"/>
|
||
|
|
<ComboBox ItemsSource="{Binding S2RuleSetOptions}" SelectedItem="{Binding SelectedS2RuleSet}">
|
||
|
|
<ComboBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:RuleSetOption">
|
||
|
|
<TextBlock Text="{Binding Label}"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ComboBox.ItemTemplate>
|
||
|
|
</ComboBox>
|
||
|
|
</StackPanel>
|
||
|
|
|
||
|
|
<!-- Teams Section -->
|
||
|
|
<StackPanel Spacing="4">
|
||
|
|
<TextBlock Text="Participating Teams" FontWeight="SemiBold"/>
|
||
|
|
|
||
|
|
<!-- Add Team -->
|
||
|
|
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="4">
|
||
|
|
<ComboBox Grid.Column="0" ItemsSource="{Binding AvailableTeams}" SelectedItem="{Binding SelectedTeamToAdd}">
|
||
|
|
<ComboBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:TeamOption">
|
||
|
|
<TextBlock Text="{Binding DisplayName}"/>
|
||
|
|
</DataTemplate>
|
||
|
|
</ComboBox.ItemTemplate>
|
||
|
|
</ComboBox>
|
||
|
|
<Button Grid.Column="1" Content="Add" Command="{Binding AddTeamToTournamentCommand}" IsEnabled="{Binding SelectedTeamToAdd, Converter={x:Static ObjectConverters.IsNotNull}}" VerticalAlignment="Center"/>
|
||
|
|
</Grid>
|
||
|
|
|
||
|
|
<!-- Teams List -->
|
||
|
|
<ListBox ItemsSource="{Binding ParticipatingTeams}"
|
||
|
|
SelectedItem="{Binding SelectedParticipatingTeam}"
|
||
|
|
MinHeight="100"
|
||
|
|
MaxHeight="150">
|
||
|
|
<ListBox.ItemTemplate>
|
||
|
|
<DataTemplate x:DataType="vm:ParticipatingTeam">
|
||
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
||
|
|
<TextBlock Text="{Binding Seed, StringFormat='#{0}'}" FontWeight="SemiBold" Foreground="Gray"/>
|
||
|
|
<TextBlock Text="{Binding Name}"/>
|
||
|
|
</StackPanel>
|
||
|
|
</DataTemplate>
|
||
|
|
</ListBox.ItemTemplate>
|
||
|
|
</ListBox>
|
||
|
|
|
||
|
|
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
|
||
|
|
<Button Grid.Column="0" Content="Remove" Command="{Binding RemoveTeamFromTournamentCommand}" IsEnabled="{Binding SelectedParticipatingTeam, Converter={x:Static ObjectConverters.IsNotNull}}" HorizontalAlignment="Stretch"/>
|
||
|
|
<Button Grid.Column="1" Content="Reseed" Command="{Binding ReseedTeamsCommand}" HorizontalAlignment="Stretch"/>
|
||
|
|
</Grid>
|
||
|
|
</StackPanel>
|
||
|
|
</StackPanel>
|
||
|
|
</ScrollViewer>
|
||
|
|
</DockPanel>
|
||
|
|
</Border>
|
||
|
|
|
||
|
|
<!-- Status Bar -->
|
||
|
|
<TextBlock Grid.ColumnSpan="2" Grid.Row="2" Text="{Binding StatusMessage}" Margin="8" Foreground="Gray" FontSize="12"/>
|
||
|
|
</Grid>
|
||
|
|
</UserControl>
|