fix Waiting page
This commit is contained in:
parent
53dc8152cf
commit
938a4f03f7
@ -11,18 +11,30 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<h1>Waiting for participants</h1>
|
<h1>Waiting for participants</h1>
|
||||||
<ul id="ParticipantsWaitStatus" class="list-unstyled">
|
<ul id="ParticipantsWaitStatus" class="list-unstyled">
|
||||||
<li class="my-2">
|
@foreach(var participant in Model.Participants)
|
||||||
<div><i class="far fa-check-circle text-success me-1 fa-fw" data-bs-toggle="tooltip" data-bss-tooltip title="Ready"></i><span>notary1@example.com </span><span class="ms-1">- host</span></div>
|
{
|
||||||
</li>
|
<li class="my-2">
|
||||||
<li class="my-2">
|
<div>
|
||||||
<div><i class="far fa-check-circle text-success me-1 fa-fw" data-bs-toggle="tooltip" data-bss-tooltip title="Ready"></i><span>principal1@example.com </span><span class="ms-1">- principal</span></div>
|
@if(participant.Status == "Ready") {
|
||||||
</li>
|
<i class="far fa-check-circle text-success me-1 fa-fw" data-bs-toggle="tooltip" data-bss-tooltip title="@participant.Status"></i>
|
||||||
<li class="my-2">
|
}
|
||||||
<div><i class="far fa-check-circle text-success me-1 fa-fw" data-bs-toggle="tooltip" data-bss-tooltip title="Ready"></i><span>principal2@example.com </span><span class="ms-1">- principal</span></div>
|
else {
|
||||||
</li>
|
<i class="far fa-hourglass text-muted me-1 fa-fw" data-bs-toggle="tooltip" data-bss-tooltip title="@participant.Status"></i>
|
||||||
<li class="my-2">
|
}
|
||||||
<div><i class="far fa-hourglass text-muted me-1 fa-fw" data-bs-toggle="tooltip" data-bss-tooltip title="Waiting..."></i><span>witness1@example.com </span><span class="ms-1">- witness</span></div>
|
<span>@participant.Email </span><span class="ms-1"> - @participant.Type</span>
|
||||||
</li>
|
</div>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@section Scripts {
|
||||||
|
<script>
|
||||||
|
|
||||||
|
receiveUserNotificationCallback = function(message) {
|
||||||
|
let json = tryParseJson(message);
|
||||||
|
alert('yoloooo: @(User.Identity.Name) ' + json.UserEmail);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
using EnotaryoPH.Data;
|
||||||
|
using EnotaryoPH.Data.Entities;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||||
|
|
||||||
@ -5,10 +7,67 @@ namespace EnotaryoPH.Web.Pages.Participant.VideoCall
|
|||||||
{
|
{
|
||||||
public class WaitingModel : PageModel
|
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<WaitingForParticipantViewModel> Participants { get; set; }
|
||||||
|
|
||||||
[BindProperty(SupportsGet = true)]
|
[BindProperty(SupportsGet = true)]
|
||||||
public Guid Transaction_UID { get; set; }
|
public Guid Transaction_UID { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -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; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user