fix notaryo dashboard
This commit is contained in:
parent
db72814ccc
commit
491f87f106
@ -13,7 +13,7 @@
|
||||
<div class="col-2 col-sm-1 col-md-3 g-0">
|
||||
<div class="sidemenu">
|
||||
<div class="align-items-center sidemenu__menuitem"><a class="d-flex flex-grow-1 justify-content-center align-items-center justify-content-md-start p-1 text-decoration-none" href="#available-transactions"><i class="far fa-check-circle fs-4 text-success sidemenu__menuitem__icon" style="padding: 5px;"></i><span class="d-none d-md-inline-block ms-1 sidemenu__menuitem__text">Available</span></a></div>
|
||||
<div class="align-items-center sidemenu__menuitem"><a class="d-flex flex-grow-1 justify-content-center align-items-center justify-content-md-start p-1 text-decoration-none" href="#incomplete-docs"><i class="far fa-clock fs-4 text-warning sidemenu__menuitem__icon" style="padding: 5px;"></i><span class="d-none d-md-inline-block ms-1 sidemenu__menuitem__text">Incomplete</span></a></div>
|
||||
<div class="align-items-center sidemenu__menuitem"><a class="d-flex flex-grow-1 justify-content-center align-items-center justify-content-md-start p-1 text-decoration-none" href="#incomplete-docs"><i class="far fa-clock fs-4 text-warning sidemenu__menuitem__icon" style="padding: 5px;"></i><span class="d-none d-md-inline-block ms-1 sidemenu__menuitem__text">My Jobs</span></a></div>
|
||||
<div class="align-items-center sidemenu__menuitem"><a class="d-flex flex-grow-1 justify-content-center align-items-center justify-content-md-start p-1 text-decoration-none" href="#identification-docs"><i class="far fa-address-card fs-4 text-dark sidemenu__menuitem__icon" style="padding: 5px;"></i><span class="d-none d-md-inline-block ms-1 sidemenu__menuitem__text">Identification Docs</span></a></div>
|
||||
</div>
|
||||
</div>
|
||||
@ -27,29 +27,49 @@
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Date</th>
|
||||
<th>Status</th>
|
||||
<th>Link</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@* @if (Model.CompletedDocuments.Count > 0)
|
||||
{
|
||||
@foreach (var item in Model.CompletedDocuments)
|
||||
{
|
||||
<tr>
|
||||
<td>@item.Type</td>
|
||||
<td>@item.Date.ToShortDateString()</td>
|
||||
<td><a href="@item.Link">View</a></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
@foreach (var transaction in Model.AvailableItems)
|
||||
{
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
No records to display.
|
||||
</td>
|
||||
<td>@transaction.Type</td>
|
||||
<td>@transaction.Date.ToShortDateString()</td>
|
||||
<td>@transaction.Status</td>
|
||||
<td><a href="@transaction.Link">Link</a></td>
|
||||
</tr>
|
||||
} *@
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="my-transactions" class="row g-0 mb-5">
|
||||
<div class="col">
|
||||
<h3>My Jobs</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Date</th>
|
||||
<td>Status</td>
|
||||
<th>Link</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var transaction in Model.MyItems)
|
||||
{
|
||||
<tr>
|
||||
<td>@transaction.Type</td>
|
||||
<td>@transaction.Date.ToShortDateString()</td>
|
||||
<td>@transaction.Status</td>
|
||||
<td><a href="@transaction.Link">Link</a></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -1,3 +1,4 @@
|
||||
using EnotaryoPH.Data;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
@ -5,8 +6,54 @@ namespace EnotaryoPH.Web.Pages.Notary.Dashboard
|
||||
{
|
||||
public class DashboardModel : PageModel
|
||||
{
|
||||
public void OnGet()
|
||||
private readonly NotaryoDBContext _dbContext;
|
||||
private readonly ICurrentUserService _currentUserService;
|
||||
|
||||
public DashboardModel(NotaryoDBContext dbContext, ICurrentUserService currentUserService)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_currentUserService = currentUserService;
|
||||
}
|
||||
|
||||
public IActionResult OnGet()
|
||||
{
|
||||
var currentUser = _dbContext.Users
|
||||
.Single(u => u.User_UID == _currentUserService.GetUser_UID());
|
||||
|
||||
AvailableItems = _dbContext.Transactions
|
||||
.Include(t => t.TransactionDocument)
|
||||
.Include(t => t.Lawyer)
|
||||
.Include(t => t.PreferredLawyer)
|
||||
.Where(t => t.Status == nameof(TransactionState.Submitted) && t.Lawyer.UserID != currentUser.UserID && t.PreferredLawyer.UserID != currentUser.UserID)
|
||||
.Select(t => new DashboardItem
|
||||
{
|
||||
Date = t.TransactionDate,
|
||||
Link = $"/Notary/TransactionStatus/{t.Transaction_UID}",
|
||||
Status = t.Status,
|
||||
Type = t.TransactionDocument.DocumentType
|
||||
})
|
||||
.OrderByDescending(t => t.Date)
|
||||
.ToList();
|
||||
|
||||
MyItems = _dbContext.Transactions
|
||||
.Include(t => t.TransactionDocument)
|
||||
.Include(t => t.Lawyer)
|
||||
.Include(t => t.PreferredLawyer)
|
||||
.Where(t => (t.Status == nameof(TransactionState.Submitted) && t.PreferredLawyer.UserID == currentUser.UserID) || (t.Status == nameof(TransactionState.Accepted) && t.Lawyer.UserID == currentUser.UserID))
|
||||
.Select(t => new DashboardItem
|
||||
{
|
||||
Date = t.TransactionDate,
|
||||
Link = t.Status == nameof(TransactionState.Accepted) ? $"/Participant/VideoCall/Room/{t.Transaction_UID}" : $"/Notary/TransactionStatus/{t.Transaction_UID}",
|
||||
Status = t.Status,
|
||||
Type = t.TransactionDocument.DocumentType
|
||||
})
|
||||
.OrderByDescending(t => t.Date)
|
||||
.ToList();
|
||||
|
||||
return Page();
|
||||
}
|
||||
|
||||
public List<DashboardItem> AvailableItems { get; set; }
|
||||
public List<DashboardItem> MyItems { get; set; }
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
namespace EnotaryoPH.Web.Pages.Notary.Dashboard
|
||||
{
|
||||
public class DashboardItem
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
public string Link { get; set; }
|
||||
public string Status { get; set; }
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user