refactorrr
This commit is contained in:
		| @@ -12,7 +12,7 @@ | ||||
|     <div > | ||||
|         <label > | ||||
|             Password:<br/> | ||||
|             <InputText class="rounded" @bind-Value="AuthData.Password"/> | ||||
|             <InputText type="password" class="rounded" @bind-Value="AuthData.Password"/> | ||||
|         </label><br/> | ||||
|         <ValidationMessage For="() => AuthData.Password"></ValidationMessage> | ||||
|     </div> | ||||
|   | ||||
| @@ -60,7 +60,6 @@ | ||||
|  | ||||
| @code { | ||||
|     private bool collapseNavMenu = true; | ||||
|     private string? currentRole = null!; | ||||
|  | ||||
|     private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; | ||||
|  | ||||
|   | ||||
| @@ -19,7 +19,7 @@ | ||||
|  | ||||
|         <label> | ||||
|             Password:<br/> | ||||
|             <InputText class="rounded" @bind-Value="requestModel.AuthData.Password"/> | ||||
|             <InputText type="password" class="rounded" @bind-Value="requestModel.AuthData.Password"/> | ||||
|             <ValidationMessage For="() => requestModel.AuthData.Password"/> | ||||
|         </label><br/> | ||||
|         <p/> | ||||
|   | ||||
| @@ -4,6 +4,8 @@ | ||||
| @using BlazorWebAssemblyVisaApiClient.Components | ||||
| @using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers | ||||
| @using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider | ||||
| @using BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models | ||||
| @using BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models | ||||
| @using VisaApiClient | ||||
| @inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase | ||||
|  | ||||
| @@ -42,9 +44,9 @@ | ||||
|             Gender:<br/> | ||||
|             <em>@application.Applicant.Gender.GetDisplayName()</em> | ||||
|         </td> | ||||
|         <td > | ||||
|         <td colspan="2"> | ||||
|             Marital status:<br/> | ||||
|             <em>@application.Applicant.MaritalStatus.GetDisplayName()</em> | ||||
|             <em>@(((MaritalStatusModel)application.Applicant.MaritalStatus).GetDisplayName())</em> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
| @@ -111,7 +113,7 @@ | ||||
|         </td> | ||||
|         <td > | ||||
|             Visa category:<br/> | ||||
|             <em>@application.VisaCategory</em> | ||||
|             <em>@(((VisaCategoryModel)application.VisaCategory).GetDisplayName())</em> | ||||
|         </td> | ||||
|         <td > | ||||
|             Visa:<br/> | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
| @using BlazorWebAssemblyVisaApiClient.Common.Exceptions | ||||
| @using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers | ||||
| @using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider | ||||
| @using BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models | ||||
| @using VisaApiClient | ||||
| @inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase | ||||
|  | ||||
| @@ -33,7 +34,7 @@ | ||||
|  | ||||
|         <tr class="@rowClass"> | ||||
|             <td>@application.DestinationCountry</td> | ||||
|             <td>@application.VisaCategory.GetDisplayName()</td> | ||||
|             <td>@(((VisaCategoryModel)application.VisaCategory).GetDisplayName())</td> | ||||
|             <td>@application.RequestDate.ToString("d")</td> | ||||
|             <td>@application.ValidDaysRequested</td> | ||||
|             <td>@application.Status.GetDisplayName()</td> | ||||
|   | ||||
| @@ -16,7 +16,7 @@ | ||||
|  | ||||
|         <label> | ||||
|             New password (leave blank if shouldn't be changed):<br/> | ||||
|             <InputText class="rounded" @bind-Value="model.Password"/> | ||||
|             <InputText type="password" class="rounded" @bind-Value="model.Password"/> | ||||
|         </label><br/><p/> | ||||
|  | ||||
|         <button class="btn-primary rounded" @onclick="Save">Save</button><br/> | ||||
|   | ||||
| @@ -2,7 +2,6 @@ | ||||
| @using System.Net | ||||
| @using AutoMapper | ||||
| @using BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models | ||||
| @using BlazorWebAssemblyVisaApiClient.Components.FormComponents.Applicants | ||||
| @using VisaApiClient | ||||
| @using BlazorWebAssemblyVisaApiClient.Components | ||||
| @using BlazorWebAssemblyVisaApiClient.Components.FormComponents.VisaApplications | ||||
| @@ -12,6 +11,7 @@ | ||||
| @using BlazorWebAssemblyVisaApiClient.Validation | ||||
| @using FluentValidation | ||||
| @using Newtonsoft.Json.Linq | ||||
| @using BlazorWebAssemblyVisaApiClient.Components.FormComponents | ||||
| @inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase | ||||
|  | ||||
| <PageTitle>New Application</PageTitle> | ||||
| @@ -163,7 +163,7 @@ | ||||
|             <Status @ref="pastVisitStatus"/> | ||||
|         </div> | ||||
|  | ||||
|         @if (requestModel.VisaCategory is VisaCategory.Transit) | ||||
|         @if (requestModel.VisaCategory is VisaCategoryModel.Transit) | ||||
|         { | ||||
|             requestModel.PermissionToDestCountry ??= NewPermissionToDestCountry(); | ||||
|             <div class="form-block"> | ||||
|   | ||||
| @@ -10,6 +10,7 @@ | ||||
| @using BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers | ||||
| @using BlazorWebAssemblyVisaApiClient.Validation | ||||
| @using BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models | ||||
| @using BlazorWebAssemblyVisaApiClient.Components.FormComponents | ||||
| @inherits BlazorWebAssemblyVisaApiClient.Components.Base.VisaClientComponentBase | ||||
|  | ||||
| <PageTitle>Registration</PageTitle> | ||||
|   | ||||
| @@ -0,0 +1,18 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.Applicants.Models | ||||
| { | ||||
|     public enum MaritalStatusModel | ||||
|     { | ||||
|         Other = 0, | ||||
|  | ||||
|         Married = 1, | ||||
|  | ||||
|         Unmarried = 2, | ||||
|  | ||||
|         Separated = 3, | ||||
|  | ||||
|         [Display(Name = "Widow or widower")] | ||||
|         WidowOrWidower = 4 | ||||
|     } | ||||
| } | ||||
| @@ -45,7 +45,7 @@ public class RegisterApplicantRequestModel | ||||
|  | ||||
|     [Required(AllowEmptyStrings = true)] | ||||
|     [JsonConverter(typeof(StringEnumConverter))] | ||||
|     public MaritalStatus MaritalStatus { get; set; } | ||||
|     public MaritalStatusModel MaritalStatus { get; set; } | ||||
|  | ||||
|     [Required] | ||||
|     [ValidateComplexType] | ||||
| @@ -64,4 +64,4 @@ public class RegisterApplicantRequestModel | ||||
|     public PlaceOfWorkModel PlaceOfWork { get; set; } = new(); | ||||
|  | ||||
|     public bool IsNonResident { get; set; } | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -14,7 +14,7 @@ public class VisaApplicationCreateRequestModel | ||||
|     public string DestinationCountry { get; set; } = default!; | ||||
|  | ||||
|     [Required] | ||||
|     public VisaCategory VisaCategory { get; set; } | ||||
|     public VisaCategoryModel VisaCategory { get; set; } | ||||
|  | ||||
|     [Required] | ||||
|     public bool IsForGroup { get; set; } | ||||
| @@ -34,4 +34,4 @@ public class VisaApplicationCreateRequestModel | ||||
|  | ||||
|     [ValidateComplexType] | ||||
|     public List<PastVisitModel> PastVisits { get; set; } = []; | ||||
| } | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,11 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Validation.VisaApplications.Models | ||||
| { | ||||
|     public enum VisaCategoryModel | ||||
|     { | ||||
|         Transit = 0, | ||||
|         [Display(Name = "Short dated")] | ||||
|         ShortDated = 1 | ||||
|     } | ||||
| } | ||||
| @@ -18,7 +18,7 @@ public class VisaApplicationCreateRequestValidator : AbstractValidator<VisaAppli | ||||
|             .NotEmpty() | ||||
|             .WithMessage("For transit you must provide permission to destination country") | ||||
|             .SetValidator(permissionToDestCountryModelValidator) | ||||
|             .When(r => r.VisaCategory is VisaCategory.Transit); | ||||
|             .When(r => r.VisaCategory is VisaCategoryModel.Transit); | ||||
|  | ||||
|         RuleFor(r => r.ReentryPermit) | ||||
|             .NotEmpty() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user