<Page x:Class="JAMM.Kasse.Pages.EditGroups"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="768" d:DesignWidth="1024"
	Title="EditGroup">
    <ScrollViewer>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Border Grid.Row="0">
                <Border.Background>
                    <SolidColorBrush Color="White"></SolidColorBrush>
                </Border.Background>
            </Border>
            <Border Grid.Row="1">
                <Border.Background>
                    <SolidColorBrush Color="White"></SolidColorBrush>
                </Border.Background>
            </Border>
            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.Row="0">
                <Grid>
                    <Label HorizontalAlignment="Left" x:Name="groupHeader" FontSize="24">Gruppen bearbeiten</Label>
                </Grid>
            </Border>
            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.Row="1">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                        <RowDefinition></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18">Gruppennummer:</Label>
                    <TextBox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="groupNumberEdit" GotKeyboardFocus="TextBoxGotKeyboardFocus"></TextBox>
                    <Label x:Name="wrongGroupNo" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="14" Content="Bitte nur Ganzzahlen!" Visibility="Hidden"></Label>
                    <Label Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18">Gruppenname:</Label>
                    <TextBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="groupNameEdit" GotKeyboardFocus="TextBoxGotKeyboardFocus1"></TextBox>
                    <Label x:Name="wrongFields" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Bitte Nummer und Namen angeben!" Visibility="Hidden"></Label>
                    <Label Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18">Aktion</Label>
                    <Button Grid.Row="1" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" Click="addGroup">Hinzufügen</Button>
                    <Label x:Name="stillProducts" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Es befinden sich noch Produkte in der Gruppe!" Visibility="Hidden"></Label>
                </Grid>
            </Border>
            <ItemsControl Name="GroupView" Grid.Row="2">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                                <ColumnDefinition></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                                <RowDefinition></RowDefinition>
                            </Grid.RowDefinitions>
                            <TextBlock Grid.Row="0" Grid.Column="0" Margin="10" Text="{Binding Number}" FontSize="18"/>
                            <TextBlock Grid.Row="0" Grid.Column="1" Margin="10" Text="{Binding Name}" FontSize="18"/>

                            <Button x:Name="deleteGroupButton" Click="deleteGroup" Grid.Column="3" Margin="10" Width="150" Content="Löschen" FontSize="18"/>
                            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.ColumnSpan="4"/>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>
    </ScrollViewer>
</Page>
