Register page
This commit is contained in:
		| @@ -0,0 +1,39 @@ | ||||
| @using VisaApiClient | ||||
|  | ||||
| <div> | ||||
|     <div > | ||||
|         <label > | ||||
|             Country:<br/> | ||||
|             <InputText class="rounded" @bind-Value="Address.Country"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Address.Country"></ValidationMessage><br/> | ||||
|     </div> | ||||
|  | ||||
|     <div > | ||||
|         <label > | ||||
|             City:<br/> | ||||
|             <InputText class="rounded" @bind-Value="Address.City"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Address.City"></ValidationMessage><br/> | ||||
|     </div> | ||||
|  | ||||
|     <div > | ||||
|         <label > | ||||
|             Street:<br/> | ||||
|             <InputText class="rounded" @bind-Value="Address.Street"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Address.Street"></ValidationMessage><br/> | ||||
|     </div> | ||||
|  | ||||
|     <div > | ||||
|         <label > | ||||
|             Building:<br/> | ||||
|             <InputText class="rounded" @bind-Value="Address.Building"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Address.Building"></ValidationMessage> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| @code { | ||||
|     [Parameter, EditorRequired] public AddressModel Address { get; set; } = null!; | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| @using VisaApiClient | ||||
|  | ||||
| <div> | ||||
|     <div > | ||||
|         <label > | ||||
|             Email:<br/> | ||||
|             <InputText class="rounded" @bind-Value="AuthData.Email"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => AuthData.Email"></ValidationMessage><br/> | ||||
|     </div> | ||||
|  | ||||
|     <div > | ||||
|         <label > | ||||
|             Password:<br/> | ||||
|             <InputText class="rounded" @bind-Value="AuthData.Password"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => AuthData.Password"></ValidationMessage> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| @code { | ||||
|     [Parameter, EditorRequired] public AuthData AuthData { get; set; } = null!; | ||||
| } | ||||
| @@ -0,0 +1,50 @@ | ||||
| @using System.ComponentModel.DataAnnotations | ||||
| @using System.Linq.Expressions | ||||
| @using System.Reflection | ||||
| @typeparam TItem where TItem : class | ||||
|     @typeparam TMember where TMember : struct, Enum | ||||
|  | ||||
| <InputSelect TValue="TMember"  @bind-Value="selected"> | ||||
|     @foreach (var value in enumValues) | ||||
|     { | ||||
|         <option value="@value.Key">@value.Value</option> | ||||
|     } | ||||
| </InputSelect><br/> | ||||
|  | ||||
| @code { | ||||
|     [Parameter, EditorRequired] public TItem Model { get; set; } = default!; | ||||
|  | ||||
|     [Parameter, EditorRequired] public Expression<Func<TItem, TMember>> EnumProperty { get; set; } = null!; | ||||
|  | ||||
|     private Dictionary<TMember, string> enumValues = new(); | ||||
|     private PropertyInfo modelMemberInfo = null!; | ||||
|     private TMember selected; | ||||
|  | ||||
|     protected override void OnInitialized() | ||||
|     { | ||||
|         var enumMembers = typeof(TMember).GetMembers(); | ||||
|         var modelMemberName = ((MemberExpression)EnumProperty.Body).Member.Name; | ||||
|         modelMemberInfo = typeof(TItem).GetProperty(modelMemberName)!; | ||||
|  | ||||
|         foreach (var value in Enum.GetValues<TMember>()) | ||||
|         { | ||||
|             var member = enumMembers.First(info => info.Name == value.ToString()); | ||||
|             var displayAttribute = (DisplayAttribute?)member | ||||
|                 .GetCustomAttributes(typeof(DisplayAttribute), false) | ||||
|                 .FirstOrDefault(); | ||||
|             var displayName = displayAttribute?.Name ?? value.ToString(); | ||||
|             enumValues.Add(value, displayName); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     protected override void OnAfterRender(bool firstRender) | ||||
|     { | ||||
|         OnValueChanged(); | ||||
|     } | ||||
|  | ||||
|     private void OnValueChanged() | ||||
|     { | ||||
|         modelMemberInfo.SetValue(Model, selected); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,31 @@ | ||||
| @using VisaApiClient | ||||
|  | ||||
| <div> | ||||
|     <div > | ||||
|         <label> | ||||
|             First name:<br/> | ||||
|             <InputText DisplayName="First name" class="rounded" @bind-Value="Name.FirstName"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Name.FirstName"></ValidationMessage> | ||||
|     </div><br/> | ||||
|  | ||||
|     <div > | ||||
|         <label> | ||||
|             Surname:<br/> | ||||
|             <InputText class="rounded" @bind-Value="Name.Surname"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Name.Surname"></ValidationMessage> | ||||
|     </div><br/> | ||||
|  | ||||
|     <div > | ||||
|         <label> | ||||
|             Patronymic:<br/> | ||||
|             <InputText class="rounded" @bind-Value="Name.Patronymic"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Name.Patronymic"></ValidationMessage> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| @code { | ||||
|     [Parameter, EditorRequired] public NameModel Name { get; set; } = null!; | ||||
| } | ||||
| @@ -0,0 +1,51 @@ | ||||
| @using BlazorWebAssemblyVisaApiClient.Infrastructure.Services | ||||
| @using VisaApiClient | ||||
|  | ||||
| <div> | ||||
|     <div > | ||||
|         <label> | ||||
|             Passport number:<br/> | ||||
|             <InputText DisplayName="Passport number" class="rounded" @bind-Value="Passport.Number"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Passport.Number"></ValidationMessage> | ||||
|     </div><br/> | ||||
|  | ||||
|     <div > | ||||
|         <label> | ||||
|             Issuer:<br/> | ||||
|             <InputText class="rounded" @bind-Value="Passport.Issuer"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Passport.Issuer"></ValidationMessage> | ||||
|     </div><br/> | ||||
|  | ||||
|     <div > | ||||
|         <label> | ||||
|             Issue date:<br/> | ||||
|             <InputDate DisplayName="Issue date" class="rounded" @bind-Value="Passport.IssueDate" max="DateTimeProvider.Now()"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Passport.IssueDate"></ValidationMessage> | ||||
|     </div><br/> | ||||
|  | ||||
|     <div > | ||||
|         <label> | ||||
|             Expiration date:<br/> | ||||
|             <InputDate DisplayName="Expiration date" class="rounded" @bind-Value="Passport.ExpirationDate" min="DateTimeProvider.Now()"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => Passport.ExpirationDate"></ValidationMessage> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| @code { | ||||
|     private string now = DateTime.Now.ToString("yyyy-MM-dd"); | ||||
|  | ||||
|     [Parameter, EditorRequired] public PassportModel Passport { get; set; } = null!; | ||||
|  | ||||
|     [Inject] IDateTimeProvider DateTimeProvider { get; set; } = null!; | ||||
|  | ||||
|     protected override void OnInitialized() | ||||
|     { | ||||
|         Passport.IssueDate = DateTime.Now; | ||||
|         Passport.ExpirationDate = DateTime.Now; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,23 @@ | ||||
| @using BlazorWebAssemblyVisaApiClient.FluentValidation.Applicants.Models | ||||
|  | ||||
| <div> | ||||
|     <div > | ||||
|         <label > | ||||
|             Name:<br/> | ||||
|             <InputText class="rounded" @bind-Value="PlaceOfWork.Name"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => PlaceOfWork.Name"></ValidationMessage><br/> | ||||
|     </div> | ||||
|  | ||||
|     <div > | ||||
|         <label > | ||||
|             Phone number:<br/> | ||||
|             <InputText DisplayName="Phone number" class="rounded" @bind-Value="PlaceOfWork.PhoneNum"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => PlaceOfWork.PhoneNum"></ValidationMessage> | ||||
|     </div> | ||||
| </div> | ||||
|  | ||||
| @code { | ||||
|     [Parameter, EditorRequired] public PlaceOfWorkModel PlaceOfWork { get; set; } = null!; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user