<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="CafeTerrace.Views.HomePage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:bottomSheet="clr-namespace:BottomSheet.Core;assembly=BottomSheetXF"
    xmlns:controller="clr-namespace:CafeTerrace.Views.Controller;assembly=CafeTerrace"
    xmlns:coolBottomSheet="clr-namespace:CoolBottomSheet;assembly=CoolBottomSheet"
    xmlns:forms="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
    xmlns:implementations="clr-namespace:BottomSheetXF.Implementations;assembly=BottomSheetXF"
    xmlns:model="clr-namespace:CafeTerrace.Models"
    xmlns:prism="http://prismlibrary.com"
    xmlns:transformations="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations"
    prism:ViewModelLocator.AutowireViewModel="True"
    BackgroundColor="{StaticResource Gray-200}"
    FlowDirection="RightToLeft"
    NavigationPage.HasNavigationBar="False">
    <Grid>
        <Grid Margin="0,0,0,0">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="3*" />
                    <RowDefinition Height="6*" />
                </Grid.RowDefinitions>
                <StackLayout BackgroundColor="{StaticResource PrimaryColor}" />
            </Grid>
            <Grid Margin="15,50,15,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="45" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Button
                        Grid.Column="2"
                        Padding="0"
                        BackgroundColor="White"
                        Command="{Binding ProfileButtonCommand}"
                        CornerRadius="25"
                        FontFamily="{StaticResource MaterialFontFamily}"
                        FontSize="26"
                        HeightRequest="45"
                        Text="{x:Static model:MaterialIconFont.AccountOutline}"
                        TextColor="{StaticResource Gray-700}"
                        WidthRequest="45" />
                    <controller:BuyBagButton Grid.Column="1">
                        <controller:BuyBagButton.GestureRecognizers>
                            <TapGestureRecognizer Tapped="BuyBag_OnTapped" />
                        </controller:BuyBagButton.GestureRecognizers>
                    </controller:BuyBagButton>
                    <Label
                        FontFamily="{StaticResource ShabnameBold}"
                        FontSize="20"
                        Text="کافه رستــوران طلایی"
                        TextColor="Accent"
                        VerticalOptions="Center" />

                </Grid>
                <!--#region TopSlider-->
                <StackLayout Grid.Row="1" Margin="-15,30,-15,10">
                    <ScrollView HorizontalScrollBarVisibility="Never" Orientation="Horizontal">

                        <StackLayout
                            Margin="0,8"
                            HeightRequest="230"
                            HorizontalOptions="Center"
                            Orientation="Horizontal"
                            Spacing="10">
                            <BindableLayout.ItemsSource>
                                <x:Array Type="{x:Type x:String}">
                                    <x:String>amir</x:String>
                                    <x:String>amir</x:String>
                                    <x:String>amir</x:String>
                                </x:Array>
                            </BindableLayout.ItemsSource>
                            <BindableLayout.ItemTemplate>
                                <DataTemplate>
                                    <Grid HorizontalOptions="Center">
                                        <forms:CachedImage
                                            Aspect="Fill"
                                            HeightRequest="180"
                                            Source="https://image.freepik.com/free-photo/mixed-pizza-with-olive-bell-pepper-tomato_140725-183.jpg"
                                            VerticalOptions="Start"
                                            WidthRequest="230">
                                            <forms:CachedImage.Transformations>
                                                <transformations:RoundedTransformation
                                                    CropHeightRatio="180"
                                                    CropWidthRatio="220"
                                                    Radius="35" />
                                            </forms:CachedImage.Transformations>
                                            <forms:CachedImage.GestureRecognizers>
                                                <TapGestureRecognizer Tapped="FoodItem_OnTapped" />
                                            </forms:CachedImage.GestureRecognizers>
                                        </forms:CachedImage>
                                        <Frame
                                            Margin="4"
                                            Padding="5"
                                            CornerRadius="8"
                                            HasShadow="True"
                                            HorizontalOptions="Center"
                                            VerticalOptions="End"
                                            WidthRequest="260">
                                            <Grid>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                </Grid.RowDefinitions>
                                                <Grid>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="*" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
                                                    <Label
                                                        Margin="8,8,8,0"
                                                        FontFamily="{StaticResource ShabnameBold}"
                                                        FontSize="16"
                                                        Text="پیـــــتزا الفردو"
                                                        VerticalOptions="Center" />
                                                    <StackLayout
                                                        Grid.Column="1"
                                                        Margin="8,8,8,0"
                                                        Orientation="Horizontal">
                                                        <Label
                                                            FontFamily="{StaticResource ShabnameBold}"
                                                            FontSize="18"
                                                            Text="20,000"
                                                            TextColor="{StaticResource Orange}" />
                                                        <Label
                                                            FontFamily="{StaticResource Shabname}"
                                                            FontSize="14"
                                                            Text="تومان"
                                                            TextColor="{StaticResource Orange}"
                                                            VerticalOptions="Center" />
                                                    </StackLayout>
                                                </Grid>
                                                <!--<CollectionView
                                                Grid.Row="1"
                                                FlowDirection="LeftToRight"
                                                HeightRequest="20"
                                                HorizontalOptions="Start">
                                                <CollectionView.ItemsLayout>
                                                    <LinearItemsLayout
                                                        ItemSpacing="2"
                                                        Orientation="Horizontal"
                                                        SnapPointsAlignment="Start" />
                                                </CollectionView.ItemsLayout>
                                                <CollectionView.ItemsSource>
                                                    <x:Array Type="{x:Type x:String}">
                                                        <x:String>پیتزا</x:String>
                                                        <x:String>ساندویچ</x:String>
                                                        <x:String>کافی شاپ</x:String>
                                                    </x:Array>
                                                </CollectionView.ItemsSource>
                                                <CollectionView.ItemTemplate>
                                                    <DataTemplate>
                                                        <Frame
                                                            Padding="15,0"
                                                            BackgroundColor="{StaticResource PrimaryLighterColor}"
                                                            CornerRadius="15"
                                                            HasShadow="False">
                                                            <Label
                                                                FontSize="9"
                                                                Text="{Binding .}"
                                                                TextColor="{StaticResource PrimaryDarkenColor}"
                                                                VerticalOptions="Center" />
                                                        </Frame>
                                                    </DataTemplate>
                                                </CollectionView.ItemTemplate>
                                            </CollectionView>-->
                                                <Grid Grid.Row="2">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
                                                    <Frame
                                                        Margin="3,0"
                                                        Padding="4,4,8,4"
                                                        BackgroundColor="{StaticResource Gray-200}"
                                                        CornerRadius="20"
                                                        VerticalOptions="Center">
                                                        <Grid>
                                                            <Grid.ColumnDefinitions>
                                                                <ColumnDefinition Width="Auto" />
                                                                <ColumnDefinition Width="Auto" />
                                                            </Grid.ColumnDefinitions>
                                                            <Frame
                                                                Padding="0"
                                                                BackgroundColor="{StaticResource PrimaryColor}"
                                                                CornerRadius="15"
                                                                HeightRequest="24"
                                                                HorizontalOptions="Start"
                                                                VerticalOptions="Center"
                                                                WidthRequest="24">
                                                                <Label
                                                                    FontFamily="{StaticResource FontAwsomeFontFamily}"
                                                                    FontSize="10"
                                                                    HorizontalOptions="Center"
                                                                    Text="{x:Static model:FaIconFont.ShoppingCart}"
                                                                    TextColor="White"
                                                                    VerticalOptions="Center" />
                                                            </Frame>
                                                            <Label
                                                                Grid.Column="1"
                                                                FontFamily="{StaticResource ShabnameBold}"
                                                                FontSize="15"
                                                                Text="سفـــارش"
                                                                TextColor="{StaticResource PrimaryColor}"
                                                                VerticalOptions="Center" />
                                                        </Grid>
                                                    </Frame>
                                                    <controller:Rating
                                                        Grid.Column="1"
                                                        Margin="3,-3,3,0"
                                                        HorizontalOptions="End"
                                                        VerticalOptions="Center" />
                                                </Grid>
                                            </Grid>

                                            <Frame.GestureRecognizers>
                                                <TapGestureRecognizer Tapped="FoodItem_OnTapped" />
                                            </Frame.GestureRecognizers>
                                        </Frame>
                                    </Grid>
                                </DataTemplate>
                            </BindableLayout.ItemTemplate>
                        </StackLayout>
                    </ScrollView>
                </StackLayout>

                <!--#endregion-->
                <!--#region ButtomSlider-->
                <Grid Grid.Row="2">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Label
                            Margin="0,10"
                            FontFamily="{StaticResource ShabnameBold}"
                            FontSize="18"
                            Text="غذاهای پر طرفدار" />
                    </Grid>
                    <CollectionView Grid.Row="1">
                        <CollectionView.ItemsLayout>
                            <LinearItemsLayout
                                ItemSpacing="5"
                                Orientation="Vertical"
                                SnapPointsAlignment="Start" />
                        </CollectionView.ItemsLayout>
                        <CollectionView.ItemsSource>
                            <x:Array Type="{x:Type x:String}">
                                <x:String>فست فود</x:String>
                                <x:String>رستوران</x:String>
                                <x:String>کافی شاپ</x:String>
                                <x:String>رستوران</x:String>
                                <x:String>کافی شاپ</x:String>
                                <x:String>فست فود</x:String>
                            </x:Array>
                        </CollectionView.ItemsSource>
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <Grid />
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                    </CollectionView>
                </Grid>
                <!--#endregion-->
            </Grid>
        </Grid>

        <!--#region Category-->
        <!--<CollectionView HeightRequest="37">
                        <CollectionView.ItemsLayout>
                            <LinearItemsLayout
                                ItemSpacing="8"
                                Orientation="Horizontal"
                                SnapPointsAlignment="Start" />
                        </CollectionView.ItemsLayout>
                        <CollectionView.ItemsSource>
                            <x:Array Type="{x:Type x:String}">
                                <x:String>فست فود</x:String>
                                <x:String>رستوران</x:String>
                                <x:String>کافی شاپ</x:String>
                                <x:String>رستوران</x:String>
                                <x:String>کافی شاپ</x:String>
                            </x:Array>
                        </CollectionView.ItemsSource>
                        <CollectionView.ItemTemplate>
                            <DataTemplate>
                                <Button
                                    Padding="8,0"
                                    BackgroundColor="Transparent"
                                    BorderColor="Accent"
                                    BorderWidth="0"
                                    CornerRadius="20"
                                    FontFamily="{StaticResource ShabnameBold}"
                                    FontSize="18"
                                    HeightRequest="37"
                                    Text="{Binding .}"
                                    TextColor="#777" />
                            </DataTemplate>
                        </CollectionView.ItemTemplate>
                    </CollectionView>-->
        <!--#endregion Category-->

        <!--<implementations:SimpleBottomSheet
            x:Name="SimpleBottomSheet"
            ContentPosition="Bottom"
            MainPadding="20"
            Movement="BottomUp">
            <implementations:SimpleBottomSheet.View>
                <ContentView>
                    <Grid>
                        <Frame
                            Margin="0,15,0,0"
                            Padding="8,8,8,8"
                            BackgroundColor="{StaticResource Gray-200}"
                            CornerRadius="8">
                            <controller:BuyBagSlideMenu />
                        </Frame>
                        <Button
                            Margin="0,-10,0,0"
                            Padding="0"
                            BackgroundColor="{StaticResource Red}"
                            Clicked="CloseBuyBagButton_OnClicked"
                            CornerRadius="20"
                            FontFamily="{StaticResource MaterialFontFamily}"
                            FontSize="25"
                            HeightRequest="40"
                            HorizontalOptions="Center"
                            Text="{x:Static model:MaterialIconFont.Close}"
                            TextColor="White"
                            VerticalOptions="Start"
                            WidthRequest="40" />
                    </Grid>
                </ContentView>
            </implementations:SimpleBottomSheet.View>
        </implementations:SimpleBottomSheet>-->
    </Grid>
</ContentPage>