Add admin layout and customer pagination
TaxBaik CI/CD / build-and-deploy (push) Failing after 2m32s
TaxBaik CI/CD / build-and-deploy (push) Failing after 2m32s
This commit is contained in:
@@ -62,7 +62,9 @@
|
||||
@if (Model.Items.Count == 0)
|
||||
{
|
||||
<tr>
|
||||
<td colspan="6" class="text-center text-muted py-5">고객 데이터가 없습니다.</td>
|
||||
<td colspan="6">
|
||||
<partial name="_EmptyState" model="@("검색 결과가 없습니다.")" />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
else
|
||||
@@ -73,7 +75,7 @@
|
||||
<td class="fw-semibold">@item.Name</td>
|
||||
<td>@item.CompanyName</td>
|
||||
<td>@item.Phone</td>
|
||||
<td><span class="badge text-bg-secondary">@item.Status</span></td>
|
||||
<td><partial name="_StatusBadge" model="item.Status" /></td>
|
||||
<td>@item.CreatedAt.ToString("yyyy-MM-dd")</td>
|
||||
<td class="text-end">
|
||||
<a class="btn btn-sm btn-outline-secondary" href="/admin/customers/@item.Id">상세</a>
|
||||
@@ -86,5 +88,6 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<partial name="_Pagination" model="new { Page = Model.CurrentPage, TotalPages = Model.TotalPages, BuildPageUrl = new Func<int, string>(Model.BuildPageUrl) }" />
|
||||
</section>
|
||||
|
||||
@@ -9,18 +9,27 @@ namespace TaxBaik.Web.Pages.Admin.Customers;
|
||||
public class IndexModel(ClientService clientService) : PageModel
|
||||
{
|
||||
public List<TaxBaik.Domain.Entities.Client> Items { get; private set; } = [];
|
||||
public int CurrentPage { get; private set; } = 1;
|
||||
public int TotalPages { get; private set; } = 1;
|
||||
public int TotalCount { get; private set; }
|
||||
|
||||
public string? Search { get; set; }
|
||||
public string? Status { get; set; }
|
||||
public int PageSize { get; set; } = 10;
|
||||
|
||||
public async Task OnGetAsync(string? search, string? status, int pageSize = 10, CancellationToken ct = default)
|
||||
public async Task OnGetAsync(string? search, string? status, int page = 1, int pageSize = 10, CancellationToken ct = default)
|
||||
{
|
||||
Search = search;
|
||||
Status = status;
|
||||
PageSize = pageSize;
|
||||
CurrentPage = Math.Max(1, page);
|
||||
|
||||
var (items, _) = await clientService.GetPagedAsync(1, pageSize, status, search, ct);
|
||||
var (items, total) = await clientService.GetPagedAsync(CurrentPage, pageSize, status, search, ct);
|
||||
Items = items.ToList();
|
||||
TotalCount = total;
|
||||
TotalPages = Math.Max(1, (int)Math.Ceiling(total / (double)pageSize));
|
||||
}
|
||||
|
||||
public string BuildPageUrl(int page) =>
|
||||
$"/admin/customers?search={Uri.EscapeDataString(Search ?? string.Empty)}&status={Uri.EscapeDataString(Status ?? string.Empty)}&page={page}&pageSize={PageSize}";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user