<Page x:Class="JAMM.Kasse.Pages.Bill"
      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="300" d:DesignWidth="300"
	Title="Bill">
    <ScrollViewer>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
        <Border Grid.Row="0">
            <Border.Background>
                <SolidColorBrush Color="White"></SolidColorBrush>
            </Border.Background>
        </Border>
        <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1">
            <Grid>
                <Label HorizontalAlignment="Center" x:Name="billHeader" FontSize="24">Tisch #</Label>
            </Grid>
        </Border>
            <StackPanel Grid.Row="1">
            <ItemsControl Name="UnorderedView">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="LightGray" BorderThickness="0, 0, 0, 1">
                        <Grid Margin="10">                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="10*"/>
                                <ColumnDefinition Width="5*"/>
                                <ColumnDefinition Width="55*"/>
                                <ColumnDefinition Width="15*"/>
                                <ColumnDefinition Width="15*"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock Text="{Binding Quantity}" Grid.Column="0" VerticalAlignment="Center"/>
                            <TextBlock Text=" x " Grid.Column="1" VerticalAlignment="Center"/>
                            <TextBlock Text="{Binding ProductName}" Grid.Column="2" VerticalAlignment="Center"/>
                            <Button Content="-" Grid.Column="3" VerticalAlignment="Center" Click="Decrease" />
                            <Button Content="+" Grid.Column="4" VerticalAlignment="Center" Click="Increase" />                            
                        </Grid>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
            <ItemsControl Name="OrderedView">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Border BorderBrush="LightGray" Background="LightGray" BorderThickness="0, 0, 0, 1">
                            <Grid Margin="10">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="10*"/>
                                    <ColumnDefinition Width="5*"/>
                                    <ColumnDefinition Width="55*"/>
                                </Grid.ColumnDefinitions>
                                <TextBlock Text="{Binding Quantity}" Grid.Column="0" VerticalAlignment="Center"/>
                                <TextBlock Text=" x " Grid.Column="1" VerticalAlignment="Center"/>
                                <TextBlock Text="{Binding ProductName}" Grid.Column="2" VerticalAlignment="Center"/>
                            </Grid>
                        </Border>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
            </StackPanel>
            <Border BorderBrush="White" BorderThickness="0, 1, 0, 0" Grid.Row="2">
                <Grid>
                    <Button Grid.Row="0" x:Name="cancelButton" Click="cancel" Content="Storno" Height="30" Width="100" HorizontalAlignment="Left" Margin="10,5,0,5" VerticalAlignment="Center" />
                    <Button HorizontalAlignment="Center" x:Name="billButton" Click="pay" Content="Abrechnen" Height="30" Width="100"/>
                    <Button Grid.Row="0" x:Name="bookButton" Click="book" Content="Buchen" Height="30" Width="100" HorizontalAlignment="Right" Margin="0,5,10,5" VerticalAlignment="Center"/>
                </Grid>
            </Border>
        </Grid>
    </ScrollViewer>
</Page>
