remove CommissionLocation; Age validation
This commit is contained in:
		
							parent
							
								
									c823f5ce9b
								
							
						
					
					
						commit
						503b59f300
					
				| @ -17,13 +17,23 @@ | ||||
|                     <div class="col-12 col-lg-3"><label class="form-label" for="Password">Password</label><input id="Password" class="form-control" type="password" required asp-for="Password" /> | ||||
|                         @Html.ValidationMessageFor(x => x.Password) | ||||
|                         </div> | ||||
|                     <div class="col-12 col-lg-3"><label class="form-label" for="ConfirmPassword">Confirm Password</label><input id="ConfirmPassword" class="form-control" type="password" required asp-for="ConfirmPassword" /> | ||||
|                     <div class="col-12 col-lg-3"> | ||||
|                         <label class="form-label" for="ConfirmPassword">Confirm Password</label> | ||||
|                         <input id="ConfirmPassword" class="form-control" type="password" required asp-for="ConfirmPassword" /> | ||||
|                         @Html.ValidationMessageFor(x => x.ConfirmPassword) | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="row"> | ||||
|                     <div class="col-12 col-lg-3"><label class="form-label" for="PhoneNumber">Phone number</label><input id="PhoneNumber" class="form-control mb-3" type="text" asp-for="PhoneNumber" /></div> | ||||
|                     <div class="col-12 col-lg-3"><label class="form-label" for="BirthDate">Birthdate</label><input id="BirthDate" class="form-control mb-3" type="date" required asp-for="BirthDate" /></div> | ||||
|                     <div class="col-12 col-lg-3"> | ||||
|                         <label class="form-label" for="PhoneNumber">Phone number</label> | ||||
|                         <input id="PhoneNumber" class="form-control mb-3" type="text" asp-for="PhoneNumber" /> | ||||
|                         @Html.ValidationMessageFor(x => x.PhoneNumber) | ||||
|                     </div> | ||||
|                     <div class="col-12 col-lg-3"> | ||||
|                         <label class="form-label" for="BirthDate">Birthdate</label> | ||||
|                         <input id="BirthDate" class="form-control mb-3" type="date" required asp-for="BirthDate" /> | ||||
|                         @Html.ValidationMessageFor(x => x.BirthDate) | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="row mt-3"> | ||||
|                     <div class="col"> | ||||
| @ -44,12 +54,10 @@ | ||||
|                     <div class="row mt-3"> | ||||
|                         <div class="col-12 col-lg-3"><label class="form-label" for="PTRNumber">PTR Number</label><input id="PTRNumber" class="form-control mb-3" type="text" required asp-for="PTRNumber" /></div> | ||||
|                         <div class="col-12 col-lg-3"><label class="form-label" for="PTRDate">PTR Date</label><input id="PTRDate" class="form-control mb-3" type="date" required asp-for="PTRDate" /></div> | ||||
|                         <div class="col"><label class="form-label" for="PTRLocation">PTR Location</label><input id="PTRLocation" class="form-control mb-3" type="text" required asp-for="PTRLocation" /></div> | ||||
|                     </div> | ||||
|                     <div class="row mt-3"> | ||||
|                         <div class="col-12 col-lg-3"><label class="form-label">Commission Number</label><input id="CommissionNumber" class="form-control mb-3" type="text" required asp-for="CommissionNumber" /></div> | ||||
|                         <div class="col-12 col-lg-3"><label class="form-label">Commision Expiration</label><input id="CommisionExpiration" class="form-control mb-3" type="date" required asp-for="CommissionExpiration" /></div> | ||||
|                         <div class="col"><label class="form-label" for="CommissionLocation">Commission Location</label><input id="CommissionLocation" class="form-control mb-3" type="text" required asp-for="CommissionLocation" /></div> | ||||
|                     </div> | ||||
|                     <div class="row mt-3"> | ||||
|                         <div class="col"><label class="form-label" for="OfficeAddress">Office Address</label><input id="OfficeAddress" class="form-control mb-3" type="text" required asp-for="OfficeAddress" /></div> | ||||
|  | ||||
| @ -19,30 +19,7 @@ namespace EnotaryoPH.Web.Pages | ||||
|             _passwordService = passwordService; | ||||
|         } | ||||
| 
 | ||||
|         public void OnGet() | ||||
|         { | ||||
|             RoleType = "Principal"; | ||||
| #if DEBUG | ||||
|             RollNumber = "ROLL1234"; | ||||
|             IBPNumber = "IBP1234"; | ||||
|             MCLEComplianceNumber = "MCLE1234"; | ||||
|             MCLEDate = new DateTime(2023, 1, 15, 0, 0, 0, DateTimeKind.Utc); | ||||
|             PTRDate = new DateTime(2023, 1, 15, 0, 0, 0, DateTimeKind.Utc); | ||||
|             PTRLocation = "ptr location"; | ||||
|             PTRNumber = "PTR98723"; | ||||
|             CommissionExpiration = new DateTime(2023, 1, 15, 0, 0, 0, DateTimeKind.Utc); | ||||
|             CommissionLocation = "COMM LOC 8732"; | ||||
|             CommissionNumber = "COMM NO 8392"; | ||||
|             OfficeAddress = "123 Fictional Road, NY, Cubao"; | ||||
| 
 | ||||
|             PhoneNumber = "639151220001"; | ||||
|             BirthDate = new DateTime(1979, 9, 10, 0, 0, 0, DateTimeKind.Utc); | ||||
|             Password = "arst1234"; | ||||
|             ConfirmPassword = "arst1234"; | ||||
| 
 | ||||
| 
 | ||||
| #endif | ||||
|         } | ||||
|         public void OnGet() => RoleType = "Principal"; | ||||
| 
 | ||||
|         public IActionResult OnPost() | ||||
|         { | ||||
| @ -58,6 +35,13 @@ namespace EnotaryoPH.Web.Pages | ||||
|                 return Page(); | ||||
|             } | ||||
| 
 | ||||
|             var today = DateTime.Now; | ||||
|             if (today.Year - BirthDate.Year < 18 || (today.Year - BirthDate.Year == 18 && BirthDate.Month < today.Month)) | ||||
|             { | ||||
|                 ModelState.AddModelError(nameof(BirthDate), "You must be 18 or older"); | ||||
|                 return Page(); | ||||
|             } | ||||
| 
 | ||||
|             var newUser = new User | ||||
|             { | ||||
|                 BirthDate = new DateTime(BirthDate.Ticks, DateTimeKind.Utc), | ||||
| @ -74,7 +58,6 @@ namespace EnotaryoPH.Web.Pages | ||||
|                 { | ||||
|                     User = newUser, | ||||
|                     CommissionExpiration = new DateTime(CommissionExpiration.Value.Ticks, DateTimeKind.Utc), | ||||
|                     CommissionLocation = CommissionLocation, | ||||
|                     CommissionNumber = CommissionNumber, | ||||
|                     IBPNumber = IBPNumber, | ||||
|                     MCLEComplianceNumber = MCLEComplianceNumber, | ||||
| @ -101,10 +84,10 @@ namespace EnotaryoPH.Web.Pages | ||||
|         public string Password { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         [Compare(nameof(Password))] | ||||
|         [Compare(nameof(Password), ErrorMessage = "Passwords must match")] | ||||
|         public string ConfirmPassword { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         [BindProperty, Required] | ||||
|         public string PhoneNumber { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
| @ -140,9 +123,6 @@ namespace EnotaryoPH.Web.Pages | ||||
|         [BindProperty] | ||||
|         public DateTime? CommissionExpiration { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         public string? CommissionLocation { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         public string? OfficeAddress { get; set; } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user