#478 contribs page
This commit is contained in:
parent
50284f9d3b
commit
600e01d1f2
@ -10,6 +10,8 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
||||
using Microsoft.AspNetCore.Mvc.ViewFeatures;
|
||||
using RMuseum.Models.Generic.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace GanjooRazor.Pages
|
||||
{
|
||||
@ -146,8 +148,8 @@ namespace GanjooRazor.Pages
|
||||
var days = JArray.Parse(await responseDays.Content.ReadAsStringAsync()).ToObject<List<GroupedByDateViewModel>>();
|
||||
|
||||
List<GroupedByUserViewModel> users = null;
|
||||
|
||||
if(dataType != "users")
|
||||
PaginationMetadata usersPagination = null;
|
||||
if (dataType != "users")
|
||||
{
|
||||
var responseUsers = await _httpClient.GetAsync($"{APIRoot.Url}/api/contributions/{dataType}/by/user?PageNumber=1&PageSize=30");
|
||||
|
||||
@ -156,7 +158,7 @@ namespace GanjooRazor.Pages
|
||||
return new BadRequestObjectResult(JsonConvert.DeserializeObject<string>(await responseUsers.Content.ReadAsStringAsync()));
|
||||
}
|
||||
users = JArray.Parse(await responseUsers.Content.ReadAsStringAsync()).ToObject<List<GroupedByUserViewModel>>();
|
||||
|
||||
usersPagination = JsonConvert.DeserializeObject<PaginationMetadata>(responseDays.Headers.GetValues("paging-headers").Single());
|
||||
}
|
||||
|
||||
var response = await _httpClient.GetAsync($"{APIRoot.Url}/api/contributions/{dataType}/summary");
|
||||
@ -176,7 +178,9 @@ namespace GanjooRazor.Pages
|
||||
{
|
||||
DataType = dataType,
|
||||
Days = days.ToArray(),
|
||||
DaysPagination = JsonConvert.DeserializeObject<PaginationMetadata>(responseDays.Headers.GetValues("paging-headers").Single()),
|
||||
Users = users == null ? null :users.ToArray(),
|
||||
UsersPagination = usersPagination,
|
||||
Summary = summary
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using RMuseum.Models.Generic.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
|
||||
namespace GanjooRazor.Pages
|
||||
{
|
||||
@ -7,9 +8,9 @@ namespace GanjooRazor.Pages
|
||||
{
|
||||
public string DataType { get; set; }
|
||||
public GroupedByDateViewModel[] Days { get; set; }
|
||||
|
||||
public PaginationMetadata DaysPagination { get; set; }
|
||||
public GroupedByUserViewModel[] Users { get; set; }
|
||||
|
||||
public PaginationMetadata UsersPagination { get; set; }
|
||||
public SummedUpViewModel Summary { get; set; }
|
||||
|
||||
public _GroupedByDateViewTablePartialModel TableModel
|
||||
@ -19,7 +20,9 @@ namespace GanjooRazor.Pages
|
||||
return new _GroupedByDateViewTablePartialModel()
|
||||
{
|
||||
Days = Days,
|
||||
DaysPagination = DaysPagination,
|
||||
Users = Users,
|
||||
UsersPagination = UsersPagination,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,11 @@
|
||||
}
|
||||
@if (Model.Days == null || Model.Days.Length == 0) return;
|
||||
|
||||
<div class="pagination-controls">
|
||||
<button id="dailyPrevPage" class="btn btn-primary" onclick="loadDailyPage('prev')" disabled>صفحهٔ قبل</button>
|
||||
<span id="dailyCurrentPage">در حال بارگذاری...</span>
|
||||
<button id="dailyNextPage" class="btn btn-primary" onclick="loadDailyPage('next')">صفحهٔ بعد</button>
|
||||
</div>
|
||||
<table class="stats" id="grouped-by-date">
|
||||
<thead>
|
||||
<tr class="h">
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using RMuseum.Models.Generic.ViewModels;
|
||||
using RSecurityBackend.Models.Generic;
|
||||
|
||||
namespace GanjooRazor.Pages
|
||||
{
|
||||
public class _GroupedByDateViewTablePartialModel : PageModel
|
||||
{
|
||||
public GroupedByDateViewModel[] Days { get; set; }
|
||||
|
||||
public PaginationMetadata DaysPagination { get; set; }
|
||||
public GroupedByUserViewModel[] Users { get; set; }
|
||||
public PaginationMetadata UsersPagination { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -744,6 +744,14 @@ td.c2 {
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
pagination-controls {
|
||||
margin: 20px 0;
|
||||
gap: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
|
||||
@media(max-width: 768px) {
|
||||
.b {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user