diff --git a/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml b/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml
index cde6dde..1f2fc1b 100644
--- a/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml
+++ b/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml
@@ -11,18 +11,30 @@
Waiting for participants
- -
-
notary1@example.com - host
-
- -
-
principal1@example.com - principal
-
- -
-
principal2@example.com - principal
-
- -
-
witness1@example.com - witness
-
+ @foreach(var participant in Model.Participants)
+ {
+ -
+
+ @if(participant.Status == "Ready") {
+
+ }
+ else {
+
+ }
+ @participant.Email - @participant.Type
+
+
+ }
-
\ No newline at end of file
+
+
+@section Scripts {
+
+}
\ No newline at end of file
diff --git a/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml.cs b/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml.cs
index 56dcbc4..dca1a41 100644
--- a/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml.cs
+++ b/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/Waiting.cshtml.cs
@@ -1,3 +1,5 @@
+using EnotaryoPH.Data;
+using EnotaryoPH.Data.Entities;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
@@ -5,10 +7,67 @@ namespace EnotaryoPH.Web.Pages.Participant.VideoCall
{
public class WaitingModel : PageModel
{
- public void OnGet()
+ private readonly NotaryoDBContext _dbContext;
+ private readonly ICurrentUserService _currentUserService;
+ private Transaction _transactionEntity;
+
+ public WaitingModel(NotaryoDBContext notaryoDBContext, ICurrentUserService currentUserService)
{
+ _dbContext = notaryoDBContext;
+ _currentUserService = currentUserService;
}
+ public IActionResult OnGet()
+ {
+ _transactionEntity = _dbContext.Transactions
+ .Include(t => t.TransactionSignatories)
+ .ThenInclude(ts => ts.User)
+ .Include(t => t.Lawyer)
+ .Include(t => t.Principal)
+ .FirstOrDefault(t => t.Transaction_UID == Transaction_UID);
+ if (_transactionEntity == null)
+ {
+ return NotFound();
+ }
+
+ var participants = _transactionEntity.TransactionSignatories
+ .Select(t => new WaitingForParticipantViewModel
+ {
+ Email = t.Email,
+ Status = ConvertToWaitingStatus(t.Status),
+ Type = t.Email == _currentUserService.GetEmail() ? "(You)" : t.Type,
+ UID = t.TransactionSignatory_UID.GetValueOrDefault()
+ })
+ .ToList();
+
+ if (_transactionEntity.LawyerID > 0)
+ {
+ participants.Add(new WaitingForParticipantViewModel
+ {
+ Email = _transactionEntity.Lawyer.User.Email,
+ Status = "Waiting",
+ Type = nameof(UserType.Notary),
+ UID = Guid.Empty
+ });
+ }
+
+ participants.Add(new WaitingForParticipantViewModel
+ {
+ Email = _transactionEntity.Principal.Email,
+ Status = "Ready",
+ Type = nameof(UserType.Principal),
+ UID = Guid.Empty
+ });
+
+ Participants = participants.OrderBy(p => p.Type).ToList();
+
+ return Page();
+ }
+
+ private string ConvertToWaitingStatus(string status) => status switch { nameof(SignatoryStatus.FaceMatch) => "Ready", _ => "Waiting" };
+
+ public List Participants { get; set; }
+
[BindProperty(SupportsGet = true)]
public Guid Transaction_UID { get; set; }
}
diff --git a/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/WaitingForParticipantViewModel.cs b/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/WaitingForParticipantViewModel.cs
new file mode 100644
index 0000000..df19422
--- /dev/null
+++ b/EnotaryoPH/EnotaryoPH.Web/Pages/Participant/VideoCall/WaitingForParticipantViewModel.cs
@@ -0,0 +1,10 @@
+namespace EnotaryoPH.Web.Pages.Participant.VideoCall
+{
+ public class WaitingForParticipantViewModel
+ {
+ public string Email { get; set; }
+ public string Status { get; set; }
+ public string Type { get; set; }
+ public Guid UID { get; set; }
+ }
+}
\ No newline at end of file