<?xml version="1.0" encoding="utf-8" ?>
<ContentPage 	xmlns="http://xamarin.com/schemas/2014/forms"
             	xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             	xmlns:app="clr-namespace:inutralia;assembly=inutralia"
                xmlns:artina="clr-namespace:UXDivers.Artina.Shared;assembly=UXDivers.Artina.Shared"
             	x:Class="inutralia.Views.GenericDetailView"
             	x:Name="genericDetailView" 
				Title="{Binding Title}">

    <StackLayout VerticalOptions="FillAndExpand">

        <ActivityIndicator HorizontalOptions="FillAndExpand" IsRunning="{Binding IsBusy}" IsVisible="{Binding IsBusy}" />
        <Label Text="Danos dos segundos estámos cargando tu menú personalizado..."
               VerticalOptions="CenterAndExpand"
               VerticalTextAlignment="Center"
               HorizontalTextAlignment="Center"
               TextColor="{DynamicResource AccentColor}"
               IsVisible="{Binding IsBusy}"/>


        <!-- MAIN CONTAINER -->
        <Grid IsVisible="{Binding IsNotBusy}" ColumnSpacing="0" RowSpacing="10" Padding="20,20,20,20" HorizontalOptions="Fill" VerticalOptions="FillAndExpand">
            <Grid.RowDefinitions>
                <RowDefinition>
                    <RowDefinition.Height>
                        <OnIdiom x:TypeArguments="GridLength"
                                 Phone="50"
                                 Tablet="80"/>
                    </RowDefinition.Height>
                </RowDefinition>

                <RowDefinition Height="*"/>

                <RowDefinition Height="*"/>

                <RowDefinition>
                    <RowDefinition.Height>
                        <OnIdiom x:TypeArguments="GridLength"
                                 Phone="50"
                                 Tablet="80"/>
                    </RowDefinition.Height>
                </RowDefinition>
            </Grid.RowDefinitions>

            <!-- Botones de acceso a cada día, se crean directamente en el código al crear la página -->
            <Grid x:Name="buttonList" HorizontalOptions="Fill" VerticalOptions="Fill" ColumnSpacing="0" Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
            </Grid>

            <!-- El menú del día seleccionado -->

            <!--***************************** COMIDA ******************************-->
            <Frame Grid.Row="1" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Padding="0,0,0,14">

                <Grid RowSpacing="10" ColumnSpacing="10" VerticalOptions="FillAndExpand">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

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

                    <!-- Titulo Comida -->
                    <Label Text="COMIDA" 
                       Grid.Row="0" 
                       Grid.Column="0"
                       Grid.ColumnSpan="3"
                       HorizontalTextAlignment="Center"
                       HorizontalOptions="FillAndExpand"
                       VerticalOptions="CenterAndExpand"
                       VerticalTextAlignment="Center"
                       TextColor="#ffffffff"
                       BackgroundColor="{DynamicResource ComplementColor}">

                        <Label.HeightRequest>
                            <OnIdiom x:TypeArguments="x:Double">
                                <OnIdiom.Phone>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="30"
                                        Android="30"/>
                                </OnIdiom.Phone>

                                <OnIdiom.Tablet>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="60"
                                        Android="60"/>
                                </OnIdiom.Tablet>
                            </OnIdiom>
                        </Label.HeightRequest>

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double">
                                <OnIdiom.Phone>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="18"
                                        Android="18"/>
                                </OnIdiom.Phone>

                                <OnIdiom.Tablet>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="27"
                                        Android="27"/>
                                </OnIdiom.Tablet>
                            </OnIdiom>
                        </Label.FontSize>
                    </Label>

                    <!-- Primero Comida -->

                    <Label
                  Text="1º"
                  Grid.Row="1"
                  Grid.Column="0"
                  VerticalOptions="Center"
                  HorizontalOptions="Start"
                  Margin="10,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="23"
                               Tablet="40"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                       Command="{Binding ShowRecipeCommand}"
                       CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
                       NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label Text="{Binding CurrentDay.LunchFirst[0].Name}"
                   Grid.Row="1"
                   Grid.Column="1"
                   VerticalOptions="Center"
                   HorizontalOptions="Center"
                   Margin="5,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="17"
                               Tablet="36"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                       Command="{Binding ShowRecipeCommand}"
                       CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
                       NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label
                  Text="{ x:Static app:IoniciconsFont.Search }"
                  Style="{StaticResource FontIcon}"
                  Grid.Row="1"
                  Grid.Column="2"
                  HorizontalOptions="End"
                  VerticalOptions="Center"
                  Margin="5,0,10,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="30"
                               Tablet="50"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                       Command="{Binding ShowRecipeCommand}"
                       CommandParameter="{Binding CurrentDay.LunchFirst[0]}"
                       NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>


                    <!-- Segundo Comida -->

                    <Label Text="2º"
                       Grid.Row="2"
                       Grid.Column="0"
                       VerticalOptions="Center"
                       HorizontalOptions="Start"
                       Margin="10,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="23"
                               Tablet="40"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                      Command="{Binding ShowRecipeCommand}"
                      CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
                      NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label Text="{Binding CurrentDay.LunchSecond[0].Name}"
                       Grid.Row="2"
                       Grid.Column="1"
                       VerticalOptions="Center"
                       HorizontalOptions="Center"
                       Margin="5,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="17"
                               Tablet="36"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                    Command="{Binding ShowRecipeCommand}"
                    CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
                    NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label Text="{ x:Static app:IoniciconsFont.Search }"
                   Style="{StaticResource FontIcon}"
                   Grid.Row="2"
                   Grid.Column="2"
                   HorizontalOptions="End"
                   VerticalOptions="Center"
                   Margin="5,0,10,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="30"
                               Tablet="50"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                    Command="{Binding ShowRecipeCommand}"
                    CommandParameter="{Binding CurrentDay.LunchSecond[0]}"
                    NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>
                </Grid>
            </Frame>

            <!--***************************** FIN COMIDA ******************************-->

            <!--******************************** CENA *********************************-->

            <!-- RECUADRO FRAME -->

            <Frame Grid.Row="2" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Padding="0,0,0,14">

                <Grid RowSpacing="10" ColumnSpacing="10" VerticalOptions="FillAndExpand" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <!-- Título Cena -->

                    <Label Text="CENA" 
                       Grid.Row="0" 
                       Grid.Column="0"
                       Grid.ColumnSpan="3"
                       HorizontalTextAlignment="Center"
                       VerticalOptions="CenterAndExpand"
                       VerticalTextAlignment="Center"
                       TextColor="#ffffffff"
                       BackgroundColor="{DynamicResource ComplementColor}">

                        <Label.HeightRequest>
                            <OnIdiom x:TypeArguments="x:Double">
                                <OnIdiom.Phone>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="30"
                                        Android="30"/>
                                </OnIdiom.Phone>

                                <OnIdiom.Tablet>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="60"
                                        Android="60"/>
                                </OnIdiom.Tablet>
                            </OnIdiom>
                        </Label.HeightRequest>

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double">
                                <OnIdiom.Phone>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="18"
                                        Android="18"/>
                                </OnIdiom.Phone>

                                <OnIdiom.Tablet>
                                    <OnPlatform x:TypeArguments="x:Double" 
                                        iOS="27"
                                        Android="27"/>
                                </OnIdiom.Tablet>
                            </OnIdiom>
                        </Label.FontSize>
                    </Label>

                    <!-- Primero Cena -->

                    <Label
                  Text="1º"
                  Grid.Row="1"
                  Grid.Column="0"
                  VerticalOptions="Center"
                  HorizontalOptions="Start"
                  Margin="10,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="23"
                               Tablet="40"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                        Command="{Binding ShowRecipeCommand}"
                        CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
                        NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label
                  Text="{Binding CurrentDay.DinnerFirst[0].Name}"
                  Grid.Row="1"
                  Grid.Column="1"
                  VerticalOptions="Center"
                  HorizontalOptions="Center"
                  Margin="5,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="17"
                               Tablet="36"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                        Command="{Binding ShowRecipeCommand}"
                        CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
                        NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label
                  Text="{ x:Static app:IoniciconsFont.Search }"
                  Style="{StaticResource FontIcon}"
                  Grid.Row="1"
                  Grid.Column="2"
                  HorizontalOptions="End"
                  VerticalOptions="Center"
                  Margin="5,0,10,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="30"
                               Tablet="50"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                        Command="{Binding ShowRecipeCommand}"
                        CommandParameter="{Binding CurrentDay.DinnerFirst[0]}"
                        NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <!-- Segundo Cena -->

                    <Label Text="2º"
                   Grid.Row="2"
                   Grid.Column="0"
                   VerticalOptions="Center"
                   HorizontalOptions="Start"
                   Margin="10,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="23"
                               Tablet="40"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                       Command="{Binding ShowRecipeCommand}"
                      CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
                      NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label Text="{Binding CurrentDay.DinnerSecond[0].Name}"
                   Grid.Row="2"
                   Grid.Column="1"
                   VerticalOptions="Center"
                   HorizontalOptions="Center"
                   Margin="5,0,0,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="17"
                               Tablet="36"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                      Command="{Binding ShowRecipeCommand}"
                      CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
                      NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>

                    <Label Text="{ x:Static app:IoniciconsFont.Search }"
                   Style="{StaticResource FontIcon}"
                   Grid.Row="2"
                   Grid.Column="2"
                   HorizontalOptions="End"
                   VerticalOptions="Center"
                   Margin="5,0,10,0">

                        <Label.FontSize>
                            <OnIdiom x:TypeArguments="x:Double"
                               Phone="30"
                               Tablet="50"/>
                        </Label.FontSize>

                        <Label.GestureRecognizers>
                            <TapGestureRecognizer
                        Command="{Binding ShowRecipeCommand}"
                        CommandParameter="{Binding CurrentDay.DinnerSecond[0]}"
                        NumberOfTapsRequired="1" />
                        </Label.GestureRecognizers>
                    </Label>
                </Grid>
            </Frame>

            <!--******************************** FIN CENA *********************************-->

            <!-- Recomendaciones genéricas -->
            <artina:Button	Command="{Binding ShowRecomendationCommand}"
							Style="{DynamicResource PrimaryActionButtonStyle}"
							Grid.Row = "3"
							Text="RESTO   DEL   DIA"
                            VerticalOptions="FillAndExpand"
                            HeightRequest="{artina:OnOrientationDouble
						                    LandscapePhone=20,
						                    LandscapeTablet=30 }"
                            HorizontalOptions="FillAndExpand"
                            FontSize="{artina:OnOrientationDouble 
                                       PortraitPhone=18,
                                       LandscapePhone=18,
                                       PortraitTablet=30,
                                       LandscapeTablet=30 }"/>

        </Grid>
    </StackLayout>
</ContentPage>