@page "/admin/clients/{ClientId:int}" @attribute [Authorize] @using TaxBaik.Web.Services @using TaxBaik.Web.Services.AdminClients @using TaxBaik.Web.Components.Admin.Shared @inject IClientBrowserClient ClientClient @inject IConsultingActivityBrowserClient ConsultingClient @inject NavigationManager Navigation @inject ISnackbar Snackbar 고객 상세
Client Details 고객 상세 고객 정보와 상담 이력을 관리합니다.
@if (client == null) { 고객을 찾을 수 없습니다. return; } 목록으로 수정 고객 정보 이름 @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 r in 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 static readonly string[] results = ["", "상담완료", "추가자료 요청", "견적발송", "계약전환", "보류"]; 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 ClientClient.GetByIdAsync(ClientId); consultations = (await ConsultingClient.GetByClientIdAsync(ClientId)) .Select(c => new Domain.Entities.Consultation { Id = c.Id, ClientId = c.ClientId, ConsultationDate = c.ActivityDate, ServiceType = c.ActivityType, Summary = c.Description, Result = null, Fee = null }) .ToList(); } private void OpenAddConsultation() { showAddForm = true; newDate = DateTime.Today; newServiceType = ""; newSummary = ""; newResult = ""; newFee = null; } private async Task AddConsultation() { try { var newId = await ConsultingClient.CreateAsync( ClientId, string.IsNullOrWhiteSpace(newServiceType) ? "기타" : newServiceType, newDate?.ToUniversalTime() ?? DateTime.UtcNow, newSummary, null, null); if (newId <= 0) throw new Exception("상담 생성 실패"); showAddForm = false; await LoadAll(); Snackbar.Add("상담이 추가되었습니다.", Severity.Success); } catch (ValidationException ex) { Snackbar.Add(ex.Message, Severity.Error); } catch (Exception ex) { Snackbar.Add(ex.Message, Severity.Error); } } private async Task DeleteConsultation(int id) { await ConsultingClient.DeleteAsync(id); await LoadAll(); Snackbar.Add("삭제되었습니다.", Severity.Info); } }