<Window x:Class="JtkPcClientWpf.OrderWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        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:local="clr-namespace:JtkPcClientWpf"
        mc:Ignorable="d"
        Title="상품 주문" Height="600" Width="800"
        x:Name="thisWindow"
        ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent" WindowStartupLocation="CenterScreen" Loaded="thisWindow_Loaded">
    <Border CornerRadius="5" BorderBrush="#FF7C7C7C" BorderThickness="2">
        <Border.Background>
            <ImageBrush ImageSource="black wallpaper.jpg" Stretch="UniformToFill"/>
        </Border.Background>
        <Border.Resources>
            <Style TargetType="TextBlock">
                <Setter Property="Foreground" Value="White" />
                <Setter Property="FontSize" Value="18"/>
            </Style>
            <Style TargetType="Border">
                <Setter Property="CornerRadius" Value="5" />
                <Setter Property="BorderBrush" Value="#FF3B3B3B" />
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop x:Name="GradStop1" Color="#FF292929" Offset="0"/>
                            <GradientStop x:Name="GradStop2" Color="#FF5B5B5B" Offset="1"/>
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
            </Style>
        </Border.Resources>
        <Grid DataContext="{Binding ElementName=thisWindow}">
            <!-- 타이틀바 -->
            <TextBlock HorizontalAlignment="Left" Margin="10" Text="상품 주문" VerticalAlignment="Top" FontWeight="Bold">
                <TextBlock.Effect>
                    <DropShadowEffect BlurRadius="10" ShadowDepth="2"/>
                </TextBlock.Effect>
            </TextBlock>
            <Button x:Name="CloseButton" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="5" KeyboardNavigation.IsTabStop="False" Content="×" Width="22" Height="22" FontWeight="Bold" Click="Close_Click"/>
            <!-- 카테고리 버튼 리스트 -->
            <ListBox HorizontalAlignment="Left" Width="90" Margin="15,40,15,180" Background="Transparent" BorderThickness="0" ItemsSource="{Binding Source={StaticResource orderManager}, Path=Categories}" VerticalContentAlignment="Top" HorizontalContentAlignment="Stretch">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Padding" Value="0" />
                        <Setter Property="Margin" Value="0" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                    <Grid Background="{TemplateBinding Background}">
                                        <ContentPresenter 
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    Content="{TemplateBinding Content}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    Margin="{TemplateBinding Padding}">
                                        </ContentPresenter>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Button Content="{Binding}" Click="Category_Click" HorizontalAlignment="Stretch" Height="25" Margin="0, 0, 0, 5"/>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <!-- 카테고리 내용 리스트 -->
            <Border Margin="120,40,15,180" >
                <ListBox Background="Transparent" BorderThickness="0" ItemsSource="{Binding Source={StaticResource orderManager}, Path=CurrentCategoryProducts}" VerticalContentAlignment="Top" HorizontalContentAlignment="Stretch">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel Width="650" IsItemsHost="True" />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="Padding" Value="3" />
                            <Setter Property="Margin" Value="0" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <Grid Background="{TemplateBinding Background}">
                                            <ContentPresenter 
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    Content="{TemplateBinding Content}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    Margin="{TemplateBinding Padding}">
                                            </ContentPresenter>
                                        </Grid>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Width="100" Height="60">
                                <TextBlock Text="{Binding Name}" Foreground="White" FontSize="14" FontWeight="Bold" TextAlignment="Center"/>
                                <TextBlock Text="{Binding Cost, StringFormat='\{0:N0} 원'}" Foreground="White" FontSize="14" TextAlignment="Center"/>
                                <Button Content="추가하기" Click="ProductAdd_Click" Tag="{Binding}"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Border>
            <!-- 주문내용 리스트 -->
            <Border VerticalAlignment="Bottom" Margin="15,0,400,15" Height="150">
                <ListBox Margin="0" Background="Transparent" BorderThickness="0" ItemsSource="{Binding Source={StaticResource orderManager}, Path=OrderList}" VerticalContentAlignment="Top" HorizontalContentAlignment="Stretch">
                    <ListBox.ItemContainerStyle>
                        <Style TargetType="ListBoxItem">
                            <Setter Property="Padding" Value="0" />
                            <Setter Property="Margin" Value="0" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                        <Grid Background="{TemplateBinding Background}">
                                            <ContentPresenter 
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    Content="{TemplateBinding Content}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    Margin="{TemplateBinding Padding}">
                                            </ContentPresenter>
                                        </Grid>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </ListBox.ItemContainerStyle>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <TextBlock Text="{Binding Product.Name}" HorizontalAlignment="Left" Foreground="White" FontSize="14" FontWeight="Bold"/>
                                <Button Content="－" HorizontalAlignment="Right" Width="20" Margin="0,0,175,0" Tag="{Binding}" Click="QuantityDecrease_Click"/>
                                <TextBlock Text="{Binding Quantity, StringFormat='\{0:N0}개'}" HorizontalAlignment="Right" Width="30" Foreground="White" FontSize="14" TextAlignment="Center" Margin="0,0,140,0"/>
                                <Button Content="＋" HorizontalAlignment="Right" Width="20" Margin="0,0,115,0" Tag="{Binding}" Click="QuantityIncrease_Click"/>
                                <TextBlock Text="{Binding TotalPrice, StringFormat='\\{0:N0}'}" HorizontalAlignment="Right" Foreground="White" FontSize="14" Margin="0,0,45,0"/>
                                <Button Content="제외" HorizontalAlignment="Right" Width="40" Tag="{Binding}" Click="Except_Click"/>
                                
                            </Grid>
                            
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </Border>
            <!-- 지불 방법 -->
            <TextBlock Text="지불 방법" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Margin="0,0,180,140" />
            <Button x:Name="PaymentButton1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="65" Height="32" Margin="0,0,325,105" IsEnabled="True" Click="Payment1_Click">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="baseline_monetization_on_white_48dp.png" Height="20">
                            <Image.Effect>
                                <DropShadowEffect BlurRadius="10" ShadowDepth="0"/>
                            </Image.Effect>
                        </Image>
                        <TextBlock Text="현금" VerticalAlignment="Center" Margin="2,0,0,0"></TextBlock>
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button x:Name="PaymentButton2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="65" Height="32" Margin="0,0,252.5,105" IsEnabled="True" Click="Payment2_Click">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="baseline_credit_card_white_48dp.png" Height="20">
                            <Image.Effect>
                                <DropShadowEffect BlurRadius="10" ShadowDepth="0"/>
                            </Image.Effect>
                        </Image>
                        <TextBlock Text="카드" VerticalAlignment="Center" Margin="2,0,0,0"></TextBlock>
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button x:Name="PaymentButton3" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="65" Height="32" Margin="0,0,180,105" IsEnabled="True" Click="Payment3_Click">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="baseline_copyright_white_48dp.png" Height="20">
                            <Image.Effect>
                                <DropShadowEffect BlurRadius="10" ShadowDepth="0"/>
                            </Image.Effect>
                        </Image>
                        <TextBlock Text="캐시" VerticalAlignment="Center" Margin="2,0,0,0"></TextBlock>
                    </StackPanel>
                </Button.Content>
            </Button>
            <!-- 주문 요청 사항 -->
            <TextBlock Text="주문 요청 사항" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="200" Margin="0,0,180,70" />
            <TextBox Style="{StaticResource placeHolder}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="210" Height="50" Margin="0,0,180,15"  Text="{Binding Path=Memo}" TextWrapping="Wrap" ToolTip="요청 사항" Padding="0" AcceptsReturn="True" />
            <!-- 총 금액 -->
            <TextBlock Text="{Binding Source={StaticResource orderManager}, Path=TotalCost, StringFormat='\{0:N0} 원'}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="150" Margin="0,0,15,120" TextAlignment="Center" FontSize="24" />
            <Button x:Name="OrderButton" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="150" Height="80" Margin="15" Click="Order_Click">
                <Button.Content>
                    <TextBlock Text="주문하기" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0" TextAlignment="Center" />
                </Button.Content>
            </Button>
            
        </Grid>
    </Border>
</Window>
