<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="FrymasterBadgeApp.EmployeeFormPage"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    Title="Employee Editor">
    <ScrollView>
        <VerticalStackLayout Padding="0" Spacing="0">

            <Grid
                Padding="20,30"
                BackgroundColor="{AppThemeBinding Light={StaticResource Gray100}, Dark={StaticResource Tertiary}}"
                ColumnDefinitions="*, Auto">
                <VerticalStackLayout Grid.Column="0" Spacing="5">
                    <Label
                        x:Name="TitleLabel"
                        FontAttributes="Bold"
                        FontSize="28"
                        Text="Employee Details" />
                    <Label
                        FontSize="14"
                        Text="Manage badge information and photo"
                        TextColor="{StaticResource Gray500}" />
                </VerticalStackLayout>
                <Button
                    Grid.Column="1"
                    BackgroundColor="Transparent"
                    Clicked="OnCancelClicked"
                    FontSize="20"
                    Text="X"
                    TextColor="{StaticResource Gray500}" />
            </Grid>

            <VerticalStackLayout Padding="30" Spacing="25">
                <Grid ColumnDefinitions="*, *" ColumnSpacing="40">

                    <VerticalStackLayout Grid.Column="0" Spacing="18">

                        <VerticalStackLayout Spacing="5">
                            <Label
                                FontAttributes="Bold"
                                FontSize="12"
                                Text="Record Number"
                                TextColor="{StaticResource Primary}" />
                            <Entry x:Name="Data1Entry" Placeholder="ID Number" />
                        </VerticalStackLayout>

                        <VerticalStackLayout Spacing="5">
                            <Label
                                FontAttributes="Bold"
                                FontSize="12"
                                Text="Full Name"
                                TextColor="{StaticResource Primary}" />
                            <Entry x:Name="Data2Entry" Placeholder="Required" />
                        </VerticalStackLayout>

                        <Grid ColumnDefinitions="*, *" ColumnSpacing="15">
                            <VerticalStackLayout Grid.Column="0" Spacing="5">
                                <Label FontSize="12" Text="Preferred Name" />
                                <Entry x:Name="Data3Entry" />
                            </VerticalStackLayout>
                            <VerticalStackLayout Grid.Column="1" Spacing="5">
                                <Label FontSize="12" Text="Last Name" />
                                <Entry x:Name="LastNameEntry" />
                            </VerticalStackLayout>
                        </Grid>

                        <VerticalStackLayout Spacing="5">
                            <Label FontSize="12" Text="Job Title" />
                            <Entry x:Name="Data4Entry" />
                        </VerticalStackLayout>

                        <Grid ColumnDefinitions="*, *" ColumnSpacing="15">
                            <VerticalStackLayout Grid.Column="0" Spacing="5">
                                <Label FontSize="12" Text="Issue Date" />
                                <DatePicker x:Name="Data5DatePicker" />
                            </VerticalStackLayout>
                            <VerticalStackLayout Grid.Column="1" Spacing="5">
                                <Label FontSize="12" Text="Badge Barcode" />
                                <Grid ColumnDefinitions="*, Auto">
                                    <Entry
                                        x:Name="Data9Entry"
                                        FontSize="11"
                                        IsReadOnly="True" />
                                    <Button
                                        x:Name="BadgeFetchButton"
                                        Grid.Column="1"
                                        Padding="10,0"
                                        BackgroundColor="{StaticResource Secondary}"
                                        Clicked="OnFetchBadgeClicked"
                                        Text="🔄" />
                                </Grid>
                            </VerticalStackLayout>
                        </Grid>

                        <Frame Style="{StaticResource CardFrame}">
                            <HorizontalStackLayout HorizontalOptions="Center" Spacing="20">
                                <HorizontalStackLayout Spacing="5">
                                    <CheckBox x:Name="MedicalCheckBox" Color="DodgerBlue" />
                                    <Label Text="Medical" VerticalOptions="Center" />
                                </HorizontalStackLayout>
                                <HorizontalStackLayout Spacing="5">
                                    <CheckBox x:Name="EmsCheckBox" Color="Red" />
                                    <Label Text="EMS" VerticalOptions="Center" />
                                </HorizontalStackLayout>
                                <HorizontalStackLayout Spacing="5">
                                    <CheckBox x:Name="ActiveCheckBox" Color="{StaticResource Primary}" />
                                    <Label Text="Active" VerticalOptions="Center" />
                                </HorizontalStackLayout>
                            </HorizontalStackLayout>
                        </Frame>
                    </VerticalStackLayout>

                    <VerticalStackLayout Grid.Column="1" HorizontalOptions="Center" Spacing="20">
                        <Frame
                            Padding="0"
                            BackgroundColor="Black"
                            BorderColor="{StaticResource Primary}"
                            CornerRadius="140"
                            HeightRequest="280"
                            IsClippedToBounds="True"
                            WidthRequest="280">
                            <Image x:Name="EditorPhotoPreview" Aspect="AspectFill">
                                <Image.GestureRecognizers>
                                    <PanGestureRecognizer PanUpdated="OnPanUpdated" />
                                </Image.GestureRecognizers>
                            </Image>
                        </Frame>

                        <VerticalStackLayout Spacing="10" WidthRequest="280">
                            <Label
                                FontSize="12"
                                HorizontalOptions="Center"
                                Text="Zoom Control" />
                            <Slider
                                x:Name="ZoomSlider"
                                Maximum="4"
                                Minimum="1"
                                MinimumTrackColor="{StaticResource Primary}"
                                Value="1" />
                            <Button
                                BackgroundColor="{StaticResource Primary}"
                                Clicked="OnTakePhotoClicked"
                                CornerRadius="20"
                                HeightRequest="45"
                                Text="Take New Photo"
                                TextColor="White" />
                        </VerticalStackLayout>
                    </VerticalStackLayout>
                </Grid>

                <BoxView Margin="0,10" HeightRequest="1" Color="{StaticResource Gray500}" />

                <HorizontalStackLayout HorizontalOptions="End" Spacing="15">
                    <Button
                        BackgroundColor="Transparent"
                        Clicked="OnCancelClicked"
                        Text="Cancel"
                        TextColor="{DynamicResource AppTextColor}"
                        WidthRequest="100" />
                    <Button
                        x:Name="SaveButton"
                        BackgroundColor="{StaticResource Primary}"
                        Clicked="OnSaveClicked"
                        CornerRadius="5"
                        FontAttributes="Bold"
                        Text="Save Changes"
                        TextColor="White"
                        WidthRequest="200" />
                </HorizontalStackLayout>
            </VerticalStackLayout>
        </VerticalStackLayout>
    </ScrollView>
</ContentPage>