93 lines
3.1 KiB
Plaintext
93 lines
3.1 KiB
Plaintext
@page "/admin/dashboard"
|
|
@using TaxBaik.Application.Services
|
|
@attribute [Authorize]
|
|
@inject InquiryService InquiryService
|
|
@inject BlogService BlogService
|
|
|
|
<PageTitle>대시보드</PageTitle>
|
|
|
|
<MudText Typo="Typo.h5" Class="mb-4">📊 대시보드</MudText>
|
|
|
|
<MudGrid>
|
|
<MudItem xs="12" sm="6" md="3">
|
|
<MudPaper Class="pa-4" Elevation="1">
|
|
<MudText Typo="Typo.subtitle2">이번달 문의</MudText>
|
|
<MudText Typo="Typo.h4">@thisMonthInquiries</MudText>
|
|
</MudPaper>
|
|
</MudItem>
|
|
|
|
<MudItem xs="12" sm="6" md="3">
|
|
<MudPaper Class="pa-4" Elevation="1">
|
|
<MudText Typo="Typo.subtitle2">신규 문의</MudText>
|
|
<MudText Typo="Typo.h4">@newInquiries</MudText>
|
|
</MudPaper>
|
|
</MudItem>
|
|
|
|
<MudItem xs="12" sm="6" md="3">
|
|
<MudPaper Class="pa-4" Elevation="1">
|
|
<MudText Typo="Typo.subtitle2">전체 포스트</MudText>
|
|
<MudText Typo="Typo.h4">@totalPosts</MudText>
|
|
</MudPaper>
|
|
</MudItem>
|
|
|
|
<MudItem xs="12" sm="6" md="3">
|
|
<MudPaper Class="pa-4" Elevation="1">
|
|
<MudText Typo="Typo.subtitle2">발행된 포스트</MudText>
|
|
<MudText Typo="Typo.h4">@publishedPosts</MudText>
|
|
</MudPaper>
|
|
</MudItem>
|
|
</MudGrid>
|
|
|
|
<MudPaper Class="pa-4 mt-4" Elevation="1">
|
|
<MudText Typo="Typo.h6" Class="mb-3">최근 문의</MudText>
|
|
<MudSimpleTable Striped="true" Dense="true">
|
|
<thead>
|
|
<tr>
|
|
<th>이름</th>
|
|
<th>전화</th>
|
|
<th>분야</th>
|
|
<th>상태</th>
|
|
<th>날짜</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var inquiry in recentInquiries)
|
|
{
|
|
<tr>
|
|
<td>@inquiry.Name</td>
|
|
<td>@inquiry.Phone</td>
|
|
<td>@inquiry.ServiceType</td>
|
|
<td>
|
|
<MudChip Size="Size.Small"
|
|
Color="@(inquiry.Status == "new" ? Color.Warning : inquiry.Status == "contacted" ? Color.Info : Color.Success)">
|
|
@inquiry.Status
|
|
</MudChip>
|
|
</td>
|
|
<td>@inquiry.CreatedAt.ToString("yyyy-MM-dd")</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</MudSimpleTable>
|
|
</MudPaper>
|
|
|
|
@code {
|
|
private int thisMonthInquiries = 0;
|
|
private int newInquiries = 0;
|
|
private int totalPosts = 0;
|
|
private int publishedPosts = 0;
|
|
private List<Domain.Entities.Inquiry> recentInquiries = [];
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var (inquiries, _) = await InquiryService.GetPagedAsync(1, 100);
|
|
recentInquiries = inquiries.OrderByDescending(x => x.CreatedAt).Take(5).ToList();
|
|
|
|
var now = DateTime.UtcNow;
|
|
thisMonthInquiries = inquiries.Count(x => x.CreatedAt.Year == now.Year && x.CreatedAt.Month == now.Month);
|
|
newInquiries = inquiries.Count(x => x.Status == "new");
|
|
var stats = await BlogService.GetStatsAsync();
|
|
totalPosts = stats.TotalPosts;
|
|
publishedPosts = stats.PublishedPosts;
|
|
}
|
|
}
|