Utopia-Canteen-System/Views/ScannerDashboardView.xaml

542 lines
49 KiB
XML

<UserControl x:Class="UtopiaCanteenSystem.Views.ScannerDashboardView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:UtopiaCanteenSystem.Converters">
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BoolToVisibility"/>
<local:StringToVisibilityConverter x:Key="StringToVisibility"/>
<local:StringToImageSourceConverter x:Key="StringToImageSource"/>
<SolidColorBrush x:Key="AccentBrush" Color="#5BA3A0"/>
<SolidColorBrush x:Key="AccentLightBrush" Color="#D4EDEB"/>
<SolidColorBrush x:Key="AccentBorderBrush" Color="#995BA3A0"/>
<SolidColorBrush x:Key="MutedTextBrush" Color="#718096"/>
<SolidColorBrush x:Key="TitleTextBrush" Color="#2D3748"/>
<SolidColorBrush x:Key="ErrorTextBrush" Color="#E53E3E"/>
<SolidColorBrush x:Key="ConnectedBrush" Color="#38A169"/>
<SolidColorBrush x:Key="SuccessTextBrush" Color="#38A169"/>
<SolidColorBrush x:Key="SettingsIconBrush" Color="#5BA3A0"/>
<Style x:Key="RoundedButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="{StaticResource AccentBrush}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="28,14"/>
<Setter Property="MinHeight" Value="56"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" CornerRadius="8" SnapsToDevicePixels="True">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="SecondaryButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource TitleTextBrush}"/>
<Setter Property="Background" Value="#FFFFFF"/>
<Setter Property="BorderBrush" Value="#e2e8f0"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="20,12"/>
<Setter Property="MinHeight" Value="52"/>
<Setter Property="MinWidth" Value="120"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="ButtonBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="10">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="8,0">
<TextBlock Text="⚙" FontSize="16" Foreground="{StaticResource SettingsIconBrush}" Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="#f8fafc"/>
<Setter TargetName="ButtonBorder" Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
<Setter Property="Foreground" Value="{StaticResource AccentBrush}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="#f1f5f9"/>
<Setter TargetName="ButtonBorder" Property="BorderBrush" Value="#4a918e"/>
<Setter Property="Foreground" Value="#4a918e"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LogoutLinkButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Foreground" Value="{StaticResource MutedTextBrush}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Padding" Value="16,12"/>
<Setter Property="MinHeight" Value="52"/>
<Setter Property="MinWidth" Value="120"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="ButtonBorder" Background="{TemplateBinding Background}" CornerRadius="10" BorderBrush="#fee2e2" BorderThickness="1">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Text="⎋" FontSize="16" Foreground="#e53e3e" Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="Logout" Foreground="#e53e3e" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" VerticalAlignment="Center"/>
</StackPanel>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="#fef2f2"/>
<Setter TargetName="ButtonBorder" Property="BorderBrush" Value="#fca5a5"/>
<Setter Property="Foreground" Value="#dc2626"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="ButtonBorder" Property="Background" Value="#fee2e2"/>
<Setter TargetName="ButtonBorder" Property="BorderBrush" Value="#f87171"/>
<Setter Property="Foreground" Value="#b91c1c"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StatusTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource MutedTextBrush}"/>
<Setter Property="FontSize" Value="15"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ScannerStatus}" Value="Connected">
<Setter Property="Foreground" Value="{StaticResource ConnectedBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="StatusIconStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="Segoe MDL2 Assets"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Text" Value=""/>
<Setter Property="Foreground" Value="{StaticResource ErrorTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding ScannerStatus}" Value="Connected">
<Setter Property="Foreground" Value="{StaticResource ConnectedBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="StatusBorderStyle" TargetType="Border">
<Setter Property="Background" Value="#dcfce7"/>
<Setter Property="BorderBrush" Value="#86efac"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="18"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSuccess}" Value="False">
<Setter Property="Background" Value="#fee2e2"/>
<Setter Property="BorderBrush" Value="#fca5a5"/>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Grid Background="#F0F2F5" MinHeight="0" MinWidth="0">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" Padding="16" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid MinHeight="{Binding ViewportHeight, RelativeSource={RelativeSource AncestorType=ScrollViewer}}" MinWidth="0" HorizontalAlignment="Stretch">
<Border HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="360" Width="{Binding ViewportWidth, RelativeSource={RelativeSource AncestorType=ScrollViewer}}" MaxWidth="1150" Padding="20" Background="White" CornerRadius="12">
<Border.Effect>
<DropShadowEffect BlurRadius="24" ShadowDepth="0" Opacity="0.08" Color="#000000"/>
</Border.Effect>
<Grid MinWidth="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="0" MaxWidth="480"/>
<ColumnDefinition Width="16"/>
<ColumnDefinition Width="*" MinWidth="0"/>
</Grid.ColumnDefinitions>
<!-- Left Panel: Employee Information (larger text and profile to use space) -->
<Border Grid.Column="0" MinWidth="0" Background="#f4f4f4" BorderBrush="#e2e8f0" BorderThickness="1" CornerRadius="10" Padding="24">
<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">
<StackPanel>
<!-- Top row: circular profile image (left) + name (right) -->
<Grid Margin="0,0,0,24">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" MinWidth="0"/>
</Grid.ColumnDefinitions>
<!-- Profile image (circular); set EmployeeProfileImagePath to show photo -->
<Grid Grid.Column="0" Width="110" Height="110" Margin="0,0,18,0">
<Ellipse Fill="#e2e8f0"/>
<Image Source="{Binding EmployeeProfileImagePath, Converter={StaticResource StringToImageSource}}" Stretch="UniformToFill" Visibility="{Binding EmployeeProfileImagePath, Converter={StaticResource StringToVisibility}}">
<Image.Clip>
<EllipseGeometry Center="55,55" RadiusX="55" RadiusY="55"/>
</Image.Clip>
</Image>
<TextBlock Text="—" FontSize="32" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding EmployeeProfileImagePath, Converter={StaticResource StringToVisibility}, ConverterParameter=Invert}"/>
</Grid>
<StackPanel Grid.Column="1" VerticalAlignment="Center" MinWidth="0">
<TextBlock Text="Name" FontSize="15" Foreground="{StaticResource MutedTextBrush}" Margin="0,0,0,4"/>
<TextBlock Text="{Binding EmployeeName}" FontSize="22" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}" TextTrimming="CharacterEllipsis" TextWrapping="Wrap"/>
<TextBlock Text="Department type:" FontSize="15" Foreground="{StaticResource MutedTextBrush}" Margin="0,6,0,4"/>
<TextBlock Text="{Binding EmployeeDepartmentType}" FontSize="16" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Grid>
<TextBlock Text="Department:" FontSize="15" Foreground="{StaticResource MutedTextBrush}" Margin="0,0,0,4"/>
<TextBlock Text="{Binding EmployeeDepartment}" FontSize="19" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" Margin="0,0,0,18" TextTrimming="CharacterEllipsis"/>
<TextBlock Text="Employee ID:" FontSize="15" Foreground="{StaticResource MutedTextBrush}" Margin="0,0,0,4"/>
<TextBlock Text="{Binding EmployeeId}" FontSize="19" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" Margin="0,0,0,18" TextTrimming="CharacterEllipsis"/>
<TextBlock Text="Meal" FontSize="15" Foreground="{StaticResource MutedTextBrush}" Margin="0,0,0,4"/>
<TextBlock Text="{Binding EmployeeOrderItem}" FontSize="19" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" TextTrimming="CharacterEllipsis" TextWrapping="Wrap"/>
<!-- Order History card (dashboard green accent) -->
<Border Margin="0,20,0,0" Background="White" BorderBrush="#e2e8f0" BorderThickness="1" CornerRadius="12" Padding="18">
<Border.Effect>
<DropShadowEffect BlurRadius="12" ShadowDepth="0" Opacity="0.08" Color="#000000"/>
</Border.Effect>
<StackPanel>
<TextBlock Text="Order History" FontSize="18" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}"/>
<Border Height="2" Width="32" Background="{StaticResource AccentBrush}" Margin="0,6,0,0" HorizontalAlignment="Left"/>
<TextBlock Text="Showing last 4 orders" FontSize="13" Foreground="{StaticResource MutedTextBrush}" Margin="0,8,0,14"/>
<!-- Header row with divider -->
<Grid Margin="0,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="90"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Employee" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}"/>
<TextBlock Grid.Column="1" Text="Scan ID" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="Meal" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="3" Text="Time" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Right"/>
</Grid>
<Border Height="1" Background="#e2e8f0" Margin="0,8,0,0"/>
<!-- Rows -->
<ItemsControl ItemsSource="{Binding OrderHistory}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Padding="0,12,0,12" BorderBrush="#e2e8f0" BorderThickness="0,0,0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="90"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<Border Width="36" Height="36" Margin="0,0,12,0" CornerRadius="18" Background="{StaticResource AccentLightBrush}" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1">
<TextBlock Text="—" FontSize="14" Foreground="{StaticResource AccentBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{Binding EmployeeId}" FontSize="14" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}" TextTrimming="CharacterEllipsis"/>
<TextBlock Text="{Binding EmployeeName}" FontSize="12" Foreground="{StaticResource MutedTextBrush}" TextTrimming="CharacterEllipsis" Margin="0,1,0,0"/>
</StackPanel>
</StackPanel>
<TextBlock Grid.Column="1"
Text="{Binding ScanId}"
FontSize="13"
Foreground="{StaticResource TitleTextBrush}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis"
MaxWidth="100"/>
<TextBlock Grid.Column="2"
Text="{Binding OrderItem}"
FontSize="13"
Foreground="{StaticResource TitleTextBrush}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap"/>
<StackPanel Grid.Column="3" HorizontalAlignment="Right" VerticalAlignment="Center">
<TextBlock Text="{Binding TimeDisplay}" FontSize="13" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}"/>
<TextBlock Text="{Binding RelativeDateLabel}" FontSize="11" Foreground="{StaticResource MutedTextBrush}" Margin="0,1,0,0"/>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- Empty state -->
<TextBlock Text="No orders yet." FontSize="14" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center" Margin="0,20,0,8">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding OrderHistoryEmpty}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style></TextBlock>
<!-- View All button -->
<Button Command="{Binding OpenOrderHistoryModalCommand}" Margin="0,14,0,0" HorizontalAlignment="Right" Cursor="Hand" FontSize="13" FontWeight="SemiBold" Foreground="White" Background="{StaticResource AccentBrush}" BorderThickness="0" Padding="14,8" MinWidth="100">
<Button.Template>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}" BorderThickness="0" CornerRadius="8" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Button.Template>
<StackPanel Orientation="Horizontal">
<TextBlock Text="View All" Foreground="White"/>
<TextBlock Text=" →" Margin="4,0,0,0" Foreground="White"/>
</StackPanel>
</Button>
</StackPanel>
</Border>
</StackPanel>
</ScrollViewer>
</Border>
<!-- Divider between panels -->
<Border Grid.Column="1" Width="1" Background="#e2e8f0" HorizontalAlignment="Center" MinWidth="0"/>
<!-- Right Panel: Order placement + statistics -->
<Border Grid.Column="2" MinWidth="0" Background="White" CornerRadius="10" Padding="16">
<Grid MinWidth="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Menu button (top-right) -->
<ToggleButton x:Name="MenuToggleButton" Grid.Row="0" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,0,12" IsChecked="{Binding IsMenuOpen, Mode=TwoWay}" Unchecked="MenuToggleButton_Unchecked" Background="#f4f7f7" BorderBrush="#e2e8f0" BorderThickness="1" Padding="14,10" MinWidth="48" MinHeight="44" FontSize="22" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" Focusable="False" IsTabStop="False" ToolTip="Menu" Cursor="Hand">
<ToggleButton.Content></ToggleButton.Content>
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Border x:Name="MenuBtnBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="MenuBtnBorder" Property="Background" Value="#e8eeed"/>
<Setter TargetName="MenuBtnBorder" Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="MenuBtnBorder" Property="Background" Value="#e0e7e6"/>
<Setter TargetName="MenuBtnBorder" Property="BorderBrush" Value="{StaticResource AccentBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ToggleButton.Style>
</ToggleButton>
<!-- Inline menu panel (responsive: wraps; Settings/Logout with consistent sizing) -->
<Border x:Name="MenuPanel" Grid.Row="1" MinWidth="0" Background="#f8fafc" BorderBrush="#e2e8f0" BorderThickness="1" CornerRadius="8" Padding="14" Margin="0,0,0,12" Visibility="{Binding IsMenuOpen, Converter={StaticResource BoolToVisibility}}">
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,2,0,2">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,20,0">
<TextBlock Text="SITE :" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" Margin="0,0,8,0"/>
<TextBox x:Name="SiteNumberTextBox" Text="{Binding SiteNumber, UpdateSourceTrigger=PropertyChanged}" Width="72" MinWidth="56" FontSize="14" Padding="8,8" MinHeight="40" VerticalContentAlignment="Center" PreviewTextInput="SiteNumberTextBox_PreviewTextInput"/>
</StackPanel>
<Button Content="Settings" Command="{Binding OpenSettingsCommand}" Style="{StaticResource SecondaryButtonStyle}" Margin="0,0,10,0" MinWidth="100" MinHeight="44" Padding="16,10" FontSize="14" Focusable="False" IsTabStop="False"/>
<Button Command="{Binding LogoutCommand}" Style="{StaticResource LogoutLinkButtonStyle}" MinWidth="100" MinHeight="44" Padding="16,10" Focusable="False" IsTabStop="False">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="⎋" FontSize="14" Margin="0,0,8,0" VerticalAlignment="Center"/>
<TextBlock Text="Logout" FontSize="14" FontWeight="SemiBold" VerticalAlignment="Center"/>
</StackPanel>
</Button>
</WrapPanel>
</Border>
<!-- Logo + instruction -->
<StackPanel Grid.Row="2" HorizontalAlignment="Center" MinWidth="0">
<Image Source="pack://siteoforigin:,,,/assets/logo4.png" Height="100" MaxWidth="320" Stretch="Uniform" Margin="0,0,0,8"/>
<TextBlock Text="Tap card to place order" FontSize="16" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center" TextAlignment="Center"/>
</StackPanel>
<!-- Scan box + Place Order button -->
<StackPanel Grid.Row="3" Margin="0,16,0,0" MinWidth="0">
<Border MinHeight="50" CornerRadius="8" BorderBrush="{StaticResource AccentBorderBrush}" BorderThickness="2">
<Grid>
<TextBox x:Name="RfidInputTextBox" Text="{Binding CardIdInput, UpdateSourceTrigger=PropertyChanged}" Background="Transparent" BorderThickness="0" FontSize="18" MinHeight="50" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Focusable="True" KeyDown="RfidInputTextBox_OnKeyDown" LostKeyboardFocus="RfidInputTextBox_OnLostKeyboardFocus"/>
<TextBlock Text="Scan..." Foreground="Gray" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Center" TextAlignment="Center" IsHitTestVisible="False" Visibility="{Binding IsWatermarkVisible, Converter={StaticResource BoolToVisibility}}"/>
</Grid>
</Border>
<Button Content="PLACE ORDER" Command="{Binding ScanCommand}" Margin="0,12,0,0" HorizontalAlignment="Stretch" Style="{StaticResource RoundedButtonStyle}"/>
</StackPanel>
<!-- Scanner status + timestamp -->
<StackPanel Grid.Row="4" Margin="0,14,0,0" HorizontalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Style="{StaticResource StatusIconStyle}" Margin="0,0,8,0"/>
<TextBlock Text="{Binding ScannerStatusDisplay}" Style="{StaticResource StatusTextStyle}"/>
</StackPanel>
<TextBlock Text="{Binding CurrentTime}" FontSize="14" Foreground="{StaticResource MutedTextBrush}" Margin="0,6,0,0" HorizontalAlignment="Center"/>
</StackPanel>
<!-- Divider -->
<Border Grid.Row="5" Height="1" Background="#e2e8f0" Margin="0,14,0,14"/>
<!-- Cooldown alert -->
<Border Grid.Row="6" Background="#fef2f2" BorderBrush="#fca5a5" BorderThickness="2" CornerRadius="8" Padding="14" Margin="0,0,0,12" Visibility="{Binding ShowCooldownAlert, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{Binding CooldownAlertMessage}" FontSize="18" FontWeight="Bold" Foreground="{StaticResource ErrorTextBrush}" TextWrapping="Wrap" TextAlignment="Center" HorizontalAlignment="Center"/>
</Border>
<!-- Statistics -->
<Grid Grid.Row="7" MinWidth="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="0,0,0,12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="*" MinWidth="0"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" Background="#f4f7f7" CornerRadius="8" Padding="16" Margin="0,0,6,0">
<StackPanel HorizontalAlignment="Center" MinWidth="0">
<TextBlock Text="{Binding TodaysScans}" FontSize="40" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}" HorizontalAlignment="Center"/>
<TextBlock Text="Today's Customer" FontSize="14" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center" Margin="0,4,0,0" TextWrapping="Wrap" TextAlignment="Center"/>
</StackPanel>
</Border>
<Border Grid.Column="1" Background="#f4f7f7" CornerRadius="8" Padding="16" Margin="6,0,0,0">
<StackPanel HorizontalAlignment="Center" MinWidth="0">
<TextBlock Text="{Binding TotalOrders}" FontSize="40" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}" HorizontalAlignment="Center"/>
<TextBlock Text="Total Orders" FontSize="14" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center" Margin="0,4,0,0" TextWrapping="Wrap" TextAlignment="Center"/>
</StackPanel>
</Border>
</Grid>
<Border Grid.Row="1" BorderBrush="#e2e8f0" BorderThickness="1" CornerRadius="8" Padding="12" Margin="0,0,0,12">
<Grid MinWidth="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="*" MinWidth="0"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Margin="0,0,8,0">
<TextBlock Text="LAST CARD" FontSize="12" Foreground="{StaticResource MutedTextBrush}" FontWeight="SemiBold"/>
<TextBlock Text="{Binding LastCardId}" FontSize="16" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0"/>
</StackPanel>
<StackPanel Grid.Column="1" Margin="8,0,0,0">
<TextBlock Text="LAST ORDER TIME" FontSize="12" Foreground="{StaticResource MutedTextBrush}" FontWeight="SemiBold"/>
<TextBlock Text="{Binding LastScanTimeDisplay}" FontSize="16" FontWeight="SemiBold" Foreground="{StaticResource TitleTextBrush}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0"/>
</StackPanel>
</Grid>
</Border>
<Border Grid.Row="2" Style="{StaticResource StatusBorderStyle}" Visibility="{Binding Message, Converter={StaticResource StringToVisibility}}">
<TextBlock Text="{Binding Message}" FontSize="16" FontWeight="SemiBold" TextWrapping="Wrap">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource SuccessTextBrush}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSuccess}" Value="False">
<Setter Property="Foreground" Value="{StaticResource ErrorTextBrush}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style></TextBlock>
</Border>
</Grid>
</Grid>
</Border>
</Grid>
</Border>
</Grid>
</ScrollViewer>
<!-- Order History modal overlay (ZIndex ensures it appears on top) -->
<Border x:Name="OrderHistoryModalOverlay" Panel.ZIndex="1000" Visibility="{Binding IsOrderHistoryModalOpen, Converter={StaticResource BoolToVisibility}}" Background="#80000000" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MouseLeftButtonDown="OrderHistoryModalOverlay_MouseLeftButtonDown">
<Border x:Name="OrderHistoryModalContent" HorizontalAlignment="Center" VerticalAlignment="Center" MinWidth="480" MaxWidth="720" MaxHeight="640" Background="White" BorderBrush="#e2e8f0" BorderThickness="1" CornerRadius="12" Padding="0" Loaded="OrderHistoryModalContent_Loaded">
<Border.Effect>
<DropShadowEffect BlurRadius="24" ShadowDepth="0" Opacity="0.15" Color="#000000"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*" MinHeight="120"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Title + Download records + Close X -->
<Grid Grid.Row="0" Margin="24,20,16,16">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Text="Today's Order History" FontSize="20" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}" VerticalAlignment="Center"/>
<Button Grid.Column="1" Content="Download records" Command="{Binding DownloadTodayRecordsCommand}" Style="{StaticResource SecondaryButtonStyle}" Margin="0,0,12,0" MinWidth="140" MinHeight="40" Padding="14,8" FontSize="14" ToolTip="Export today's records to CSV (Excel)" Focusable="False" IsTabStop="False"/>
<Button x:Name="OrderHistoryModalCloseXButton" Grid.Column="2" Click="OrderHistoryModalClose_Click" Background="Transparent" BorderThickness="0" Width="32" Height="32" Padding="0" Cursor="Hand" Content="✕" FontSize="16" Foreground="{StaticResource MutedTextBrush}" ToolTip="Close"/>
</Grid>
<!-- Scrollable list -->
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Margin="24,4,24,12" Padding="0,0,4,0">
<StackPanel>
<!-- Header row -->
<Grid Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="90"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="Employee" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}"/>
<TextBlock Grid.Column="1" Text="Scan ID" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="Meal" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="3" Text="Price" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="4" Text="Time" FontSize="12" FontWeight="SemiBold" Foreground="{StaticResource MutedTextBrush}" HorizontalAlignment="Right"/>
</Grid>
<ItemsControl ItemsSource="{Binding TodayOrderHistory}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Padding="0,10,0,10" BorderBrush="#e2e8f0" BorderThickness="0,0,0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" MinWidth="0"/>
<ColumnDefinition Width="110"/>
<ColumnDefinition Width="140"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="90"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<Border Width="36" Height="36" Margin="0,0,10,0" CornerRadius="18" Background="{StaticResource AccentLightBrush}" BorderBrush="{StaticResource AccentBrush}" BorderThickness="1">
<TextBlock Text="—" FontSize="14" Foreground="{StaticResource AccentBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<StackPanel VerticalAlignment="Center">
<TextBlock Text="{Binding EmployeeId}" FontSize="14" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}" TextTrimming="CharacterEllipsis"/>
<TextBlock Text="{Binding EmployeeName}" FontSize="12" Foreground="{StaticResource MutedTextBrush}" TextTrimming="CharacterEllipsis" Margin="0,1,0,0"/>
</StackPanel>
</StackPanel>
<TextBlock Grid.Column="1"
Text="{Binding ScanId}"
FontSize="13"
Foreground="{StaticResource TitleTextBrush}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis"
MaxWidth="110"/>
<TextBlock Grid.Column="2"
Text="{Binding OrderItem}"
FontSize="13"
Foreground="{StaticResource TitleTextBrush}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
TextTrimming="CharacterEllipsis"
MaxWidth="140"/>
<TextBlock Grid.Column="3"
Text="{Binding TotalPrice, StringFormat='Rs. {0:0.##}'}"
FontSize="13"
Foreground="{StaticResource TitleTextBrush}"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
<StackPanel Grid.Column="4" HorizontalAlignment="Right" VerticalAlignment="Center">
<TextBlock Text="{Binding TimeDisplay}" FontSize="13" FontWeight="Bold" Foreground="{StaticResource TitleTextBrush}"/>
<TextBlock Text="{Binding RelativeDateLabel}" FontSize="11" Foreground="{StaticResource MutedTextBrush}" Margin="0,1,0,0"/>
</StackPanel>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
<!-- Close button -->
<Border Grid.Row="2" Padding="24,14,24,22" BorderBrush="#e2e8f0" BorderThickness="0,1,0,0" Background="#f8fafc" CornerRadius="0,0,12,12">
<Button Content="Close" Click="OrderHistoryModalClose_Click" HorizontalAlignment="Center" MinWidth="120" Padding="20,12" FontSize="15" FontWeight="SemiBold" Foreground="White" Background="{StaticResource AccentBrush}" BorderThickness="0" Cursor="Hand"/>
</Border>
</Grid>
</Border>
</Border>
</Grid>
</UserControl>