<UserControl x:Class="WpfApp1.Views.SearchProductsView"
             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"
             Height="650"
             Width="1100">

    <Grid Background="#F5F7FA">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <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"/>

        <Border Grid.Row="2"
                Background="White"
                CornerRadius="10"
                Padding="20"
                Margin="25 0 25 20"
                BorderBrush="#DCE3EA"
                BorderThickness="1">

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="300"/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Column="0"
                           Text="Деталь:"
                           FontSize="16"
                           FontWeight="SemiBold"
                           Foreground="#37474F"
                           VerticalAlignment="Center"
                           Margin="0 0 15 0"/>

                <ComboBox Grid.Column="1"
                          x:Name="DetailsComboBox"
                          Height="36"
                          FontSize="14"
                          Padding="8 4"
                          DisplayMemberPath="detail_name"
                          SelectedValuePath="detail_id"
                          VerticalContentAlignment="Center">
                </ComboBox>

                <Button Grid.Column="2"
                        x:Name="SearchButton"
                        Content="Найти"
                        Width="120"
                        Height="36"
                        FontSize="14"
                        FontWeight="SemiBold"
                        Margin="15 0 0 0"
                        Cursor="Hand" Click="SearchButton_Click"/>
            </Grid>
        </Border>

        <Border Grid.Row="3"
                Background="White"
                CornerRadius="10"
                Padding="15"
                Margin="25 0 25 25"
                BorderBrush="#DCE3EA"
                BorderThickness="1">

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

                <TextBlock Grid.Row="0"
                           Text="Результаты поиска"
                           FontSize="18"
                           FontWeight="SemiBold"
                           Foreground="#263238"
                           Margin="0 0 0 15"/>

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

                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Изделие"
                            Binding="{Binding [Изделие]}" />

                        <DataGridTextColumn Header="Деталь"
                            Binding="{Binding [Деталь]}" />

                        <DataGridTextColumn Header="Метод обработки"
                            Binding="{Binding [Метод обработки]}" />

                        <DataGridTextColumn Header="Операция"
                            Binding="{Binding [Операция]}" />

                        <DataGridTextColumn Header="Количество"
                            Binding="{Binding [Количество]}" />

                        <DataGridTextColumn Header="Норма времени"
                            Binding="{Binding [Норма времени]}" />

                        <DataGridTextColumn Header="Общее время"
                            Binding="{Binding [Общее время]}" />
                    </DataGrid.Columns>
                </DataGrid>
            </Grid>
        </Border>
    </Grid>
</UserControl>
