<Window x:Class="dealer.AddVehicleWindow"
    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:dealer"
    mc:Ignorable="d"
    Title="Pridat vozidlo" Height="700" Width="500"
    WindowStartupLocation="CenterOwner"
    ResizeMode="NoResize">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto">
            <StackPanel Margin="20">
                <TextBlock Text="Nove vozidlo"
                    FontSize="20"
                    FontWeight="Bold"
                    Margin="0,0,0,20"
                    HorizontalAlignment="Center" />

                <TextBlock Text="SPZ:" FontSize="14" Margin="0,5" />
                <TextBox Name="SpzTextBox"
                    FontSize="14"
                    Padding="5"
                    MaxLength="10"
                    CharacterCasing="Upper"
                    Margin="0,0,0,10" />

                <TextBlock Text="Znacka:" FontSize="14" Margin="0,5" />
                <TextBox Name="ZnackaTextBox"
                    FontSize="14"
                    Padding="5"
                    Margin="0,0,0,10" />

                <TextBlock Text="Model:" FontSize="14" Margin="0,5" />
                <TextBox Name="ModelTextBox"
                    FontSize="14"
                    Padding="5"
                    Margin="0,0,0,10" />

                <TextBlock Text="Barva:" FontSize="14" Margin="0,5" />
                <StackPanel Orientation="Horizontal" Margin="0,0,0,10">
                    <Border Name="ColorPreviewBorder"
                        Width="40"
                        Height="32"
                        BorderBrush="Gray"
                        BorderThickness="1"
                        Background="White"
                        Margin="0,0,10,0" />
                    <Button Name="SelectColorButton"
                        Content="Vybrat barvu"
                        Width="120"
                        Height="32"
                        Click="SelectColorButton_Click" />
                    <TextBlock Name="ColorNameTextBlock"
                        Text="Nevybrano"
                        VerticalAlignment="Center"
                        Margin="10,0,0,0"
                        FontStyle="Italic"
                        Foreground="Gray" />
                </StackPanel>

                <TextBlock Text="Rok vyroby:" FontSize="14" Margin="0,5" />
                <TextBox Name="YearTextBox"
                    FontSize="14"
                    Padding="5"
                    MaxLength="4"
                    PreviewTextInput="NumericOnly_PreviewTextInput"
                    Margin="0,0,0,10" />

                <TextBlock Text="Palivo:" FontSize="14" Margin="0,5" />
                <ComboBox Name="PalivoComboBox"
                    FontSize="14"
                    Padding="5"
                    Margin="0,0,0,10">
                    <ComboBoxItem Content="Benz�n" />
                    <ComboBoxItem Content="Nafta" />
                    <ComboBoxItem Content="Elektro" />
                    <ComboBoxItem Content="Hybrid" />
                    <ComboBoxItem Content="LPG" />
                    <ComboBoxItem Content="CNG" />
                </ComboBox>

                <TextBlock Text="Najete km:" FontSize="14" Margin="0,5" />
                <TextBox Name="MileageTextBox"
                    FontSize="14"
                    Padding="5"
                    PreviewTextInput="NumericOnly_PreviewTextInput"
                    Margin="0,0,0,10" />

                <TextBlock Text="Cena (Kc):" FontSize="14" Margin="0,5" />
                <TextBox Name="PriceTextBox"
                    FontSize="14"
                    Padding="5"
                    PreviewTextInput="DecimalOnly_PreviewTextInput"
                    Margin="0,0,0,10" />

                <TextBlock Text="Fotografie:" FontSize="14" Margin="0,15,0,5" />
                <Button Name="SelectPhotoButton"
                    Content="Vybrat fotografii"
                    Width="150"
                    Height="30"
                    HorizontalAlignment="Left"
                    Margin="0,0,0,5"
                    Click="SelectPhotoButton_Click" />
                <TextBlock Name="PhotoPathTextBlock"
                    Text="Zadna fotografie nevybrana"
                    FontStyle="Italic"
                    Foreground="Gray"
                    Margin="0,0,0,10"
                    TextWrapping="Wrap" />

                <Separator Margin="0,15,0,15" />

                <TextBlock Text="Vlastnik" FontSize="16" FontWeight="Bold" Margin="0,0,0,10" />

                <TextBlock Text="Vybrat vlastnika:" FontSize="14" Margin="0,5" />
                <Grid Margin="0,0,0,10">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <ComboBox Name="OwnerComboBox"
                        FontSize="14"
                        Padding="5"
                        IsEditable="True"
                        IsTextSearchEnabled="False"
                        StaysOpenOnEdit="True"
                        DisplayMemberPath="DisplayText"
                        TextBoxBase.TextChanged="OwnerComboBox_TextChanged"
                        SelectionChanged="OwnerComboBox_SelectionChanged" />
                    <Button Name="AddNewOwnerButton"
                        Grid.Column="1"
                        Content="+"
                        Width="35"
                        Height="35"
                        Margin="5,0,0,0"
                        FontSize="18"
                        FontWeight="Bold"
                        ToolTip="Pridat noveho vlastnika"
                        Click="AddNewOwnerButton_Click" />
                </Grid>

                <TextBlock Name="SelectedOwnerInfo"
                    Text=""
                    FontStyle="Italic"
                    Foreground="Gray"
                    TextWrapping="Wrap"
                    Margin="0,0,0,10" />
            </StackPanel>
        </ScrollViewer>

        <Border Grid.Row="1"
            BorderBrush="LightGray"
            BorderThickness="0,1,0,0"
            Background="WhiteSmoke">
            <StackPanel Orientation="Horizontal"
                HorizontalAlignment="Center"
                Margin="0,15">
                <Button Name="SaveButton"
                    Content="Ulozit"
                    Width="100"
                    Height="35"
                    Margin="5"
                    FontSize="14"
                    Click="SaveButton_Click" />
                <Button Name="CancelButton"
                    Content="Zrusit"
                    Width="100"
                    Height="35"
                    Margin="5"
                    FontSize="14"
                    Click="CancelButton_Click" />
            </StackPanel>
        </Border>
    </Grid>
</Window>
