@page "/admin/tax-filings" @attribute [Authorize] @using TaxBaik.Web.Services @using TaxBaik.Domain.Entities @inject ITaxFilingBrowserClient FilingClient @inject IClientBrowserClient ClientClient @inject IJSRuntime JS 신고 일정 관리
Tax Schedule

신고 일정

고객별 세금 신고 마감일을 관리하고 완료 처리합니다.

@if (showAddForm) {

새 신고 일정

}
@if (CurrentFilings.Count == 0) {
항목이 없습니다.
} else {
@foreach (var filing in CurrentFilings) { var dday = (filing.DueDate.Date - DateTime.Today).Days; }
고객 신고 유형 기한 D-day 메모 처리
@filing.ClientName @filing.FilingType @filing.DueDate.ToString("yyyy-MM-dd") @if (dday < 0) { D+@(-dday) } else if (dday <= 7) { D-@dday } else { D-@dday } @(filing.Memo ?? "")
@if (filing.Status == "pending") { }
}
@code { private List allFilings = []; private List clients = []; private bool showAddForm; private string activeTab = "pending"; private int selectedClientId; private string newFilingType = ""; private DateTime? newDueDate = DateTime.Today.AddDays(30); private string newMemo = ""; private string SelectedClientIdText { get => selectedClientId > 0 ? selectedClientId.ToString() : ""; set => selectedClientId = int.TryParse(value, out var id) ? id : 0; } private string DueDateText { get => newDueDate?.ToString("yyyy-MM-dd") ?? ""; set => newDueDate = DateTime.TryParse(value, out var dt) ? dt : null; } private List CurrentFilings => activeTab switch { "filed" => allFilings.Where(x => x.Status == "filed").ToList(), "overdue" => allFilings.Where(x => x.Status == "overdue").ToList(), _ => allFilings.Where(x => x.Status == "pending").ToList() }; protected override async Task OnInitializedAsync() => await Reload(); private async Task Reload() { try { allFilings = (await FilingClient.GetUpcomingAsync(365)).ToList(); var (clientItems, _) = await ClientClient.GetPagedAsync(pageSize: 1000); clients = clientItems.ToList(); } catch (Exception ex) { await JS.InvokeVoidAsync("alert", $"오류: {ex.Message}"); } } private async Task AddFiling() { try { if (selectedClientId <= 0) { await JS.InvokeVoidAsync("alert", "고객을 선택하세요."); return; } var filing = new TaxFiling { ClientId = selectedClientId, FilingType = newFilingType, DueDate = newDueDate?.ToUniversalTime() ?? DateTime.UtcNow, Status = "pending", Memo = string.IsNullOrWhiteSpace(newMemo) ? null : newMemo }; var result = await FilingClient.CreateAsync(filing); if (result != null) { showAddForm = false; await JS.InvokeVoidAsync("alert", "신고 일정이 추가되었습니다."); await Reload(); } else { await JS.InvokeVoidAsync("alert", "추가 실패"); } } catch (Exception ex) { await JS.InvokeVoidAsync("alert", $"오류: {ex.Message}"); } } private async Task MarkFiled(TaxFiling filing) { filing.Status = "filed"; await FilingClient.UpdateAsync(filing.Id, filing); await JS.InvokeVoidAsync("alert", "신고 완료 처리되었습니다."); await Reload(); } private async Task DeleteFiling(int id) { if (!await JS.InvokeAsync("confirm", "삭제하시겠습니까?")) return; await FilingClient.DeleteAsync(id); await JS.InvokeVoidAsync("alert", "삭제되었습니다."); await Reload(); } private static string GetClientDisplayName(Client client) => !string.IsNullOrWhiteSpace(client.CompanyName) ? client.CompanyName : !string.IsNullOrWhiteSpace(client.Name) ? client.Name : $"Client #{client.Id}"; }