<Page
      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" 
      xmlns:local="clr-namespace:JAMM.Kasse.Pages" x:Class="JAMM.Kasse.Pages.EditProducts" 
      mc:Ignorable="d" 
      d:DesignHeight="768" d:DesignWidth="1024"
	Title="EditProducts">

    <ScrollViewer>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition />
            </Grid.RowDefinitions>
            <Border Grid.Row="0" Background="White"/>
            <Border Grid.Row="1" Background="White"/>
            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.Row="0">
                <Grid>
                    <Label HorizontalAlignment="Left" x:Name="productHeader" FontSize="24" Content="Produkte bearbeiten"/>
                </Grid>
            </Border>
            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.Row="1">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Produktnummer"/>
                    <TextBox Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="productNumberEdit"/>
                    <Label Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Produktname"/>
                    <TextBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="productNameEdit"/>
                    <Label Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Produktpreis"/>
                    <TextBox Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Width="150" Margin="10,0,0,0" x:Name="productPriceEdit"/>
                    <Label Grid.Column="3" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Produktgruppe"/>
                    <ComboBox x:Name="groupSelect" Grid.Column="3" Grid.Row="1" ItemsSource="{Binding Path=GroupList}" DisplayMemberPath="Name" Width="150" Height="30" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" />                    
                    <Label Grid.Column="4" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="18" Content="Steuersatz"/>
                    <ComboBox x:Name="taxSelect" Grid.Column="4" Grid.Row="1" ItemsSource="{Binding Path=TaxList}" DisplayMemberPath="Name" Width="150" Height="30" HorizontalAlignment="Left" VerticalAlignment="Center" VerticalContentAlignment="Center" IsReadOnly="True" />
                    <Label Grid.Row="0" Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Content="Aktion"/>
                    <Label x:Name="wrongProductNo" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Bitte nur Kommazahlen!" Visibility="Hidden"></Label>
                    <Label x:Name="wrongProductFields" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Content="Bitte alle Felder ausfüllen!" Visibility="Hidden"></Label>
                    <Button Grid.Row="1" Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Margin="10,0,0,0" x:Name="addProductButton" Click="addProduct" Width="150" Content="Hinzufügen"/>
                    <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.Row="2"/>
                </Grid>
            </Border>
            <ItemsControl x:Name="ProductView" Grid.Row="2">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <StackPanel />
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                                <ColumnDefinition/>
                            </Grid.ColumnDefinitions>
                            <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"/>
                            <TextBlock Grid.Row="0" Grid.Column="2" Margin="10" Text="{Binding PriceToString}" FontSize="18"/>
                            <TextBlock Grid.Row="0" Grid.Column="3" Margin="10" Text="{Binding GroupToString}" FontSize="18"/>
                            <TextBlock Grid.Row="0" Grid.Column="4" Margin="10" Text="{Binding TaxToString}" FontSize="18"/>
                            <Button x:Name="deleteProduct" Click="deleteProduct" Grid.Column="5" Margin="10" Content="Löschen" Width="150" FontSize="18"/>
                            <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1" Grid.ColumnSpan="6" />
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </Grid>
    </ScrollViewer>
</Page>