revert: rollback Fluent UI and Blazor homepage to last successful state (3be3794)
This commit is contained in:
@@ -6,74 +6,117 @@
|
||||
@using TaxBaik.Domain.Entities
|
||||
@inject IClientBrowserClient ClientClient
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JS
|
||||
@inject ISnackbar Snackbar
|
||||
|
||||
<PageTitle>@(Id.HasValue ? "고객 수정" : "고객 등록")</PageTitle>
|
||||
|
||||
<section class="admin-page-hero">
|
||||
<div>
|
||||
<div class="admin-eyebrow">CRM</div>
|
||||
<h1 class="admin-page-title">@(Id.HasValue ? "고객 수정" : "고객 등록")</h1>
|
||||
<MudText Typo="Typo.caption" Class="admin-eyebrow">CRM</MudText>
|
||||
<MudText Typo="Typo.h4" Class="admin-page-title">@(Id.HasValue ? "고객 수정" : "고객 등록")</MudText>
|
||||
</div>
|
||||
<button type="button" class="site-button secondary" @onclick='() => Navigation.NavigateTo("/taxbaik/admin/clients")'>목록으로</button>
|
||||
<MudButton Variant="Variant.Outlined" Href="/taxbaik/admin/clients"
|
||||
StartIcon="@Icons.Material.Filled.ArrowBack">목록으로</MudButton>
|
||||
</section>
|
||||
|
||||
<div class="admin-surface" style="max-width:720px;">
|
||||
<MudPaper Class="admin-surface" Elevation="0" Style="max-width:720px;">
|
||||
@if (isLoading)
|
||||
{
|
||||
<Skeleton Count="5" CssClass="taxbaik-skeleton-grid" />
|
||||
<MudProgressLinear Indeterminate="true" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<form class="admin-dialog-card" @onsubmit="SaveAsync" @onsubmit:preventDefault="true">
|
||||
<label>고객명 * <input class="admin-input" @bind="dto.Name" /></label>
|
||||
<label>회사명 <input class="admin-input" @bind="dto.CompanyName" /></label>
|
||||
<label>연락처 <input class="admin-input" @bind="dto.Phone" /></label>
|
||||
<label>이메일 <input class="admin-input" type="email" @bind="dto.Email" /></label>
|
||||
<label>서비스 유형
|
||||
<select class="admin-input" @bind="dto.ServiceType">
|
||||
<option value="">선택하세요</option>
|
||||
@foreach (var t in ClientService.ServiceTypes)
|
||||
{
|
||||
<option value="@t">@t</option>
|
||||
}
|
||||
</select>
|
||||
</label>
|
||||
<label>세금 유형
|
||||
<select class="admin-input" @bind="dto.TaxType">
|
||||
<option value="">선택하세요</option>
|
||||
@foreach (var t in ClientService.TaxTypes)
|
||||
{
|
||||
<option value="@t">@t</option>
|
||||
}
|
||||
</select>
|
||||
</label>
|
||||
<label>상태
|
||||
<select class="admin-input" @bind="dto.Status">
|
||||
<option value="active">활성</option>
|
||||
<option value="inactive">비활성</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>유입 경로
|
||||
<select class="admin-input" @bind="dto.Source">
|
||||
<option value="">선택하세요</option>
|
||||
@foreach (var s in ClientService.Sources)
|
||||
{
|
||||
<option value="@s">@s</option>
|
||||
}
|
||||
</select>
|
||||
</label>
|
||||
<label>메모 <textarea class="admin-input" rows="4" @bind="dto.Memo"></textarea></label>
|
||||
<div class="admin-dialog-actions">
|
||||
<button type="submit" class="site-button primary" disabled="@isSaving">저장</button>
|
||||
<button type="button" class="site-button secondary" @onclick='() => Navigation.NavigateTo("/taxbaik/admin/clients")'>취소</button>
|
||||
</div>
|
||||
</form>
|
||||
<MudForm @ref="form" @bind-IsValid="isValid">
|
||||
<MudGrid Spacing="3">
|
||||
@* 기본 정보 *@
|
||||
<MudItem xs="12">
|
||||
<MudText Typo="Typo.subtitle1" Class="fw-bold mb-1">기본 정보</MudText>
|
||||
<MudDivider />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField @bind-Value="dto.Name" Label="고객명 *" Required="true"
|
||||
RequiredError="고객명을 입력하세요." />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField @bind-Value="dto.CompanyName" Label="회사명 (선택)" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField @bind-Value="dto.Phone" Label="연락처"
|
||||
Placeholder="010-0000-0000" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudTextField @bind-Value="dto.Email" Label="이메일" InputType="InputType.Email" />
|
||||
</MudItem>
|
||||
|
||||
@* 세무 정보 *@
|
||||
<MudItem xs="12" Class="mt-2">
|
||||
<MudText Typo="Typo.subtitle1" Class="fw-bold mb-1">세무 정보</MudText>
|
||||
<MudDivider />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="dto.ServiceType" Label="서비스 유형" T="string" Clearable="true">
|
||||
@foreach (var t in ClientService.ServiceTypes)
|
||||
{
|
||||
<MudSelectItem Value="@t">@t</MudSelectItem>
|
||||
}
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="dto.TaxType" Label="세금 유형" T="string" Clearable="true">
|
||||
@foreach (var t in ClientService.TaxTypes)
|
||||
{
|
||||
<MudSelectItem Value="@t">@t</MudSelectItem>
|
||||
}
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
|
||||
@* 관리 정보 *@
|
||||
<MudItem xs="12" Class="mt-2">
|
||||
<MudText Typo="Typo.subtitle1" Class="fw-bold mb-1">관리 정보</MudText>
|
||||
<MudDivider />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="dto.Status" Label="상태 *" T="string" Required="true">
|
||||
<MudSelectItem Value="@("active")">활성</MudSelectItem>
|
||||
<MudSelectItem Value="@("inactive")">비활성</MudSelectItem>
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<MudSelect @bind-Value="dto.Source" Label="유입 경로" T="string" Clearable="true">
|
||||
@foreach (var s in ClientService.Sources)
|
||||
{
|
||||
<MudSelectItem Value="@s">@s</MudSelectItem>
|
||||
}
|
||||
</MudSelect>
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField @bind-Value="dto.Memo" Label="메모"
|
||||
Lines="4" AutoGrow="true"
|
||||
Placeholder="상담 배경, 특이사항, 중요 날짜 등 자유롭게 기록하세요" />
|
||||
</MudItem>
|
||||
|
||||
@* 저장 버튼 *@
|
||||
<MudItem xs="12" Class="d-flex gap-2 mt-2">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Filled.Save"
|
||||
OnClick="@SaveAsync" Disabled="@isSaving">
|
||||
@(isSaving ? "저장 중..." : "저장")
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Outlined" Href="/taxbaik/admin/clients">
|
||||
취소
|
||||
</MudButton>
|
||||
</MudItem>
|
||||
</MudGrid>
|
||||
</MudForm>
|
||||
}
|
||||
</div>
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[Parameter] public int? Id { get; set; }
|
||||
|
||||
private MudForm form = null!;
|
||||
private CreateClientDto dto = new() { Status = "active" };
|
||||
private bool isValid;
|
||||
private bool isLoading = true;
|
||||
private bool isSaving;
|
||||
|
||||
@@ -86,7 +129,7 @@
|
||||
var client = await ClientClient.GetByIdAsync(Id.Value);
|
||||
if (client is null)
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", "고객을 찾을 수 없습니다.");
|
||||
Snackbar.Add("고객을 찾을 수 없습니다.", Severity.Error);
|
||||
Navigation.NavigateTo("/taxbaik/admin/clients");
|
||||
return;
|
||||
}
|
||||
@@ -102,42 +145,46 @@
|
||||
Source = client.Source,
|
||||
Memo = client.Memo
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", $"오류: {ex.Message}");
|
||||
Navigation.NavigateTo("/taxbaik/admin/clients");
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Add($"오류: {ex.Message}", Severity.Error);
|
||||
Navigation.NavigateTo("/taxbaik/admin/clients");
|
||||
return;
|
||||
}
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
private async Task SaveAsync()
|
||||
{
|
||||
await form.Validate();
|
||||
if (!isValid) return;
|
||||
|
||||
isSaving = true;
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(dto.Name))
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", "고객명을 입력하세요.");
|
||||
return;
|
||||
}
|
||||
if (Id.HasValue)
|
||||
{
|
||||
var result = await ClientClient.UpdateAsync(Id.Value, dto);
|
||||
await JS.InvokeVoidAsync("alert", result != null ? "고객 정보가 수정되었습니다." : "수정에 실패했습니다.");
|
||||
if (result != null)
|
||||
Snackbar.Add("고객 정보가 수정되었습니다.", Severity.Success);
|
||||
else
|
||||
Snackbar.Add("수정에 실패했습니다.", Severity.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = await ClientClient.CreateAsync(dto);
|
||||
await JS.InvokeVoidAsync("alert", result != null ? "고객이 등록되었습니다." : "등록에 실패했습니다.");
|
||||
if (result != null)
|
||||
Snackbar.Add("고객이 등록되었습니다.", Severity.Success);
|
||||
else
|
||||
Snackbar.Add("등록에 실패했습니다.", Severity.Error);
|
||||
}
|
||||
Navigation.NavigateTo("/taxbaik/admin/clients");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", $"저장 실패: {ex.Message}");
|
||||
Snackbar.Add($"저장 실패: {ex.Message}", Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user