<Page x:Class="ComputerShopWpf.Views.LateOrdersPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="Просроченные заказы">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <TextBlock Text="Просроченные заказы клиента" Style="{StaticResource PageTitleStyle}"/>

        <Border Grid.Row="1"
                Background="{StaticResource PanelBrush}"
                BorderBrush="{StaticResource BorderBrush}"
                BorderThickness="1"
                Padding="16"
                Margin="0,4,0,10">
            <StackPanel>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="0" Margin="0,0,14,0">
                        <TextBlock Text="Клиент"/>
                        <ComboBox x:Name="ClientsComboBox"
                                  DisplayMemberPath="client_name"
                                  SelectedValuePath="client_id"/>
                    </StackPanel>
                    <Button x:Name="ShowLateOrdersButton" Grid.Column="1" Content="Показать" Click="ShowLateOrdersButton_Click" VerticalAlignment="Bottom"/>
                    <Button x:Name="ShowOrderItemsButton" Grid.Column="2" Content="Состав заказа" Click="ShowOrderItemsButton_Click" VerticalAlignment="Bottom"/>
                </Grid>
                <TextBlock x:Name="CountTextBlock"
                           FontWeight="SemiBold"
                           Foreground="{StaticResource MutedTextBrush}"
                           Margin="0,4,0,0"/>
            </StackPanel>
        </Border>

        <DataGrid x:Name="LateOrdersDataGrid" Grid.Row="2">
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Binding="{Binding [order_id]}" Width="70"/>
                <DataGridTextColumn Header="Дата" Binding="{Binding [order_date], StringFormat={}{0:dd.MM.yyyy HH:mm}}" Width="150"/>
                <DataGridTextColumn Header="Статус" Binding="{Binding [status]}" Width="140"/>
                <DataGridTextColumn Header="Сумма" Binding="{Binding [total_cost], StringFormat={}{0:N2}}" Width="120"/>
                <DataGridTextColumn Header="Клиент" Binding="{Binding [client_name]}" Width="220"/>
                <DataGridTextColumn Header="Телефон" Binding="{Binding [client_phone]}" Width="150"/>
                <DataGridTextColumn Header="Email" Binding="{Binding [client_email]}" Width="200"/>
                <DataGridTextColumn Header="Сотрудник" Binding="{Binding [employee_name]}" Width="200"/>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</Page>
