<UserControl x:Class="leak_test_project.Views.DataView"
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"
mc:Ignorable="d"
d:DesignHeight="700" d:DesignWidth="1100" Background="#F4F6F7">
<UserControl.Resources>
<!-- Updated Premium Legacy Styles for Data View -->
<Style x:Key="FilterHeaderBorder" TargetType="Border">
<Setter Property="Background" Value="#34495E"/>
<Setter Property="BorderBrush" Value="#2C3E50"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Height" Value="35"/>
</Style>
<Style x:Key="FilterHeaderLabel" TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style x:Key="FilterContentBorder" TargetType="Border">
<Setter Property="Background" Value="White"/>
<Setter Property="BorderBrush" Value="#BDC3C7"/>
<Setter Property="BorderThickness" Value="1,0,1,1"/>
<Setter Property="Height" Value="45"/>
</Style>
<Style x:Key="ActionButton" TargetType="Button">
<Setter Property="Width" Value="110"/>
<Setter Property="Height" Value="45"/>
<Setter Property="Margin" Value="5,0"/>
<Setter Property="Background" Value="#E5E8E8"/>
<Setter Property="BorderBrush" Value="#95A5A6"/>
<Setter Property="BorderThickness" Value="1.5"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="FontSize" Value="13"/>
</Style>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#EBEDEF"/>
<Setter Property="Foreground" Value="#2C3E50"/>
<Setter Property="BorderBrush" Value="#BDC3C7"/>
<Setter Property="BorderThickness" Value="0,0,1,1"/>
<Setter Property="Height" Value="40"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
<Style TargetType="DataGridCell">
<Setter Property="Padding" Value="5"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="13"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#D6EAF8"/>
<Setter Property="Foreground" Value="#2E86C1"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- Increase Calendar (DatePicker Popup) Size -->
<Style TargetType="{x:Type Calendar}">
<Setter Property="LayoutTransform">
<Setter.Value>
<ScaleTransform ScaleX="1.25" ScaleY="1.25"/>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid Margin="12">
<Grid.RowDefinitions>
<RowDefinition Height="50"/> <!-- Title -->
<RowDefinition Height="Auto"/> <!-- Filters -->
<RowDefinition Height="*"/> <!-- Grid -->
<RowDefinition Height="Auto"/> <!-- Footer -->
</Grid.RowDefinitions>
<!-- Title Bar -->
<Border Grid.Row="0" Background="#2C3E50" BorderBrush="#1A252F" BorderThickness="0,0,0,2">
<TextBlock Text="INSPECT DATA LIST (측정 기록 조회)" Foreground="White" FontWeight="SemiBold" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18"/>
</Border>
<!-- Filter Area (Centered) -->
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10">
<!-- 기간 -->
<StackPanel Width="320">
<Border Style="{StaticResource FilterHeaderBorder}">
<TextBlock Text="조회 기간" Style="{StaticResource FilterHeaderLabel}"/>
</Border>
<Border Style="{StaticResource FilterContentBorder}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<DatePicker SelectedDate="{Binding StartDate}" Width="130" FontSize="13" VerticalAlignment="Center"/>
<TextBlock Text="~" VerticalAlignment="Center" Margin="8,0" FontSize="16" FontWeight="Bold" Foreground="#7F8C8D"/>
<DatePicker SelectedDate="{Binding EndDate}" Width="130" FontSize="13" VerticalAlignment="Center"/>
</StackPanel>
</Border>
</StackPanel>
<!-- 판정 -->
<StackPanel Width="120" Margin="10,0,0,0">
<Border Style="{StaticResource FilterHeaderBorder}">
<TextBlock Text="판정 결과" Style="{StaticResource FilterHeaderLabel}"/>
</Border>
<Border Style="{StaticResource FilterContentBorder}">
<ComboBox SelectedIndex="{Binding JudgmentIndex}" Width="100" Height="30" VerticalAlignment="Center" FontSize="13">
<ComboBoxItem Content="[전체]"/>
<ComboBoxItem Content="OK"/>
<ComboBoxItem Content="NG"/>
</ComboBox>
</Border>
</StackPanel>
<!-- 시리얼번호 -->
<StackPanel Width="280" Margin="10,0,0,0">
<Border Style="{StaticResource FilterHeaderBorder}">
<TextBlock Text="시리얼/제품번호 검색" Style="{StaticResource FilterHeaderLabel}"/>
</Border>
<Border Style="{StaticResource FilterContentBorder}">
<TextBox Text="{Binding SerialFilter, UpdateSourceTrigger=PropertyChanged}" Width="250" Height="30" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Padding="5,0"/>
</Border>
</StackPanel>
<!-- Buttons -->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="15,0,0,0">
<Button Content="Search" Style="{StaticResource ActionButton}" Command="{Binding SearchCommand}" Background="#D4E6F1" BorderBrush="#2E86C1"/>
<Button Content="CSV" Style="{StaticResource ActionButton}" Command="{Binding SaveCsvCommand}" Background="#D4EFDF" BorderBrush="#27AE60" Click="Button_Click"/>
<Button Content="Dummy" Style="{StaticResource ActionButton}" Command="{Binding DummyDataCommand}" Background="#FADBD8" BorderBrush="#E74C3C" Margin="5,0"/>
</StackPanel>
</StackPanel>
<!-- Main Grid -->
<Border Grid.Row="2" BorderBrush="#BDC3C7" BorderThickness="1.2" Background="White">
<DataGrid ItemsSource="{Binding DisplayResults}" AutoGenerateColumns="False" Background="White" IsReadOnly="True"
GridLinesVisibility="All" HorizontalGridLinesBrush="#ECF0F1" VerticalGridLinesBrush="#ECF0F1"
AlternatingRowBackground="#F9FBFC" RowHeight="35"
CanUserSortColumns="True" CanUserReorderColumns="False"
BorderThickness="0" SelectionMode="Extended" SelectionChanged="DataGrid_SelectionChanged">
<DataGrid.Columns>
<DataGridTextColumn Header="날짜" Binding="{Binding InspectDate}" Width="130"/>
<DataGridTextColumn Header="재시험" Binding="{Binding Retest}" Width="70"/>
<DataGridTextColumn Header="개발/양산" Binding="{Binding Mode}" Width="80"/>
<DataGridTextColumn Header="라인번호" Binding="{Binding LineNo}" Width="70"/>
<DataGridTextColumn Header="제품구분" Binding="{Binding ProductType}" Width="100"/>
<DataGridTextColumn Header="ID" Binding="{Binding ProductId}" Width="180"/>
<DataGridTextColumn Header="좌/우" Binding="{Binding Channel}" Width="70"/>
<DataGridTextColumn Header="SPEC UL" Binding="{Binding SpecUL}" Width="80"/>
<DataGridTextColumn Header="SPEC LL" Binding="{Binding SpecLL}" Width="80"/>
<DataGridTextColumn Header="누설값" Binding="{Binding MeasuredValue}" Width="100">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="Margin" Value="0,0,10,0"/>
<Setter Property="FontWeight" Value="Bold"/>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="판정" Binding="{Binding Judgment}" Width="80">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontWeight" Value="ExtraBold"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Judgment}" Value="OK">
<Setter Property="Foreground" Value="#27AE60"/>
</DataTrigger>
<DataTrigger Binding="{Binding Judgment}" Value="NG">
<Setter Property="Foreground" Value="#C0392B"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGridTextColumn.ElementStyle>
</DataGridTextColumn>
<DataGridTextColumn Header="비고" Width="*" MinWidth="300"/>
</DataGrid.Columns>
</DataGrid>
</Border>
<!-- Footer Area (Same style as InOutView) -->
<Border Grid.Row="3" Background="#D5DBDB" BorderBrush="#AEB6BF" BorderThickness="0,2,0,0" Margin="-12,10,-12,-12">
<Button Content="Close" Width="180" Height="50" Margin="0,15"
Background="#E5E8E8" BorderBrush="#95A5A6" BorderThickness="1.5"
FontWeight="Bold" FontSize="14" HorizontalAlignment="Center" Command="{Binding CloseCommand}"/>
</Border>
</Grid>
</UserControl>