<?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.LoginView"
	xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
	xmlns:local="clr-namespace:inutralia;assembly=inutralia"
	Title="Acceso a la Aplicación ..."
    NavigationPage.HasNavigationBar="False"
	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" />
                        </Grid>

                        <!-- WELCOME TEXT -->
                        <Label Text="{ StaticResource LoginWelcomeText }"
							   FontSize="{ artina:OnOrientationDouble
								        PortraitPhone=22,
								        LandscapePhone=22,
								        PortraitTablet=28,
								        LandscapeTablet=28 }"
							   HorizontalTextAlignment="Center"
							   TextColor="{ DynamicResource BaseTextColor }"/>

                        <Label Text="Por favor, ingrese usuario y password"
							   HorizontalTextAlignment="Center"
							   FontSize="{ artina:OnOrientationDouble
								        PortraitPhone=15,
								        LandscapePhone=15,
								        PortraitTablet=18,
								        LandscapeTablet=18 }"/>

                        <!--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="*" />
                        </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 = "userEntry" 
							   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 }"/>
                    </Grid>

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

                        <!-- LOGIN -->
                        <artina:Button	x:Name="loginButton"
							            Clicked="OnLoginButtonClicked"
							            Style="{DynamicResource PrimaryActionButtonStyle}"
							            VerticalOptions="End"
							            Text="Login"
							            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>
