participant registration page
This commit is contained in:
		
							parent
							
								
									b426163ac4
								
							
						
					
					
						commit
						4cafd88502
					
				| @ -4,6 +4,7 @@ | ||||
|     { | ||||
|         New = 0, | ||||
|         EmailSent = 1, | ||||
|         Registered = 2 | ||||
|         Registered = 2, | ||||
|         FaceMatch = 3 | ||||
|     } | ||||
| } | ||||
| @ -5,34 +5,37 @@ namespace EnotaryoPH.Data.Entities | ||||
|     [Table("TransactionSignatories")] | ||||
|     public class TransactionSignatory | ||||
|     { | ||||
|         [Column("TransactionSignatoryID")] | ||||
|         public int TransactionSignatoryID { get; set; } | ||||
| 
 | ||||
|         [Column("TransactionID")] | ||||
|         public int TransactionID { get; set; } | ||||
| 
 | ||||
|         [Column("UserID")] | ||||
|         public int? UserID { get; set; } | ||||
| 
 | ||||
|         [Column("CreatedOn")] | ||||
|         public DateTime? CreatedOn { get; set; } | ||||
| 
 | ||||
|         [Column("Status")] | ||||
|         public string Status { get; set; } | ||||
| 
 | ||||
|         [Column("Email")] | ||||
|         public string Email { get; set; } | ||||
| 
 | ||||
|         [Column("Type")] | ||||
|         public string Type { get; set; } | ||||
|         [Column("InvitationCode")] | ||||
|         public string InvitationCode { get; set; } | ||||
| 
 | ||||
|         [Column("Status")] | ||||
|         public string Status { get; set; } | ||||
| 
 | ||||
|         [ForeignKey("TransactionID")] | ||||
|         public Transaction Transaction { get; set; } | ||||
| 
 | ||||
|         [Column("TransactionID")] | ||||
|         public int TransactionID { get; set; } | ||||
| 
 | ||||
|         [Column("TransactionSignatory_UID")] | ||||
|         public Guid? TransactionSignatory_UID { get; set; } | ||||
| 
 | ||||
|         [Column("InvitationCode")] | ||||
|         public string InvitationCode { get; set; } | ||||
|         [Column("TransactionSignatoryID")] | ||||
|         public int TransactionSignatoryID { get; set; } | ||||
| 
 | ||||
|         [ForeignKey("TransactionID")] | ||||
|         public Transaction Transaction { get; set; } | ||||
|         [Column("Type")] | ||||
|         public string Type { get; set; } | ||||
| 
 | ||||
|         [ForeignKey("UserID")] | ||||
|         public User? User { get; set; } | ||||
| 
 | ||||
|         [Column("UserID")] | ||||
|         public int? UserID { get; set; } | ||||
|     } | ||||
| } | ||||
| @ -10,7 +10,7 @@ | ||||
| 
 | ||||
|         public static string NullIfWhiteSpace(this string s) => string.IsNullOrWhiteSpace(s) ? null : s; | ||||
| 
 | ||||
|         public static Guid ToGuidFromString(this string s) | ||||
|         public static Guid ToGuidFromBase64(this string s) | ||||
|         { | ||||
|             if (s.Length != 22) | ||||
|             { | ||||
|  | ||||
| @ -40,6 +40,10 @@ namespace EnotaryoPH.Web.Common.Jobs | ||||
|                 MainPrincipalName = name, | ||||
|                 SignatoryType = signatory.Type | ||||
|             })); | ||||
| 
 | ||||
