173 lines
15 KiB
XML

<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="gehGassiApp.Controls.Register.Step3Control"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:controls="clr-namespace:gehGassiApp.Controls"
xmlns:res="clr-namespace:gehGassiApp.Resources"
xmlns:behaviors="clr-namespace:gehGassiApp.Behaviors"
xmlns:ios="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific;assembly=Microsoft.Maui.Controls"
xmlns:enum="clr-namespace:gehGassiApp.Domain.Common;assembly=gehGassiApp.Domain"
xmlns:i="clr-namespace:gehGassiApp.Constants"
x:Name="this" HorizontalOptions="FillAndExpand">
<VerticalStackLayout BindingContext="{x:Reference this}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Padding="20" Spacing="0">
<Grid ColumnDefinitions="25,50,25,50,25" HorizontalOptions="Center" ColumnSpacing="5" Margin="{StaticResource MarginMid}">
<Border Grid.Column="0" Style="{StaticResource LightBlue20Border}" HorizontalOptions="Fill" VerticalOptions="Fill" Padding="0" WidthRequest="25" HeightRequest="25">
<Label Text="1" Style="{StaticResource Menu_Blue}" HorizontalOptions="Center" VerticalOptions="Center"></Label>
</Border>
<Border Grid.Column="1" Style="{StaticResource Separator_LightBlue20}"></Border>
<Border Grid.Column="2" Style="{StaticResource LightBlue20Border}" HorizontalOptions="Fill" VerticalOptions="Fill" Padding="0" WidthRequest="25" HeightRequest="25">
<Label Text="2" Style="{StaticResource Menu_Blue}" HorizontalOptions="Center" VerticalOptions="Center"></Label>
</Border>
<Border Grid.Column="3" Style="{StaticResource Separator_LightBlue20}"></Border>
<Border Grid.Column="4" Style="{StaticResource DarkBlueBorder}" HorizontalOptions="Fill" VerticalOptions="Fill" Padding="0" WidthRequest="25" HeightRequest="25">
<Label Text="3" Style="{StaticResource Menu_White}" HorizontalOptions="Center" VerticalOptions="Center"></Label>
</Border>
</Grid>
<Label Text="{Static res:Text.Register_Step3_Desc}" HorizontalOptions="CenterAndExpand" Style="{StaticResource H2_Blue}" Margin="{StaticResource MarginBig}"></Label>
<VerticalStackLayout Spacing="0" Margin="{StaticResource MarginBig}">
<Label Text="{x:Static res:Text.Profile_Name_Question}" Style="{StaticResource Menu_Blue}" Margin="{StaticResource MarginLabel}"></Label>
<Border Style="{StaticResource EntryBorder}" Margin="{StaticResource MarginSmall}">
<Entry x:Name="firstName" Text="{Binding ViewModel.FirstName}" Placeholder="{x:Static res:Text.Common_FirstName}" Keyboard="Text" VerticalOptions="StartAndExpand">
<Entry.Behaviors>
<toolkit:TextValidationBehavior x:Name="firstNameValidation" Flags="ValidateOnValueChanged,ValidateOnAttaching" MinimumLength="1" MaximumLength="150"/>
</Entry.Behaviors>
</Entry>
</Border>
<Border Style="{StaticResource EntryBorder}">
<Entry x:Name="lastName" Text="{Binding ViewModel.LastName}" Placeholder="{x:Static res:Text.Common_LastName}" Keyboard="Text" >
<Entry.Behaviors>
<toolkit:TextValidationBehavior x:Name="lastNameValidation" Flags="ValidateOnValueChanged,ValidateOnAttaching" MinimumLength="1" MaximumLength="150"/>
</Entry.Behaviors>
</Entry>
</Border>
</VerticalStackLayout>
<VerticalStackLayout Spacing="0" Margin="{StaticResource MarginBig}">
<Label Text="{x:Static res:Text.Profile_Age_Question}" Style="{StaticResource Menu_Blue}" Margin="{StaticResource MarginLabel}"></Label>
<Border Style="{StaticResource EntryBorder}" Margin="{StaticResource MarginVerySmall}">
<Grid>
<Entry Text="{Binding ViewModel.BirthDay}" Keyboard="Default" Placeholder="{Binding ViewModel.BirthdateFormat}">
<Entry.Behaviors>
<toolkit:TextValidationBehavior x:Name="birthdayLengthValidation" Flags="ValidateOnValueChanged,ValidateOnAttaching" MinimumLength="1" MaximumLength="10"/>
<behaviors:DateValidationBehavior x:Name="birthdayValidation" MinDate="01/01/1900" MaxDate="{Binding ViewModel.MaxDate}" Flags="ValidateOnValueChanged,ValidateOnAttaching"></behaviors:DateValidationBehavior>
<behaviors:SelectAllFocusedEntryBehavior></behaviors:SelectAllFocusedEntryBehavior>
</Entry.Behaviors>
</Entry>
<Image HeightRequest="25" HorizontalOptions="End">
<Image.Source>
<FontImageSource Glyph="{x:Static i:IconsMoon.Icon_Calendar}" FontFamily="IconMoon" Color="{StaticResource Primary_DarkBlue}" Size="25"></FontImageSource>
</Image.Source>
<Image.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ViewModel.ShowBirthdayCalendarCommand}" CommandParameter="{x:Reference birthDatePicker}"></TapGestureRecognizer>
</Image.GestureRecognizers>
</Image>
<DatePicker x:Name="birthDatePicker" Date="{Binding ViewModel.BirthDate}" MinimumDate="01/01/1900" MaximumDate="{Binding ViewModel.MaxDate}" HeightRequest="0" WidthRequest="0"></DatePicker>
</Grid>
</Border>
<Label Text="{x:Static res:Text.Register_MinAge}" Style="{StaticResource BodyCaption_GreyDark}" Margin="12,0,0,0"></Label>
</VerticalStackLayout>
<VerticalStackLayout Spacing="0" Margin="{StaticResource MarginBig}">
<Label Text="{x:Static res:Text.Profile_Address_Question}" Style="{StaticResource Menu_Blue}" Margin="{StaticResource MarginLabel}"></Label>
<Border Style="{StaticResource EntryBorder}" Margin="{StaticResource MarginSmall}">
<Entry x:Name="zip" Text="{Binding ViewModel.Zip, Converter={StaticResource NullToEmptyStringConverter}}" Placeholder="{x:Static res:Text.Common_Address_Zip}" Keyboard="Text" >
<Entry.Behaviors>
<toolkit:TextValidationBehavior x:Name="zipValidation" Flags="ValidateOnAttaching,ValidateOnValueChanged" MinimumLength="1" MaximumLength="20"/>
<behaviors:SelectAllFocusedEntryBehavior></behaviors:SelectAllFocusedEntryBehavior>
</Entry.Behaviors>
</Entry>
</Border>
<Border Style="{StaticResource EntryBorder}" Margin="{StaticResource MarginSmall}">
<Entry x:Name="city" Text="{Binding ViewModel.City, Converter={StaticResource NullToEmptyStringConverter}}" Placeholder="{x:Static res:Text.Common_Address_City}" Keyboard="Text" >
<Entry.Behaviors>
<toolkit:TextValidationBehavior x:Name="cityValidation" Flags="ValidateOnAttaching,ValidateOnValueChanged" MinimumLength="1" MaximumLength="100"/>
<behaviors:SelectAllFocusedEntryBehavior></behaviors:SelectAllFocusedEntryBehavior>
</Entry.Behaviors>
</Entry>
</Border>
<Border Style="{StaticResource EntryBorder}" Margin="{StaticResource MarginSmall}">
<!--<Picker Title="{x:Static res:Text.Common_SelectCountry}" ItemsSource="{Binding ViewModel.Countries}" SelectedItem="{Binding ViewModel.SelectedCountry}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>-->
<controls:PickerWithChevron Title="{x:Static res:Text.Common_SelectCountry}" ItemsSource="{Binding ViewModel.Countries}" SelectedItem="{Binding ViewModel.SelectedCountry}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>
</Border>
<Border Style="{StaticResource EntryBorder}">
<!--<Picker Title="{x:Static res:Text.Common_SelectState}" ItemsSource="{Binding ViewModel.States}" SelectedItem="{Binding ViewModel.SelectedState}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>-->
<controls:PickerWithChevron Title="{x:Static res:Text.Common_SelectState}" ItemsSource="{Binding ViewModel.States}" SelectedItem="{Binding ViewModel.SelectedState}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>
</Border>
</VerticalStackLayout> <VerticalStackLayout Spacing="12" Margin="{StaticResource MarginBig}">
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="10" HorizontalOptions="Fill">
<Label Grid.Column="0" Text="{x:Static res:Text.Register_AcceptTerms}" Style="{StaticResource LinkLabelStyle}" HorizontalOptions="Start" Padding="0,0,0,0" LineBreakMode="TailTruncation">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ViewModel.ShowTermsCommand}" />
</Label.GestureRecognizers>
</Label>
<Switch Grid.Column="1" VerticalOptions="Center" HorizontalOptions="End" IsToggled="{Binding ViewModel.AcceptedTerms}"></Switch>
</Grid>
<Grid ColumnDefinitions="*,Auto" ColumnSpacing="10">
<Label Grid.Column="0" Text="{x:Static res:Text.Register_AcceptPrivacy}" Style="{StaticResource LinkLabelStyle}" HorizontalOptions="Start" Padding="0,0,0,0" LineBreakMode="TailTruncation">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ViewModel.ShowPrivacyCommand}" />
</Label.GestureRecognizers>
</Label>
<Switch Grid.Column="1" VerticalOptions="Center" HorizontalOptions="End" IsToggled="{Binding ViewModel.AcceptedPrivacy}"></Switch>
</Grid>
<!-- <Grid ColumnDefinitions="*,Auto" ColumnSpacing="10"
IsVisible="{Binding ViewModel.AppUserType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static enum:AppUserType.DogWalker}}" >
<Label Grid.Column="0" Text="{x:Static res:Text.Register_AcceptTermsMangopay}" Style="{StaticResource LinkLabelStyle}" HorizontalOptions="Start" Padding="0,0,0,0" LineBreakMode="TailTruncation">
<Label.GestureRecognizers>
<TapGestureRecognizer Command="{Binding ViewModel.ShowTermsMangoPayCommand}" />
</Label.GestureRecognizers>
</Label>
<Switch Grid.Column="1" VerticalOptions="Center" HorizontalOptions="End" IsToggled="{Binding ViewModel.AcceptedTermsMangopay}"></Switch>
</Grid> -->
</VerticalStackLayout>
<VerticalStackLayout Spacing="0" IsVisible="{Binding ViewModel.AppUserType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static enum:AppUserType.DogWalker}}" Margin="{StaticResource MarginBig}">
<Label Text="{x:Static res:Text.Profile_Nationality_Question}" Style="{StaticResource Menu_Blue}" Margin="{StaticResource MarginLabel}"></Label>
<Border Style="{StaticResource EntryBorder}">
<!--<Picker Title="{x:Static res:Text.Common_SelectCountry}" ItemsSource="{Binding ViewModel.Nationalitites}" SelectedItem="{Binding ViewModel.SelectedNationality}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>-->
<controls:PickerWithChevron Title="{x:Static res:Text.Common_SelectCountry}" ItemsSource="{Binding ViewModel.Nationalitites}" SelectedItem="{Binding ViewModel.SelectedNationality}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>
</Border>
</VerticalStackLayout>
<VerticalStackLayout Spacing="0" IsVisible="{Binding ViewModel.AppUserType, Converter={StaticResource EnumToBoolConverter}, ConverterParameter={x:Static enum:AppUserType.DogWalker}}" Margin="{StaticResource MarginBig}">
<Label Text="{x:Static res:Text.Profile_MainResidence_Question}" Style="{StaticResource Menu_Blue}" Margin="{StaticResource MarginLabel}"></Label>
<Border Style="{StaticResource EntryBorder}">
<!--<Picker Title="{x:Static res:Text.Common_SelectCountry}" ItemsSource="{Binding ViewModel.MainResidences}" SelectedItem="{Binding ViewModel.SelectedMainResidence}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>-->
<controls:PickerWithChevron Title="{x:Static res:Text.Common_SelectCountry}" ItemsSource="{Binding ViewModel.MainResidences}" SelectedItem="{Binding ViewModel.SelectedMainResidence}" ItemDisplayBinding="{Binding Name}" HorizontalOptions="Fill" ios:Picker.UpdateMode="WhenFinished"/>
</Border>
</VerticalStackLayout>
<ActivityIndicator HorizontalOptions="Center" VerticalOptions="Center" IsRunning="{Binding ViewModel.IsBusy}" IsVisible="{Binding ViewModel.IsBusy}"/>
<Button x:Name="btnRegister" Text="{Static res:Text.Button_Register}" Command="{Binding ViewModel.RegisterCommand}" Margin="{StaticResource MarginBig}">
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource AllTrueMultiConverter}">
<Binding Source="{x:Reference firstNameValidation}" Path="IsValid"></Binding>
<Binding Source="{x:Reference lastNameValidation}" Path="IsValid"></Binding>
<Binding Source="{x:Reference birthdayLengthValidation}" Path="IsValid"></Binding>
<Binding Source="{x:Reference birthdayValidation}" Path="IsValid"></Binding>
<Binding Source="{x:Reference zipValidation}" Path="IsValid"></Binding>
<Binding Source="{x:Reference cityValidation}" Path="IsValid"></Binding>
<Binding Path="ViewModel.AddressSelectionValid"></Binding>
<Binding Path="ViewModel.IsNotBusy"></Binding>
<Binding Path="ViewModel.AcceptedTerms"></Binding>
<Binding Path="ViewModel.AcceptedPrivacy"></Binding>
<Binding Path="ViewModel.RegisterMangoPayValid"></Binding>
</MultiBinding>
</Button.IsEnabled>
</Button>
<Label Text="{x:Static res:Text.Register_Step3_Info}" Style="{StaticResource BodyCaption_GreyDark}" HorizontalOptions="Center" HorizontalTextAlignment="Center"></Label>
</VerticalStackLayout>
</ContentView>