<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
    x:Class="iElection.Views.SignUpPage"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    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="ثبت نام"
                TextColor="White"
                VerticalOptions="Center" />
        </Grid>
        <ScrollView Grid.Row="1" Padding="10">
            <StackLayout>
                <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}"
                            Keyboard="Telephone"
                            Placeholder="مثال : 09124805051"
                            Text="{Binding PageDto.Phone, 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" />
                        <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" />
                    </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" />
                        <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>
                </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}"
                            Keyboard="Numeric"
                            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
                        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>
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Entry
                        FontSize="Small"
                        HorizontalTextAlignment="End"
                        IsPassword="True"
                        Placeholder="رمز عبور"
                        Text="{Binding PageDto.Password, Mode=TwoWay, StringFormat='{}{0:#}'}" />
                </materialFrame:MaterialFrame>
                <materialFrame:MaterialFrame
                    Margin="10,8"
                    Padding="8,3"
                    HasShadow="True"
                    MaterialTheme="Acrylic">
                    <Entry
                        FontSize="Small"
                        HorizontalTextAlignment="End"
                        IsPassword="True"
                        Placeholder="تکرار رمز عبور"
                        Text="{Binding PageDto.RePassword, Mode=TwoWay, StringFormat='{}{0:#}'}" />
                </materialFrame:MaterialFrame>
                <Grid ColumnDefinitions="7*,3*">
                    <Button
                        Margin="0,8,10,8"
                        BackgroundColor="{StaticResource Success}"
                        Command="{Binding SignUpCommand}"
                        CornerRadius="8"
                        FontFamily="{StaticResource ShabnameBold}"
                        Text="ثبتــ نام"
                        TextColor="White" />
                    <Button
                        Grid.Column="1"
                        Margin="10,8,0,8"
                        BackgroundColor="{StaticResource Info}"
                        Command="{Binding Path=LoginCommand}"
                        CornerRadius="8"
                        FontFamily="{StaticResource ShabnameBold}"
                        Text="ورود"
                        TextColor="White" />

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