|             signatory.Status = nameof(SignatoryStatus.EmailSent); | ||||
|             _notaryoDBContext.TransactionSignatories.Update(signatory); | ||||
|             _notaryoDBContext.SaveChanges(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -2,3 +2,61 @@ | ||||
| @model EnotaryoPH.Web.Pages.Participant.Registration.IndexModel | ||||
| @{ | ||||
| } | ||||
| 
 | ||||
| @section Head { | ||||
|     <link href="\lib\fontawesome-free-6.7.1-web\css\all.min.css" rel="stylesheet" /> | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| <div class="container"> | ||||
|     <h1 class="my-4">Principal/Witness Registration</h1> | ||||
|     <div class="row mb-5"> | ||||
|         <div class="col-12 col-md-8 col-lg-6 col-xl-5"> | ||||
|             <form method="post"> | ||||
|                 <input type="hidden" asp-for="TransactionSignatory_UID" /> | ||||
|                 <div class="row mt-3"> | ||||
|                     <div class="col"> | ||||
|                         <label class="form-label">Enter your Birthdate</label> | ||||
|                         <div class="row"> | ||||
|                             <div class="col"><input asp-for="Year" class="form-control mb-3" type="number" placeholder="Year" required /></div> | ||||
|                             <div class="col"><input asp-for="Month" class="form-control mb-3" type="number" placeholder="Month" required /></div> | ||||
|                             <div class="col"><input asp-for="Day" class="form-control mb-3" type="number" placeholder="Day" required /></div> | ||||
|                         </div> | ||||
|                         @Html.ValidationMessage("Birthdate") | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="row mt-3"> | ||||
|                     <div class="col"> | ||||
|                         <label class="form-label">Enter your Phone Number</label> | ||||
|                         <div class="row"> | ||||
|                             <div class="col"><input asp-for="PhoneNumber" class="form-control mb-3" type="text" placeholder="Phone Number" required /></div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="row mt-3"> | ||||
|                     <div class="col"> | ||||
|                         <label class="form-label">Enter your Name</label> | ||||
|                         <div class="row"> | ||||
|                             <div class="col-12 col-md-6"><input asp-for="Firstname" class="form-control mb-3" type="text" placeholder="Firstname" required /></div> | ||||
|                             <div class="col"><input asp-for="Lastname" class="form-control mb-3" type="text" placeholder="Lastname" required /></div> | ||||
|                         </div> | ||||
|                         <div class="row"> | ||||
|                             <div class="col-12 col-md-6"><input asp-for="Middlename" class="form-control mb-3" type="text" placeholder="Middlename" /></div> | ||||
|                             <div class="col"><input asp-for="Prefix" class="form-control mb-3" type="text" placeholder="Prefix" /></div> | ||||
|                             <div class="col"><input asp-for="Suffix" class="form-control mb-3" type="text" placeholder="Suffix" /></div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="row mt-3 mb-0"> | ||||
|                     <div class="col"> | ||||
|                         <div class="form-check"><input id="EighteenYearsOrOlder" class="form-check-input" type="checkbox" required /><label class="form-check-label" for="EighteenYearsOrOlder">I am 18 years old or older</label></div> | ||||
|                         <button type="submit" class="btn btn-primary btn-lg"> | ||||
|                             CONTINUE | ||||
|                             <i class="fas fa-chevron-right ms-2"></i> | ||||
|                         </button> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </form> | ||||
|         </div> | ||||
|     </div> | ||||
| </div> | ||||
| @ -1,3 +1,6 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
| using EnotaryoPH.Data; | ||||
| using EnotaryoPH.Data.Entities; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Microsoft.AspNetCore.Mvc.RazorPages; | ||||
| 
 | ||||
| @ -5,9 +8,113 @@ namespace EnotaryoPH.Web.Pages.Participant.Registration | ||||
| { | ||||
|     public class IndexModel : PageModel | ||||
|     { | ||||
|         public IActionResult OnGet() => Page(); | ||||
|         private readonly NotaryoDBContext _notaryoDBContext; | ||||
| 
 | ||||
|         public IndexModel(NotaryoDBContext notaryoDBContext) => _notaryoDBContext = notaryoDBContext; | ||||
| 
 | ||||
|         public IActionResult OnGet() | ||||
|         { | ||||
|             if (string.IsNullOrEmpty(InvitationCode)) | ||||
|             { | ||||
|                 return NotFound(); | ||||
|             } | ||||
| 
 | ||||
|             var invitationCodeGuid = InvitationCode.ToGuidFromBase64(); | ||||
|             var signatory = _notaryoDBContext.TransactionSignatories.FirstOrDefault(e => e.InvitationCode == invitationCodeGuid.ToString() && e.Status == nameof(SignatoryStatus.New)); | ||||
|             if (signatory == null) | ||||
|             { | ||||
|                 return NotFound(); | ||||
|             } | ||||
| 
 | ||||
|             var existingUser = _notaryoDBContext.Users.FirstOrDefault(e => e.Email.ToLower() == signatory.Email.ToLower()); | ||||
|             if (existingUser != null) | ||||
|             { | ||||
|                 signatory.Status = nameof(SignatoryStatus.Registered); | ||||
|                 signatory.UserID = existingUser.UserID; | ||||
|                 _notaryoDBContext.Update(signatory); | ||||
|                 _notaryoDBContext.SaveChanges(); | ||||
|                 return Redirect("Steps/UploadIdentification"); | ||||
|             } | ||||
| 
 | ||||
|             TransactionSignatory_UID = signatory.TransactionSignatory_UID.GetValueOrDefault(); | ||||
| 
 | ||||
|             return Page(); | ||||
|         } | ||||
| 
 | ||||
|         public IActionResult OnPost() | ||||
|         { | ||||
|             if (!ModelState.IsValid) | ||||
|             { | ||||
|                 return Page(); | ||||
|             } | ||||
| 
 | ||||
|             if (TransactionSignatory_UID == Guid.Empty) | ||||
|             { | ||||
|                 ModelState.AddModelError(nameof(TransactionSignatory_UID), "TransactionSignatory_UID is missing."); | ||||
|                 return Page(); | ||||
|             } | ||||
| 
 | ||||
|             var signatory = _notaryoDBContext.TransactionSignatories.FirstOrDefault(e => e.TransactionSignatory_UID == TransactionSignatory_UID && e.Status == nameof(SignatoryStatus.New)); | ||||
|             if (signatory == null) | ||||
|             { | ||||
|                 return BadRequest(); | ||||
|             } | ||||
| 
 | ||||
|             var newUser = new User | ||||
|             { | ||||
|                 BirthDate = new DateTime(Year.Value, Month.Value, Day.Value, 0, 0, 0, DateTimeKind.Utc), | ||||
|                 CreatedOn = DateTime.UtcNow, | ||||
|                 Email = signatory.Email, | ||||
|                 Firstname = Firstname, | ||||
|                 Lastname = Lastname, | ||||
|                 Middlename = Middlename, | ||||
|                 PhoneNumber = PhoneNumber, | ||||
|                 Prefix = Prefix, | ||||
|                 Role = signatory.Type, | ||||
|                 Suffix = Suffix, | ||||
|                 User_UID = Guid.CreateVersion7(DateTime.UtcNow), | ||||
|                 PasswordHash = "secret" | ||||
|             }; | ||||
|             _notaryoDBContext.Add(newUser); | ||||
|             signatory.User = newUser; | ||||
|             signatory.Status = nameof(SignatoryStatus.Registered); | ||||
|             _notaryoDBContext.Update(signatory); | ||||
|             _notaryoDBContext.SaveChanges(); | ||||
| 
 | ||||
|             return Redirect("Steps/UploadIdentification"); | ||||
|         } | ||||
| 
 | ||||
|         [BindProperty(SupportsGet = true)] | ||||
|         public string InvitationCode { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         public Guid TransactionSignatory_UID { get; set; } | ||||
| 
 | ||||
|         [BindProperty, Required] | ||||
|         public int? Year { get; set; } | ||||
| 
 | ||||
|         [BindProperty, Required] | ||||
|         public int? Month { get; set; } | ||||
| 
 | ||||
|         [BindProperty, Required] | ||||
|         public int? Day { get; set; } | ||||
| 
 | ||||
|         [BindProperty, Required] | ||||
|         public string PhoneNumber { get; set; } | ||||
| 
 | ||||
|         [BindProperty, Required] | ||||
|         public string Firstname { get; set; } | ||||
| 
 | ||||
|         [BindProperty, Required] | ||||
|         public string Lastname { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         public string? Middlename { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         public string? Suffix { get; set; } | ||||
| 
 | ||||
|         [BindProperty] | ||||
|         public string? Prefix { get; set; } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,106 @@ | ||||
| @page | ||||
| @model EnotaryoPH.Web.Pages.Participant.Registration.Steps.UploadIdentificationModel | ||||
| 
 | ||||
| <section class="mt-5 mb-2"> | ||||
|     <div class="container"> | ||||
|         <h1>Registration Steps</h1> | ||||
|         <div class="mt-3"> | ||||
|             <ul id="transactionwizardnav" class="nav nav-pills nav-justified d-block d-sm-flex" role="tablist"> | ||||
|                 <li class="nav-item" role="presentation"> | ||||
|                     <a class="nav-link active" role="tab" data-bs-toggle="pill" href="#tab-1"> | ||||
|                         <div><span class="badge rounded-pill fs-6 me-1">STEP 1</span></div><span class="text-dark step-text">Choose Identification</span> | ||||
|                     </a> | ||||
|                 </li> | ||||
|                 <li class="nav-item" role="presentation"> | ||||
|                     <a class="nav-link disabled" role="tab" data-bs-toggle="pill" href="#" style="border-bottom-width: 3px;border-bottom-color: var(--bs-body-color);"> | ||||
|                         <div class="text-dark"><span class="badge rounded-pill fs-6 me-1">STEP 2</span></div><span class="text-dark step-text">Take Selfie</span> | ||||
|                     </a> | ||||
|                 </li> | ||||
|             </ul> | ||||
|             <div class="tab-content mt-3"></div> | ||||
|         </div> | ||||
|         <div> | ||||
|             <div class="row mt-4 mb-3"> | ||||
|                 <div class="col"> | ||||
|                     <div class="d-flex"> | ||||
|                         <div class="form-check me-2"><input id="checkUpload" class="form-check-input" type="radio" checked value="UploadNew" name="NewOrOld" /><label class="form-check-label me-3" for="checkUpload">Upload a new Identification Document</label></div> | ||||
|                         <div class="form-check"><input id="checkUseExisting" class="form-check-input" type="radio" value="UseExisting" name="NewOrOld" /><label class="form-check-label" for="checkUseExisting">Use any of the existing Identification Documents</label></div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|             <div class="row mt-4"> | ||||
|                 <div class="col-12 col-lg-4"> | ||||
|                     <div class="card" data-bss-baguettebox> | ||||
|                         <a href="cody passport.webp"><img class="card-img w-100 d-block fit-cover rounded-top" src="cody passport.webp" style="height: 300px;" /></a> | ||||
|                         <div class="card-body p-2"> | ||||
|                             <p class="card-text mb-1">passport-2024-12-07__final.jpg</p> | ||||
|                             <div><button class="btn btn-secondary btn-sm me-1" type="button">Upload Photo<i class="fas fa-upload ms-1"></i></button></div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|                 <div class="col"> | ||||
|                     <div class="row"> | ||||
|                         <div class="col-12 col-lg-7"> | ||||
|                             <div> | ||||
|                                 <label class="form-label">Type</label><select class="form-select"> | ||||
|                                     <option value="12" selected>Driver's License</option> | ||||
|                                     <option value="13">This is item 2</option> | ||||
|                                     <option value="14">This is item 3</option> | ||||
|                                 </select> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                         <div class="col-12 col-lg-7"> | ||||
|                             <div class="mb-3"><label class="form-label">ID Number</label><input class="form-control" type="text" /></div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                     <div class="row"> | ||||
|                         <div class="col-12 col-lg-7"> | ||||
|                             <div class="mb-3"><label class="form-label">Place Issued</label><input class="form-control" type="text" /></div> | ||||
|                         </div> | ||||
|                         <div class="col-12 col-lg-7"> | ||||
|                             <div class="row"> | ||||
|                                 <div class="col-12 col-sm-6"> | ||||
|                                     <div class="mb-3"><label class="form-label">Expiration Date</label><input id="name-1" class="form-control" name="name" placeholder="Name" value="2024-11-30" type="date" /></div> | ||||
|                                 </div> | ||||
|                                 <div class="col-12 col-sm-6"> | ||||
|                                     <div class="mb-3"><label class="form-label">Date Issued</label><input id="name-4" class="form-control" name="name" placeholder="Name" value="2024-11-30" type="date" /></div> | ||||
|                                 </div> | ||||
|                             </div> | ||||
|                         </div> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|             <div class="row mt-4"> | ||||
|                 <div class="col"> | ||||
|                     <h4>Existing Identification Documents</h4> | ||||
|                     <div class="table-responsive"> | ||||
|                         <table class="table"> | ||||
|                             <thead> | ||||
|                                 <tr> | ||||
|                                     <th>Identification Document Type</th> | ||||
|                                     <th>Uploaded On</th> | ||||
|                                     <th></th> | ||||
|                                 </tr> | ||||
|                             </thead> | ||||
|                             <tbody> | ||||
|                                 <tr> | ||||
|                                     <td>Driver's License</td> | ||||
|                                     <td>2024-11-31</td> | ||||
|                                     <td><button class="btn btn-danger btn-sm identificationdocument__delete__button" type="button"><i class="fas fa-times me-1"></i><span class="d-none d-md-inline-block">Delete</span></button></td> | ||||
|                                 </tr> | ||||
|                                 <tr> | ||||
|                                     <td>Passport</td> | ||||
|                                     <td>2024-12-17</td> | ||||
|                                     <td><button class="btn btn-danger btn-sm" type="button"><i class="fas fa-times me-1"></i><span class="d-none d-md-inline-block">Delete</span></button></td> | ||||
|                                 </tr> | ||||
|                             </tbody> | ||||
|                         </table> | ||||
|                     </div> | ||||
|                 </div> | ||||
|             </div> | ||||
|         </div> | ||||
|         <div class="d-flex mt-4"> | ||||
|             <div class="flex-grow-1"></div><a class="btn btn-primary btn-lg" role="button" href="/participant/onboardingwizard2_selfie.html">NEXT<i class="fas fa-chevron-right ms-2"></i></a> | ||||
|         </div> | ||||
|     </div> | ||||
| </section> | ||||
| @ -0,0 +1,12 @@ | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| using Microsoft.AspNetCore.Mvc.RazorPages; | ||||
| 
 | ||||
| namespace EnotaryoPH.Web.Pages.Participant.Registration.Steps | ||||
| { | ||||
|     public class UploadIdentificationModel : PageModel | ||||
|     { | ||||
|         public void OnGet() | ||||
|         { | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user