<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="CafeTerrace.Views.LoginPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:forms="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
    xmlns:prism="http://prismlibrary.com"
    prism:ViewModelLocator.AutowireViewModel="True"
    FlowDirection="RightToLeft"
    NavigationPage.HasNavigationBar="False">
    <Grid>
        <ScrollView>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="300" />
                </Grid.RowDefinitions>
                <forms:CachedImage
                    Margin="-15"
                    Aspect="AspectFill"
                    Source="splashLogo.jpg" />

                <Frame
                    x:Name="loginFrame"
                    Grid.Row="1"
                    Margin="0,0,0,-15"
                    Padding="15"
                    BackgroundColor="{StaticResource PrimaryColor}"
                    CornerRadius="15"
                    HeightRequest="350">
                    <Grid VerticalOptions="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Entry
                            x:Name="phoneLoginEntry"
                            Completed="PhoneLoginEntry_OnCompleted"
                            FontSize="13"
                            HorizontalTextAlignment="Start"
                            Keyboard="Numeric"
                            Placeholder="شماره تلفن"
                            ReturnType="Next"
                            Text="{Binding Path=SignUpUser.Phone, Mode=TwoWay}" />
                        <Entry
                            x:Name="passwordLoginEntry"
                            Grid.Row="1"
                            Margin="0,15,0,15"
                            FontSize="13"
                            HorizontalTextAlignment="End"
                            IsPassword="True"
                            Keyboard="Numeric"
                            Placeholder="رمز عبور"
                            ReturnType="Done"
                            Text="{Binding Path=SignUpUser.Password, Mode=TwoWay}" />
                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Button
                                Padding="40,0"
                                BackgroundColor="Accent"
                                Command="{Binding LoginButtonCommand}"
                                CornerRadius="25"
                                HeightRequest="40"
                                Text="ورود"
                                TextColor="White"
                                WidthRequest="150" />
                        </Grid>
                        <StackLayout
                            Grid.Row="3"
                            Margin="0,15"
                            HorizontalOptions="Center"
                            Orientation="Horizontal">
                            <Label Text="حساب کاربری ندارید ؟" VerticalOptions="Center" />
                            <Button
                                BackgroundColor="Transparent"
                                Clicked="SignUpButton_OnClicked"
                                CornerRadius="25"
                                HeightRequest="40"
                                HorizontalOptions="End"
                                Text="ثبت نام"
                                TextColor="Accent" />
                        </StackLayout>
                    </Grid>
                </Frame>
                <Frame
                    x:Name="signUpFrame"
                    Grid.Row="1"
                    Margin="0,0,0,0"
                    Padding="15"
                    BackgroundColor="{StaticResource PrimaryColor}"
                    CornerRadius="15"
                    HeightRequest="350"
                    VerticalOptions="End">

                    <Grid VerticalOptions="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <StackLayout Grid.Row="0">

                            <Entry
                                x:Name="phoneEntry"
                                Completed="PhoneEntry_OnCompleted"
                                FontSize="13"
                                Keyboard="Numeric"
                                Placeholder="شماره همراه"
                                ReturnType="Next"
                                Text="{Binding Path=SignUpUser.Phone, Mode=TwoWay}" />
                            <Entry
                                x:Name="nameEntry"
                                Completed="NameEntry_OnCompleted"
                                FontSize="13"
                                Placeholder="نام "
                                ReturnType="Next"
                                Text="{Binding Path=SignUpUser.FirstName, Mode=TwoWay}" />
                            <Entry
                                x:Name="familyEntry"
                                Completed="FamilyEntry_OnCompleted"
                                FontSize="13"
                                Placeholder=" نام خانوادگی"
                                ReturnType="Next"
                                Text="{Binding Path=SignUpUser.LastName, Mode=TwoWay}" />
                            <!--<Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Label
                                    Margin="0,0,4,-3"
                                    Text="جنسیت"
                                    VerticalOptions="Center" />
                                <Picker
                                    Grid.Column="1"
                                    FontSize="13"
                                    SelectedItem="{Binding Gender, Mode=TwoWay}">
                                    <Picker.Items>
                                        <x:String>مرد</x:String>
                                        <x:String>زن</x:String>
                                    </Picker.Items>
                                </Picker>
                            </Grid>

                            <Entry
                                x:Name="birthDayEntry"
                                Focused="BirthDayEntry_OnFocused"
                                FontSize="13"
                                Placeholder="تاریخ تولد"
                                Text="{Binding Path=SignUpUser.BirthDateString, Mode=TwoWay}" />-->
                            <Entry
                                x:Name="passwordEntry"
                                Completed="PasswordEntry_OnCompleted"
                                FontSize="13"
                                HorizontalTextAlignment="End"
                                IsPassword="True"
                                Keyboard="Numeric"
                                Placeholder="رمز عبور"
                                ReturnType="Done"
                                Text="{Binding Path=SignUpUser.Password, Mode=TwoWay}" />
                        </StackLayout>
                        <Grid Grid.Row="2">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Button
                                Padding="40,0"
                                BackgroundColor="Accent"
                                Command="{Binding SignUpButtonCommand}"
                                CornerRadius="25"
                                HeightRequest="40"
                                Text="ثبت نام"
                                TextColor="White" />
                            <Button
                                Grid.Column="1"
                                BackgroundColor="Transparent"
                                Clicked="LoginButton_OnClicked"
                                CornerRadius="25"
                                HeightRequest="40"
                                HorizontalOptions="End"
                                Text="ورود"
                                TextColor="Accent" />
                        </Grid>
                    </Grid>
                </Frame>
            </Grid>
        </ScrollView>
    </Grid>
</ContentPage>