<UserControl x:Class="WpfApp1.Views.ProductsView"
             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:WpfApp1.Views"
             mc:Ignorable="d" 
             d:DesignHeight="650" d:DesignWidth="1100">
    <Grid Background="#F5F7FA">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <TextBlock Grid.Row="0"
                   Text="Управление изделиями"
                   FontSize="26"
                   FontWeight="Bold"
                   Foreground="#263238"
                   Margin="25 25 25 10"/>

        <TextBlock Grid.Row="1"
                   Text="В этом разделе можно добавить, изменить или удалить изделие."
                   FontSize="14"
                   Foreground="#607D8B"
                   Margin="25 0 25 20"/>

        <Grid Grid.Row="2" Margin="25 0 25 25">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="340"/>
                <ColumnDefinition Width="20"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <Border Grid.Column="0"
                    Background="White"
                    CornerRadius="10"
                    Padding="20"
                    BorderBrush="#DCE3EA"
                    BorderThickness="1">

                <StackPanel>
                    <TextBlock Text="Данные изделия"
                               FontSize="18"
                               FontWeight="SemiBold"
                               Foreground="#263238"
                               Margin="0 0 0 20"/>

                    <TextBlock Text="ID изделия"
                               FontSize="14"
                               FontWeight="SemiBold"
                               Foreground="#37474F"
                               Margin="0 0 0 6"/>

                    <TextBox x:Name="ProductIdTextBox"
                             Height="36"
                             FontSize="14"
                             Padding="8 4"
                             IsReadOnly="True"
                             Background="#F5F7FA"
                             Margin="0 0 0 16"/>

                    <TextBlock Text="Название изделия"
                               FontSize="14"
                               FontWeight="SemiBold"
                               Foreground="#37474F"
                               Margin="0 0 0 6"/>

                    <TextBox x:Name="ProductNameTextBox"
                             Height="36"
                             FontSize="14"
                             Padding="8 4"
                             Margin="0 0 0 20"/>

                    <Button x:Name="AddButton"
                            Content="Добавить"
                            Height="38"
                            FontSize="14"
                            FontWeight="SemiBold"
                            Cursor="Hand"
                            Margin="0 0 0 10" Click="AddButton_Click"/>

                    <Button x:Name="UpdateButton"
                            Content="Изменить"
                            Height="38"
                            FontSize="14"
                            FontWeight="SemiBold"
                            Cursor="Hand"
                            Margin="0 0 0 10" Click="UpdateButton_Click"/>

                    <Button x:Name="DeleteButton"
                            Content="Удалить"
                            Height="38"
                            FontSize="14"
                            FontWeight="SemiBold"
                            Cursor="Hand"
                            Margin="0 0 0 10" Click="DeleteButton_Click"/>

                    <TextBlock Text="Подсказка: выберите строку в таблице, чтобы заполнить форму."
                               TextWrapping="Wrap"
                               FontSize="13"
                               Foreground="#78909C"
                               Margin="0 25 0 0"/>
                </StackPanel>
            </Border>

            <Border Grid.Column="2"
                    Background="White"
                    CornerRadius="10"
                    Padding="15"
                    BorderBrush="#DCE3EA"
                    BorderThickness="1">

                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>

                    <TextBlock Grid.Row="0"
                               Text="Список изделий"
                               FontSize="18"
                               FontWeight="SemiBold"
                               Foreground="#263238"
                               Margin="0 0 0 15"/>

                    <Grid Grid.Row="1" Margin="0 0 0 15">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="260"/>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                    </Grid>

                    <DataGrid Grid.Row="2"
                              x:Name="ProductsDataGrid"
                              AutoGenerateColumns="False"
                              CanUserAddRows="False"
                              CanUserDeleteRows="False"
                              IsReadOnly="True"
                              HeadersVisibility="Column"
                              GridLinesVisibility="Horizontal"
                              RowHeight="36"
                              FontSize="14"
                              AlternatingRowBackground="#F5F7FA"
                              BorderBrush="#DCE3EA"
                              BorderThickness="1" SelectionChanged="ProductsDataGrid_SelectionChanged">

                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Код изделия"
                            Binding="{Binding [product_id]}"
                            Width="120"/>

                            <DataGridTextColumn Header="Наименование изделия"
                            Binding="{Binding [product_name]}"
                            Width="*"/>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </Border>
        </Grid>
    </Grid>
</UserControl>
