<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="GMCabsDriverAssistantSolution.Views.UserRegistrationGenerateOtpPage"
             xmlns:vm="clr-namespace:GMCabsDriverAssistantSolution.ViewModels"
             xmlns:custom="clr-namespace:GMCabsDriverAssistantSolution.CustomControls"
             Shell.FlyoutBehavior="Disabled">
    <ContentPage.BindingContext>
        <vm:UserRegistrationGenerateOtpViewModel />
    </ContentPage.BindingContext>
    <ContentPage.Resources>
        <ResourceDictionary>
            <Style x:Key="EntryStyle" TargetType="Entry">
                <Setter Property="TextColor" Value="#000"></Setter>
                <Setter Property="PlaceholderColor" Value="#9999"></Setter>
                <Setter Property="TranslationY"  Value="1" />
                <Setter Property="MinimumHeightRequest" Value="36" />
            </Style>
            <Style x:Key="NoUnderlineEntryFrameStyle" TargetType="Frame">
                <Setter Property="Padding">
                    <OnPlatform x:TypeArguments="Thickness">
                        <On Platform="Android">16,4</On>
                        <On Platform="iOS">16</On>
                    </OnPlatform>
                </Setter>
                <Setter Property="CornerRadius" Value="12"></Setter>
                <Setter Property="HasShadow" Value="True"></Setter>
                <Setter Property="MinimumHeightRequest" Value="50" />
                <Setter Property="BackgroundColor" Value="White" />
            </Style>
        </ResourceDictionary>
    </ContentPage.Resources>
    <ContentPage.Content>
        <StackLayout Padding="16"
                     Orientation="Vertical" 
                     BackgroundColor="#DCDCDC">
            <Label Text="User Registration"
                   HorizontalOptions="CenterAndExpand"
                   FontSize="Title"
                   TextColor="Black"/>
            <Label Text="Enter your mobile number to register"
                   HorizontalOptions="CenterAndExpand"
                   FontSize="Medium"
                   Margin="0,16,0,0"
                   TextColor="Gray"/>
            <Frame Style="{StaticResource NoUnderlineEntryFrameStyle}"
                   Margin="{OnIdiom Phone='0,32,0,0',Tablet='270,0,270,0'}">
                <Grid MinimumHeightRequest="50" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="36"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Image Source="phone_image.png"
                           HeightRequest="36"
                           WidthRequest="36"
                           Aspect="AspectFit"/>
                    <custom:NoUnderlineEntry Grid.Column="1"
                                             x:Name="PhoneNumber"
                                             FontSize="20"
                                             Keyboard="Telephone"
                                             MaxLength="10"
                                             Text="{Binding PhoneNumber}"
                                             Placeholder="Mobile Number"
                                             Style="{StaticResource EntryStyle}"
                                             Margin="0,0,0,-8"/>
                </Grid>
            </Frame>
            <Button Text="REGISTER"
                    FontSize="20"
                    Margin="{OnIdiom Phone='0,32,0,0',Tablet='270,0,270,0'}"
                    VerticalOptions="EndAndExpand"
                    Command="{Binding Register}"/>
            <Label Text="{Binding ErrorMessage}"
                   TextColor="Red"
                   HorizontalTextAlignment="Center"
                   FontSize="20"
                   VerticalOptions="EndAndExpand"/>
            <Button Text="Back"
                    FontSize="20"
                    Margin="{OnIdiom Phone='0,16,0,10',Tablet='270,0,270,0'}"
                    Command="{Binding Back}"/>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>