@page "/admin/clients/{ClientId:int}" @attribute [Authorize] @using TaxBaik.Application.Services @inject ClientService ClientService @inject ConsultationService ConsultationService @inject NavigationManager Navigation @inject ISnackbar Snackbar 고객 상세 Client Details 고객 상세 고객 정보와 상담 이력을 관리합니다. @if (client == null) { 고객을 찾을 수 없습니다. return; } Navigation.NavigateTo("/taxbaik/admin/clients"))"> 목록으로 수정 고객 정보 이름 @client.Name 상호 @(client.CompanyName ?? "-") 연락처 @(client.Phone ?? "-") 이메일 @(client.Email ?? "-") 서비스 @(client.ServiceType ?? "-") 사업자 유형 @(client.TaxType ?? "-") 유입 경로 @(client.Source ?? "-") 등록일 @client.CreatedAt.ToLocalTime().ToString("yyyy-MM-dd") @if (!string.IsNullOrWhiteSpace(client.Memo)) { 메모 @client.Memo } 상담 이력 + 상담 추가 @if (showAddForm) { @foreach (var t in ClientService.ServiceTypes) { @t } - @foreach (var r in ConsultationService.Results) { @r } 저장 취소 } @if (consultations.Count == 0) { 상담 이력이 없습니다. } else { @foreach (var c in consultations) { @c.ConsultationDate.ToString("yyyy-MM-dd") @if (!string.IsNullOrEmpty(c.ServiceType)) { · @c.ServiceType } @c.Summary @if (!string.IsNullOrEmpty(c.Result)) { @c.Result } @if (c.Fee.HasValue) { 수임료: @c.Fee.Value.ToString("N0")원 } } } @code { [Parameter] public int ClientId { get; set; } private Domain.Entities.Client? client; private List consultations = []; private bool showAddForm; private DateTime? newDate = DateTime.Today; private string newServiceType = ""; private string newSummary = ""; private string newResult = ""; private decimal? newFee; protected override async Task OnInitializedAsync() { await LoadAll(); } private async Task LoadAll() { client = await ClientService.GetByIdAsync(ClientId); consultations = (await ConsultationService.GetByClientIdAsync(ClientId)).ToList(); } private void OpenAddConsultation() { showAddForm = true; newDate = DateTime.Today; newServiceType = ""; newSummary = ""; newResult = ""; newFee = null; } private async Task AddConsultation() { try { var c = new Domain.Entities.Consultation { ClientId = ClientId, ConsultationDate = newDate?.ToUniversalTime() ?? DateTime.UtcNow, ServiceType = string.IsNullOrWhiteSpace(newServiceType) ? null : newServiceType, Summary = newSummary, Result = string.IsNullOrWhiteSpace(newResult) ? null : newResult, Fee = newFee }; await ConsultationService.CreateAsync(c); showAddForm = false; consultations = (await ConsultationService.GetByClientIdAsync(ClientId)).ToList(); Snackbar.Add("상담이 추가되었습니다.", Severity.Success); } catch (ValidationException ex) { Snackbar.Add(ex.Message, Severity.Error); } } private async Task DeleteConsultation(int id) { await ConsultationService.DeleteAsync(id); consultations = (await ConsultationService.GetByClientIdAsync(ClientId)).ToList(); Snackbar.Add("삭제되었습니다.", Severity.Info); } }