<UserControl x:Class="SlnMesnac.WPF.Page.EmployeeLoginPage"
             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:SlnMesnac.WPF.Page"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800">
    <UserControl.Resources>
        <Style x:Key="DataGridTextColumnCenterSytle" TargetType="{x:Type TextBlock}">
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="FontSize" Value="20"/>
        </Style>

        <Style TargetType="DataGrid">
            <!--网格线颜色-->
            <Setter Property="CanUserResizeColumns" Value="false"/>
            <Setter Property="Background" Value="#1152AC" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="HorizontalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#4285DE"/>
                </Setter.Value>
            </Setter>
            <Setter Property="VerticalGridLinesBrush">
                <Setter.Value>
                    <SolidColorBrush Color="#1152AC"/>
                </Setter.Value>
            </Setter>
        </Style>
        <!--列头标题栏样式-->
        <Style TargetType="DataGridColumnHeader">
            <!--<Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>-->
            <!--<Setter Property="Background" Value="#dddddd"/>
            <Setter Property="Foreground" Value="Black"/>-->
            <!--<Setter Property="BorderThickness" Value="1" />-->
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="15"/>
            <Setter Property="Background" Value="#4285DE"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>

        <!--单元格样式-->
        <Style TargetType="DataGridCell">
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="BorderThickness" Value="0" />
            <Setter Property="BorderBrush" Value="#4285DE" />
            <Setter Property="Height" Value="40"/>
            <Setter Property="FontSize" Value="18"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <Grid Background="{TemplateBinding Background}" >
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Style.Triggers>
                <Trigger Property="IsSelected" Value="True">
                    <Setter Property="Background" Value="#4285DE"/>
                    <!--<Setter Property="Foreground" Value="#dddddd"/>-->
                </Trigger>
            </Style.Triggers>

        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition Height="0.6*"/>
            <RowDefinition Height="7*"/>
        </Grid.RowDefinitions>
        <Border Grid.Row="0" Margin="3">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="2*"/>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="1.5*"/>
                    <ColumnDefinition Width="4*"/>
                    <ColumnDefinition Width="1.5*"/>
                    <ColumnDefinition Width="4*"/>
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0">
                    <TextBlock Text="选择工位" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,20,0"/>
                </Border>
                <Border  Grid.Column="1" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="0,0,80,0">
                    <!--<Border.Effect>
                        <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
                    </Border.Effect>-->
                    <!--<TextBlock Text="{Binding StationName}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>-->
                    <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                        <ComboBox 
                            x:Name="StationComboBox" 
                            ItemsSource="{Binding StationList}" 
                            SelectedItem="{Binding SelectedItem}" Width="160" Height="32" FontSize="15" HorizontalAlignment="Left"/>
                        <Button x:Name="ConfirmButton" Style="{StaticResource  BUTTON_AGREE}" Content="确认" Command="{Binding ConfirmCommand}" Background="#009999" BorderBrush="#FF36B5C1"  Width="65" Height="35" FontSize="15" Margin="10,0,0,0"/>
                    </StackPanel>
                    
                </Border>
                <Border Grid.Column="2">
                    <TextBlock Text="人员工号" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"  Margin="0,0,20,0"/>
                </Border>
                <Border  Grid.Column="3" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="0,0,80,0">
                    <Border.Effect>
                        <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
                    </Border.Effect>
                    <TextBlock Text="{Binding StaffIdText}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
                <Border Grid.Column="4">
                    <TextBlock Text="打卡状态" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,20,0"/>
                </Border>
                <Border  Grid.Column="5" Height="50" BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5" Margin="0,0,80,0">
                    <Border.Effect>
                        <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
                    </Border.Effect>
                    <TextBlock Text="{Binding CheckStatus}" FontSize="20" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
            </Grid>
        </Border>
        <Border Grid.Row="1">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="6*"/>
                    <ColumnDefinition Width="2*"/>
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0">
                    <TextBlock Text="打卡类型" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
                <Border Grid.Column="1">
                    <StackPanel Orientation="Horizontal">
                        <Button Content="{Binding CheckInButtonText}" x:Name="On"  Command="{Binding CheckInCommand}" Style="{StaticResource  BUTTON_AGREE}" IsEnabled="{Binding IsCheckInButtonEnabled}" FontSize="15" FontWeight="Bold" Width="200" Background="{Binding CheckInButtonColor}" HorizontalAlignment="Left" BorderBrush="#FF36B5C1" Margin="40,10,40,10" Click="On_Click"/>
                        <Button Content="{Binding CheckOutButtonText}" x:Name="Off"  Command="{Binding CheckOutCommand}" Style="{StaticResource  BUTTON_AGREE}" IsEnabled="{Binding IsCheckOutButtonEnabled}" FontSize="15" FontWeight="Bold" Width="200" Background="{Binding CheckOutButtonColor}" HorizontalAlignment="Left" BorderBrush="#FF36B5C1" Margin="20,10,20,10"/>
                    </StackPanel>
                </Border>
                <Border Grid.Column="2">
                    <TextBlock Text="{Binding StatusText}" FontSize="25" Foreground="Red" FontWeight="Bold" VerticalAlignment="Center" HorizontalAlignment="Center"/>
                </Border>
            </Grid>
        </Border>
        <Border Grid.Row="2">
            <TextBlock Text="人员登录信息" FontSize="20" FontWeight="Bold" Foreground="White" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,20,0"/>
        </Border>
        <Border Grid.Row="3"  Margin="5"  BorderBrush="#1254AB" BorderThickness="2" CornerRadius="5">
            <Border.Effect>
                <DropShadowEffect Color="#1254AB" Direction="270" BlurRadius="10" ShadowDepth="5" Opacity="0.5"/>
            </Border.Effect>
            <ScrollViewer VerticalScrollBarVisibility="Visible">
                <DataGrid Name="dataGrid" ItemsSource="{Binding RecordStaffRealTimeDataGrid}" Background="Transparent" 
                    FontSize="15" ColumnHeaderHeight="30" LoadingRow="dgvMH_LoadingRow"
                    RowHeight="35" AutoGenerateColumns="False" RowHeaderWidth="0" 
                    GridLinesVisibility="None" ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                    BorderThickness="0" CanUserAddRows="False"
                    Foreground="#FFFFFF" >    
                    <!--resourceStyle 399行修改选中字体颜色-->
                    <DataGrid.Columns>
                        <DataGridTemplateColumn  Width="55" Header="序号"  >
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" FontSize="18" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0,0,0"></TextBlock>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                        <DataGridTextColumn Binding="{Binding ObjId}" Header="序号1" Width="2*"  IsReadOnly="True"  ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}" Visibility="Collapsed"/>
                        <DataGridTextColumn Binding="{Binding StaffId}" Header="员工ID" Width="2*"  IsReadOnly="True" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                        <DataGridTextColumn Binding="{Binding CreateBy}" Header="员工姓名" Width="2*"  IsReadOnly="True" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                        <!--<DataGridTextColumn Binding="{Binding date,StringFormat=\{0:yyyy-MM-dd\}}" Header="工单编号" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>-->
                        <DataGridTextColumn Binding="{Binding CreateTime}" Header="打卡时间" Width="3*" IsReadOnly="True" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>
                        <!--<DataGridTextColumn Binding="{Binding hualway}" Header="性别" Width="2*" IsReadOnly="True" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>-->
                        <!--<DataGridTextColumn Binding="{Binding baggageTagCode}" Header="卡号" Width="2*"  IsReadOnly="True" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>-->
                        <!--<DataGridTextColumn Binding="{Binding TeamCode}" Header="班组编号" Width="2*"  IsReadOnly="True" ElementStyle="{StaticResource  DataGridTextColumnCenterSytle}"/>-->
                        <DataGridTemplateColumn Header="操作" Width="1*" >
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <WrapPanel>
                                        <Button Content="强退" 
                                                FontSize="15" 
                                                Width="60" 
                                                Height="25" 
                                                Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGrid}}}"
                                                IsEnabled="{Binding IsRemoveButtonEnabled}"
                                                CommandParameter="{Binding StaffId}">       
                                        </Button>
                                    </WrapPanel>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
                        </DataGridTemplateColumn>
                    </DataGrid.Columns>
                </DataGrid>
            </ScrollViewer>
        </Border>
    </Grid>
</UserControl>
