<?xml version="1.0" encoding="UTF-8"?>
<ContentPage 
	xmlns="http://xamarin.com/schemas/2014/forms" 
	xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
	x:Class="inutralia.Views.RegisterView"
	xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
	xmlns:local="clr-namespace:inutralia;assembly=inutralia"
	Title="Registro en la aplicación ..."
	BackgroundColor="{DynamicResource BasePageColor}">

    <ContentPage.Content>
        <AbsoluteLayout>

            <!-- GRADIENT-->
            <Image AbsoluteLayout.LayoutBounds="0,0,1,44" AbsoluteLayout.LayoutFlags="WidthProportional" Style="{ StaticResource StatusBarShimStyle }" VerticalOptions="Start"/>

            <ScrollView AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" VerticalOptions="FillAndExpand" Padding="{ DynamicResource MainWrapperPadding }">

                <!-- MAIN CONTAINER -->
                <Grid ColumnSpacing="0" RowSpacing="0" Padding="20,30,20,10" HorizontalOptions="Fill" VerticalOptions="FillAndExpand" >

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <!-- HEADER -->
                    <StackLayout Grid.Row="0" Spacing="5" Padding="0,20,0,0" InputTransparent="true">

                        <!-- LOGO -->
                        <Grid Grid.Row="1" WidthRequest="150" VerticalOptions="Center" HorizontalOptions="Center">
                            <Image Source="logo_empresa.png" WidthRequest="150"></Image>
                        </Grid>

                        <!--SEPARATOR-->
                        <BoxView WidthRequest="80" HeightRequest="1" HorizontalOptions="Center"	VerticalOptions="End" BackgroundColor="{DynamicResource BaseTextColor}"/>
                    </StackLayout>

                    <!---FIELDS CONTAINER-->
                    <Grid Grid.Row="1" RowSpacing="30" Padding="0,20,0,20" VerticalOptions="Center">

                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>

                        <!-- ICON BACKGROUND -->
                        <Label Grid.Column="0"
                               Grid.Row="0"
							   FontSize="40"
							   Style="{StaticResource RoundShape}" 
						       HorizontalTextAlignment="Center"
							   TextColor="{DynamicResource ComplementColor}"
							   VerticalOptions="Center"
						       HorizontalOptions="Center"/>

                        <!-- ICON -->
                        <Label Grid.Column="0"
							   Grid.Row="0"
							   FontSize="14"
							   Text="{ x:Static local:GrialShapesFont.Email }" 
							   Style="{StaticResource FontIconBase}"
							   HorizontalTextAlignment="Center"
							   TextColor="White"
							   VerticalOptions="Center"
							   HorizontalOptions="Center"/>

                        <!--EMAIL FIELD-->
                        <Entry Grid.Column="1"
							   Grid.Row="0"
							   HeightRequest="40"
							   x:Name = "userNameEntry" 
							   Placeholder="Usuario" 
							   BackgroundColor="{ DynamicResource PlaceholderColorEntry }"
							   PlaceholderColor="{ DynamicResource BaseTextColor }"/>

                        <!-- ICON BACKGROUND -->
                        <Label Grid.Column="0"
							   Grid.Row="1"
							   FontSize="40"
							   Style="{StaticResource RoundShape}" 
							   HorizontalTextAlignment="Center"
							   TextColor="{DynamicResource ComplementColor}"
							   VerticalOptions="Center"
						       HorizontalOptions="Center"/>

                        <!-- ICON -->
                        <Label Grid.Column="0"
							   Grid.Row="1"
							   FontSize="14"
							   Text="{ x:Static local:GrialShapesFont.Lock }" 
							   Style="{StaticResource FontIconBase}"
							   HorizontalTextAlignment="Center"
							   TextColor="White"
							   VerticalOptions="Center"
							   HorizontalOptions="Center" />

                        <!-- PASSWORD ENTRY -->
                        <Entry Grid.Column="1"
							   Grid.Row="1"
							   HeightRequest="40"
							   x:Name = "passWordEntry" 
							   Placeholder="Contraseña"
							   IsPassword="True"
							   BackgroundColor="{ DynamicResource PlaceholderColorEntry }"
							   PlaceholderColor="{ DynamicResource BaseTextColor }" />

                        <!-- ICON BACKGROUND -->
                        <Label Grid.Column="0"
							   Grid.Row="2"
							   FontSize="40"
							   Style="{StaticResource RoundShape}" 
							   HorizontalTextAlignment="Center"
							   TextColor="{DynamicResource ComplementColor}"
							   VerticalOptions="Center"
						       HorizontalOptions="Center" />

                        <!-- ICON -->
                        <Label Grid.Column="0"
							   Grid.Row="2"
							   FontSize="14"
							   Text="{ x:Static local:GrialShapesFont.Star }" 
							   Style="{StaticResource FontIconBase}"
							   HorizontalTextAlignment="Center"
							   TextColor="White"
							   VerticalOptions="Center"
							   HorizontalOptions="Center"/>

                        <!-- PASSWORD ENTRY -->
                        <Entry Grid.Column="1"
							   Grid.Row="2"
							   HeightRequest="40"
							   x:Name = "companyCodeEntry" 
							   Placeholder="Código de Descarga"
							   IsPassword="True"
							   BackgroundColor="{ DynamicResource PlaceholderColorEntry }"
							   PlaceholderColor="{ DynamicResource BaseTextColor }"/>
                    </Grid>

                    <!-- BUTTONS -->
                    <StackLayout Grid.Row="2" Spacing="10" Padding="0,10,0,0" HorizontalOptions="FillAndExpand" VerticalOptions="End" >

                        <StackLayout Orientation="Horizontal" IsVisible="False">
                            <Switch x:Name="ConditionsSwitch" Toggled="ConditionsSwitch_Toggled" />

                            <Label Text="Confirmo haber leído y aceptado la política de privacidad y las condiciones de uso">
                                <Label.GestureRecognizers>
                                    <TapGestureRecognizer Tapped="ConditionsLabelTapped"
                                                          NumberOfTapsRequired="1" />
                                </Label.GestureRecognizers>
                            </Label>
                        </StackLayout>

                        <!-- LOGIN -->
                        <artina:Button	x:Name="RegisterButton"
							            Clicked="OnRegisterButtonClicked"
							            Style="{DynamicResource PrimaryActionButtonStyle}"
							            VerticalOptions="End"
							            Text="Registrar"
							            WidthRequest="{ artina:OnOrientationDouble
							                        LandscapePhone=200,
							                        LandscapeTablet=400 }"
							            HorizontalOptions="{ artina:OnOrientationLayoutOptions
							                        PortraitPhone=Fill,
							                        LandscapePhone=Center,
							                        PortraitTablet=Fill,
							                        LandscapeTablet=Center }"/>

                        <!-- Volver -->
                        <artina:Button Style="{ DynamicResource PrimaryActionButtonStyle }"
							           BackgroundColor="#3b5998"
							           VerticalOptions="End"
							           x:Name="backButton" 
							           Text = "Volver al Login" 
							           Clicked="OnBackButtonClicked" 
							           WidthRequest="{ artina:OnOrientationDouble
								                    LandscapePhone=200,
								                    LandscapeTablet=400 }"
							           HorizontalOptions="{ artina:OnOrientationLayoutOptions
								                    PortraitPhone=Fill,
								                    LandscapePhone=Center,
								                    PortraitTablet=Fill,
								                    LandscapeTablet=Center }"/>

                        <!--SEPARATOR-->
                        <BoxView Grid.Row="4" 
							     HeightRequest="1"
							     VerticalOptions="Start"
							     HorizontalOptions="Center"
							     WidthRequest="300"
							     BackgroundColor="{DynamicResource BaseTextColor}"/>

                    </StackLayout>
                </Grid>
            </ScrollView>
        </AbsoluteLayout>
    </ContentPage.Content>
</ContentPage>
