Utopia-Canteen-System/Views/AdminLoginView.xaml

179 lines
8.5 KiB
XML

<UserControl x:Class="UtopiaCanteenSystem.Views.AdminLoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl.Resources>
<SolidColorBrush x:Key="AccentBrush" Color="#5BA3A0"/>
<SolidColorBrush x:Key="MutedTextBrush" Color="#718096"/>
<SolidColorBrush x:Key="TitleTextBrush" Color="#2D3748"/>
<SolidColorBrush x:Key="ErrorTextBrush" Color="#E53E3E"/>
<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="18"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Padding" Value="24,12"/>
<Setter Property="MinHeight" Value="50"/>
<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="TextInputStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="18"/>
<Setter Property="MinHeight" Value="46"/>
<Setter Property="Padding" Value="14,0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#995BA3A0"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
<Style x:Key="PasswordInputStyle" TargetType="PasswordBox">
<Setter Property="FontSize" Value="18"/>
<Setter Property="MinHeight" Value="46"/>
<Setter Property="Padding" Value="14,0"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#995BA3A0"/>
<Setter Property="Background" Value="Transparent"/>
</Style>
</UserControl.Resources>
<Grid Background="#F0F2F5">
<Viewbox Stretch="Uniform"
HorizontalAlignment="Center"
VerticalAlignment="Center"
MaxWidth="650"
MaxHeight="900">
<Border HorizontalAlignment="Center"
VerticalAlignment="Center"
Padding="40"
MinWidth="450"
MaxWidth="560"
Background="White"
CornerRadius="12">
<Border.Effect>
<DropShadowEffect BlurRadius="24"
ShadowDepth="0"
Opacity="0.08"
Color="#000000"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Grid HorizontalAlignment="Center" Margin="0,0,0,12">
<Image x:Name="LogoImage"
Source="pack://siteoforigin:,,,/assets/logo.png"
Height="190"
MaxWidth="520"
Stretch="Uniform"
HorizontalAlignment="Center"
ImageFailed="LogoImage_OnImageFailed"/>
<!-- Fallback if logo.png is missing -->
<TextBlock x:Name="LogoFallbackText"
Text="Utopia Canteen System"
FontSize="32"
FontWeight="Bold"
Foreground="{StaticResource TitleTextBrush}"
HorizontalAlignment="Center"
Visibility="Collapsed"/>
</Grid>
<TextBlock Text="Admin Login"
FontSize="16"
Foreground="{StaticResource MutedTextBrush}"
HorizontalAlignment="Center"
Margin="0,0,0,24"/>
<TextBlock Text="Username"
FontSize="14"
Foreground="{StaticResource MutedTextBrush}"
FontWeight="SemiBold"
Margin="0,0,0,6"/>
<TextBox x:Name="UsernameTextBox"
Text="{Binding Username, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource TextInputStyle}"
KeyDown="AdminLogin_OnKeyDown"
Margin="0,0,0,16"/>
<TextBlock Text="Password"
FontSize="14"
Foreground="{StaticResource MutedTextBrush}"
FontWeight="SemiBold"
Margin="0,0,0,6"/>
<PasswordBox x:Name="PasswordBox"
Style="{StaticResource PasswordInputStyle}"
PasswordChanged="PasswordBox_OnPasswordChanged"
KeyDown="AdminLogin_OnKeyDown"
Margin="0,0,0,24"/>
<CheckBox Content="Save credentials"
IsChecked="{Binding RememberCredentials}"
Foreground="{StaticResource MutedTextBrush}"
FontSize="14"
FontWeight="SemiBold"
Margin="0,0,0,16"/>
<Button Content="LOGIN"
Command="{Binding AdminLoginCommand}"
Style="{StaticResource RoundedButtonStyle}"/>
<TextBlock Text="{Binding ErrorMessage}"
Foreground="{StaticResource ErrorTextBrush}"
FontSize="14"
FontWeight="SemiBold"
Margin="0,16,0,0"
HorizontalAlignment="Center"
TextAlignment="Center"
TextWrapping="Wrap"/>
</StackPanel>
<!-- Loader overlay -->
<Grid Grid.RowSpan="2"
Background="#80FFFFFF"
Visibility="{Binding IsBusy, Converter={StaticResource BoolToVisibility}}"
IsHitTestVisible="{Binding IsBusy}">
<Border Background="White"
BorderBrush="#e2e8f0"
BorderThickness="1"
CornerRadius="12"
Padding="18"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<StackPanel>
<TextBlock Text="Signing in…"
FontSize="16"
FontWeight="SemiBold"
Foreground="{StaticResource TitleTextBrush}"
HorizontalAlignment="Center"
Margin="0,0,0,10"/>
<ProgressBar Width="220"
Height="6"
IsIndeterminate="True"/>
</StackPanel>
</Border>
</Grid>
</Grid>
</Border>
</Viewbox>
</Grid>
</UserControl>