<Page x:Class="JAMM.Kasse.Pages.EditTables"
      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="EditPages">

    <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="tablesHeader" FontSize="24">Tische 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">Name:</Label>
                    <TextBox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="tableNameEdit" GotKeyboardFocus="TextBoxGotKeyboardFocus1"></TextBox>
                    <Label Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18">Beschreibung:</Label>
                    <TextBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="tableDescriptionEdit" GotKeyboardFocus="TextBoxGotKeyboardFocus2"></TextBox>
                    <Label Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18">Tischnummer:</Label>
                    <TextBox Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="tableNumberEdit" GotKeyboardFocus="TextBoxGotKeyboardFocus"></TextBox>
                    <Label Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18">Aktion</Label>
                    <Label x:Name="wrongTableNo" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Bitte nur Zahlen!" Visibility="Hidden" GotKeyboardFocus="TextBoxGotKeyboardFocus"></Label>
                    <Label x:Name="wrongTableFields" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Bitte alle Felder ausfüllen!" Visibility="Hidden"></Label>
                    <Button Grid.Row="1" Width="150" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Margin="10,0,0,0" x:Name="addTableButton" Click="addTable">Hinzufügen</Button>
                </Grid>
            </Border>
            <ItemsControl Name="TableView" 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 Name}" FontSize="18" />
                            <TextBlock Grid.Row="0" Grid.Column="1" Margin="10" Text="{Binding Description}" FontSize="18" />
                            <TextBlock Grid.Row="0" Grid.Column="2" Margin="10" Text="{Binding Number}" FontSize="18"/>
                            <Button x:Name="deleteTableButton" Click="deleteTable" Grid.Column="3" Width="150" Margin="10" Content="Löschen" FontSize="18"/>
                            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.ColumnSpan="4"/>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>
    </ScrollViewer>
</Page>
