<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="iElection.Views.AddContactPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:comboBox="clr-namespace:Syncfusion.XForms.ComboBox;assembly=Syncfusion.SfComboBox.XForms"
    xmlns:materialFrame="http://sharpnado.com"
    xmlns:prism="http://prismlibrary.com"
    xmlns:xForms="clr-namespace:Syncfusion.SfAutoComplete.XForms;assembly=Syncfusion.SfAutoComplete.XForms"
    prism:ViewModelLocator.AutowireViewModel="True"
    BackgroundColor="#e6e6e6"
    FlowDirection="RightToLeft"
    NavigationPage.HasNavigationBar="False">
    <Grid RowDefinitions="Auto,*">
        <Grid Margin="0,0,0,20" HeightRequest="140">
            <Frame
                Margin="-150,0,-150,-20"
                BackgroundColor="{StaticResource Info}"
                HeightRequest="200"
                Rotation="2" />
            <Frame
                Margin="-150,-200,-150,0"
                BackgroundColor="{StaticResource PrimaryColor}"
                HeightRequest="150"
                Rotation="-7" />
            <Label
                FontFamily="{StaticResource ShabnameBold}"
                FontSize="Large"
                HorizontalOptions="Center"
                Text="{Binding Title}"
                TextColor="White"
                VerticalOptions="Center" />
        </Grid>
        <ScrollView Grid.Row="1" Padding="10">
            <StackLayout>
                <Button
                    Margin="10,8"
                    BackgroundColor="#2980b9"
                    Clicked="Button_OnClicked"
                    CornerRadius="8"
                    FontFamily="{StaticResource ShabnameBold}"
                    IsVisible="{Binding IsAdding}"
                    Text="انتخاب از لیستــ مخاطبین"
                    TextColor="White" />
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Grid
                        BackgroundColor="#F1F1F1"
                        ColumnDefinitions="Auto,*"
                        IsVisible="{Binding IsAdding}">
                        <Label
                            Margin="-3,0,8,0"
                            FontFamily="{StaticResource ShabnameBold}"
                            Text="نــــام : "
                            VerticalOptions="Center" />
                        <Entry
                            Grid.Column="1"
                            FontSize="Small"
                            IsReadOnly="{Binding IsReadOnly}"
                            Placeholder="مثال : امیرحسین"
                            Text="{Binding PageDto.FirstName, Mode=TwoWay}" />
                    </Grid>
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Grid
                        BackgroundColor="#F1F1F1"
                        ColumnDefinitions="Auto,*"
                        IsVisible="{Binding IsAdding}">
                        <Label
                            Margin="-3,0,8,0"
                            FontFamily="{StaticResource ShabnameBold}"
                            Text="نام خانوادگی : "
                            VerticalOptions="Center" />
                        <Entry
                            Grid.Column="1"
                            FontSize="Small"
                            IsReadOnly="{Binding IsReadOnly}"
                            Placeholder="مثال : معتمدی"
                            Text="{Binding PageDto.LastName, Mode=TwoWay}" />
                    </Grid>
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Grid
                        BackgroundColor="#F1F1F1"
                        ColumnDefinitions="Auto,*"
                        IsVisible="{Binding IsAdding}">
                        <Label
                            Margin="-3,0,8,0"
                            FontFamily="{StaticResource ShabnameBold}"
                            Text="شماره تلفن : "
                            VerticalOptions="Center" />
                        <Entry
                            Grid.Column="1"
                            FontSize="Small"
                            IsReadOnly="{Binding IsReadOnly}"
                            Placeholder="مثال : 09124805051"
                            Text="{Binding PageDto.Phone, Mode=TwoWay}" />
                    </Grid>
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Grid>
                        <Grid
                            BackgroundColor="#F1F1F1"
                            ColumnDefinitions="Auto,*"
                            IsVisible="{Binding IsAdding}">
                            <Label
                                Margin="-3,0,8,0"
                                FontFamily="{StaticResource ShabnameBold}"
                                Text="محله : "
                                VerticalOptions="Center" />
                            <Entry
                                Grid.Column="1"
                                FontSize="Small"
                                IsReadOnly="{Binding IsReadOnly}"
                                Placeholder="محله"
                                Text="{Binding PageDto.District, Mode=TwoWay}" />
                        </Grid>
                        <Grid
                            BackgroundColor="#F1F1F1"
                            ColumnDefinitions="Auto,*"
                            IsVisible="{Binding IsAdding}">
                            <Label
                                Margin="-3,0,8,0"
                                FontFamily="{StaticResource ShabnameBold}"
                                Text="محلــه : "
                                VerticalOptions="Center" />
                            <xForms:SfAutoComplete
                                Grid.Column="1"
                                AutoCompleteMode="Suggest"
                                DataSource="{Binding Path=InfoDto.Districts}"
                                DisplayMemberPath="Name"
                                DropDownItemFontFamily="{StaticResource Shabname}"
                                FontFamily="{StaticResource Shabname}"
                                IsDropDownOpen="true"
                                SelectionChanged="DistrictSfAutoComplete_OnSelectionChanged"
                                ShowSuggestionsOnFocus="True"
                                SuggestionMode="Contains" />
                            <!--<Picker
                                Grid.Column="1"
                                ItemDisplayBinding="{Binding Name}"
                                ItemsSource="{Binding InfoDto.Districts}"
                                SelectedIndexChanged="DistrictPicker_OnSelectedIndexChanged" />-->
                        </Grid>
                    </Grid>
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Grid>
                        <Grid
                            BackgroundColor="#F1F1F1"
                            ColumnDefinitions="Auto,*"
                            IsVisible="{Binding IsAdding}">
                            <Label
                                Margin="-3,0,8,0"
                                FontFamily="{StaticResource ShabnameBold}"
                                Text="شغل : "
                                VerticalOptions="Center" />
                            <Entry
                                FontSize="Small"
                                IsReadOnly="{Binding IsReadOnly}"
                                Placeholder="شغل"
                                Text="{Binding PageDto.Job, Mode=TwoWay}" />
                        </Grid>
                        <Grid
                            BackgroundColor="#F1F1F1"
                            ColumnDefinitions="Auto,*"
                            IsVisible="{Binding IsAdding}">
                            <Label
                                Margin="-3,0,8,0"
                                FontFamily="{StaticResource ShabnameBold}"
                                Text="شغــل : "
                                VerticalOptions="Center" />
                            <xForms:SfAutoComplete
                                Grid.Column="1"
                                AutoCompleteMode="Suggest"
                                DataSource="{Binding Path=InfoDto.Jobs}"
                                DisplayMemberPath="Name"
                                DropDownItemFontFamily="{StaticResource Shabname}"
                                FontFamily="{StaticResource Shabname}"
                                IsDropDownOpen="true"
                                SelectionChanged="JobSfAutoComplete_OnSelectionChanged"
                                ShowSuggestionsOnFocus="True"
                                SuggestionMode="Contains" />
                        </Grid>
                    </Grid>
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Grid
                        BackgroundColor="#F1F1F1"
                        ColumnDefinitions="Auto,*"
                        IsVisible="{Binding IsAdding}">
                        <Label
                            Margin="-3,0,8,0"
                            FontFamily="{StaticResource ShabnameBold}"
                            Text="سن : "
                            VerticalOptions="Center" />
                        <Entry
                            Grid.Column="1"
                            FontSize="Small"
                            IsReadOnly="{Binding IsReadOnly}"
                            Placeholder="مثال : 32"
                            Text="{Binding PageDto.Age, Mode=TwoWay, StringFormat='{}{0:#}'}" />
                    </Grid>
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Grid>
                        <Grid
                            BackgroundColor="#F1F1F1"
                            ColumnDefinitions="Auto,*"
                            IsVisible="{Binding IsAdding}">
                            <Label
                                Margin="-3,0,8,0"
                                FontFamily="{StaticResource ShabnameBold}"
                                Text="جنسیت : "
                                VerticalOptions="Center" />
                            <Entry
                                FontSize="Small"
                                IsReadOnly="{Binding IsReadOnly}"
                                Placeholder="جنسیت"
                                Text="{Binding PageDto.GenderName, Mode=TwoWay}" />
                        </Grid>
                        <Grid
                            BackgroundColor="#F1F1F1"
                            ColumnDefinitions="Auto,*"
                            IsVisible="{Binding IsAdding}">
                            <Label
                                Margin="-3,0,8,0"
                                FontFamily="{StaticResource ShabnameBold}"
                                Text="جنسیتـ : "
                                VerticalOptions="Center" />
                            <Picker
                                Grid.Column="1"
                                ItemDisplayBinding="{Binding Name}"
                                ItemsSource="{Binding InfoDto.Genders}"
                                SelectedIndexChanged="GenderPicker_OnSelectedIndexChanged" />
                        </Grid>
                    </Grid>
                </materialFrame:MaterialFrame>
                <Grid ColumnDefinitions="*" IsVisible="{Binding IsAdding}">
                    <Button
                        Margin="10,8,10,8"
                        BackgroundColor="{StaticResource Success}"
                        Command="{Binding AddContactCommand}"
                        CornerRadius="8"
                        FontFamily="{StaticResource ShabnameBold}"
                        Text="تاییـــــد"
                        TextColor="White" />
                </Grid>
            </StackLayout>
        </ScrollView>
    </Grid>
</ContentPage>