<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="iElection.Views.MainPage"
    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:materialFrame="http://sharpnado.com"
    xmlns:models="clr-namespace:iElection.Models;assembly=iElection"
    xmlns:views="http://xamarin.com/schemas/2020/toolkit"
    Title="{Binding Title}"
    BackgroundColor="{StaticResource Gray-200}"
    NavigationPage.HasNavigationBar="False">

    <views:TabView
        TabIndicatorColor="{StaticResource Blue}"
        TabStripBackgroundColor="White"
        TabStripHeight="60"
        TabStripPlacement="Bottom">

        <views:TabViewItem FontFamily="{StaticResource ShabnameBold}" Text="مخاطبین">
            <Grid FlowDirection="RightToLeft">


                <CollectionView ItemsSource="{Binding PageDto.Contacts}">
                    <CollectionView.ItemTemplate>
                        <DataTemplate>
                            <Grid>

                                <materialFrame:MaterialFrame
                                    Margin="10,10"
                                    Padding="12,8"
                                    LightThemeBackgroundColor="#f9f9f9">
                                    <Grid ColumnDefinitions="Auto,*">
                                        <views:AvatarView
                                            Margin="7,0,0,0"
                                            Text="M"
                                            VerticalOptions="Center" />
                                        <StackLayout Grid.Column="1">
                                            <Grid ColumnDefinitions="*,Auto">
                                                <StackLayout Orientation="Horizontal">
                                                    <Label FontFamily="{StaticResource ShabnameBold}" Text="{Binding FullName}" />
                                                </StackLayout>
                                                <StackLayout
                                                    Grid.Column="1"
                                                    Orientation="Horizontal"
                                                    VerticalOptions="Center">
                                                    <Label FontSize="Caption" Text="{Binding CreateAt}" />
                                                </StackLayout>
                                            </Grid>
                                            <StackLayout Orientation="Horizontal">
                                                <Label Text="{Binding Phone}" />
                                            </StackLayout>
                                        </StackLayout>
                                    </Grid>
                                    <materialFrame:MaterialFrame.GestureRecognizers>
                                        <TapGestureRecognizer Tapped="ContactSelect_OnTapped" />
                                    </materialFrame:MaterialFrame.GestureRecognizers>
                                </materialFrame:MaterialFrame>
                            </Grid>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>
                <materialFrame:MaterialFrame
                    Margin="10,15"
                    Padding="0"
                    AcrylicGlowColor="#3498db"
                    CornerRadius="18"
                    HorizontalOptions="End"
                    LightThemeBackgroundColor="#2980b9"
                    MaterialTheme="Acrylic"
                    VerticalOptions="End">
                    <StackLayout Orientation="Horizontal">
                        <Label
                            FontFamily="{StaticResource MaterialFontFamily}"
                            FontSize="40"
                            Text="{x:Static models:MaterialIconFont.PlusCircle}"
                            TextColor="White" />
                        <Label
                            Margin="15,0,0,3"
                            FontFamily="{StaticResource ShabnameBold}"
                            Text="افزودن مخاطبــ"
                            TextColor="White"
                            VerticalOptions="Center" />
                    </StackLayout>
                    <materialFrame:MaterialFrame.GestureRecognizers>
                        <TapGestureRecognizer Tapped="AddNewContact_OnTapped" />
                    </materialFrame:MaterialFrame.GestureRecognizers>
                </materialFrame:MaterialFrame>
            </Grid>
        </views:TabViewItem>

        <views:TabViewItem FontFamily="{StaticResource ShabnameBold}" Text="رزومه">
            <Grid FlowDirection="RightToLeft" RowDefinitions="4*,Auto,8*">

                <Frame
                    Margin="8"
                    Padding="0"
                    CornerRadius="5">
                    <CarouselView
                        x:Name="carouselView"
                        Margin="0"
                        IndicatorView="indicatorView"
                        ItemsSource="{Binding Images}">
                        <CarouselView.ItemTemplate>
                            <DataTemplate>
                                <Frame Padding="0">
                                    <forms:CachedImage Aspect="AspectFill" Source="{Binding .}" />
                                </Frame>
                            </DataTemplate>
                        </CarouselView.ItemTemplate>
                    </CarouselView>
                </Frame>

                <IndicatorView
                    x:Name="indicatorView"
                    Grid.Row="1"
                    Margin="0,-8,0,0"
                    HorizontalOptions="Center"
                    IndicatorColor="LightGray"
                    IndicatorsShape="Circle"
                    SelectedIndicatorColor="#F70000"
                    VerticalOptions="StartAndExpand" />
                <materialFrame:MaterialFrame
                    Grid.Row="2"
                    Margin="10,0,10,10"
                    Padding="10">

                    <ScrollView>
                        <StackLayout>
                            <Label
                                Margin="0,10"
                                FontFamily="{StaticResource ShabnameBold}"
                                FontSize="Medium"
                                HorizontalOptions="Center"
                                Text="{Binding Title}"
                                TextColor="#222" />
                            <Label Text="{Binding Text}" TextColor="#222" />
                        </StackLayout>
                    </ScrollView>
                </materialFrame:MaterialFrame>
            </Grid>
        </views:TabViewItem>

        <views:TabViewItem FontFamily="{StaticResource ShabnameBold}" Text="اطلاعیه">
            <Grid FlowDirection="RightToLeft">

                <CollectionView ItemsSource="{Binding PageDto.Notifications}">
                    <CollectionView.ItemTemplate>
                        <DataTemplate>
                            <Grid>

                                <materialFrame:MaterialFrame
                                    Margin="10,10"
                                    Padding="12,8"
                                    LightThemeBackgroundColor="#f9f9f9">
                                    <Grid ColumnDefinitions="Auto,*">
                                        <Label
                                            Margin="0,0,0,5"
                                            FontFamily="{StaticResource MaterialFontFamily}"
                                            FontSize="45"
                                            HorizontalTextAlignment="Center"
                                            Text="{x:Static models:MaterialIconFont.BellCircle}"
                                            TextColor="#3498db"
                                            VerticalOptions="Center"
                                            VerticalTextAlignment="Center" />
                                        <StackLayout Grid.Column="1" VerticalOptions="Center">
                                            <Grid ColumnDefinitions="*,Auto">
                                                <StackLayout Orientation="Horizontal">
                                                    <Label Text="{Binding Title}" TextColor="#222" />
                                                </StackLayout>
                                                <StackLayout
                                                    Grid.Column="1"
                                                    Orientation="Horizontal"
                                                    VerticalOptions="Center">
                                                    <Label
                                                        FontSize="Caption"
                                                        Text="{Binding CreateAt}"
                                                        TextColor="#222" />
                                                </StackLayout>
                                            </Grid>
                                            <StackLayout Orientation="Horizontal">
                                                <Label Text="{Binding Text}" TextColor="#222" />
                                            </StackLayout>
                                        </StackLayout>
                                    </Grid>
                                    <materialFrame:MaterialFrame.GestureRecognizers>
                                        <TapGestureRecognizer Tapped="Notification_OnTapped" />
                                    </materialFrame:MaterialFrame.GestureRecognizers>
                                </materialFrame:MaterialFrame>
                            </Grid>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>
                <!--<materialFrame:MaterialFrame
                    Margin="10,15"
                    Padding="0"
                    AcrylicGlowColor="#3498db"
                    CornerRadius="18"
                    HorizontalOptions="Start"
                    LightThemeBackgroundColor="#2980b9"
                    MaterialTheme="Acrylic"
                    VerticalOptions="End">
                    <StackLayout Orientation="Horizontal">
                        <Label
                            FontFamily="{StaticResource MaterialFontFamily}"
                            FontSize="40"
                            Text="{x:Static models:MaterialIconFont.PlusCircle}"
                            TextColor="White" />
                        <Label
                            Margin="15,0,0,3"
                            FontFamily="{StaticResource ShabnameBold}"
                            Text="افزودن اطلاعیه"
                            TextColor="White"
                            VerticalOptions="Center" />
                    </StackLayout>
                    <materialFrame:MaterialFrame.GestureRecognizers>
                        <TapGestureRecognizer Tapped="AddNewContact_OnTapped" />
                    </materialFrame:MaterialFrame.GestureRecognizers>
                </materialFrame:MaterialFrame>-->
            </Grid>
        </views:TabViewItem>
    </views:TabView>
</ContentPage>