revert: rollback Fluent UI and Blazor homepage to last successful state (3be3794)
This commit is contained in:
@@ -5,39 +5,45 @@
|
||||
@using TaxBaik.Web.Components.Admin.Forms
|
||||
@inject InquiryService InquiryService
|
||||
@inject NavigationManager Navigation
|
||||
@inject IJSRuntime JS
|
||||
@inject ISnackbar Snackbar
|
||||
@inject IDialogService DialogService
|
||||
|
||||
<PageTitle>문의 수정</PageTitle>
|
||||
|
||||
<section class="admin-page-hero">
|
||||
<div>
|
||||
<div class="admin-eyebrow">Customer Relations</div>
|
||||
<h1 class="admin-page-title">문의 수정</h1>
|
||||
<p class="admin-page-subtitle">고객 문의 정보를 수정합니다.</p>
|
||||
<MudText Typo="Typo.caption" Class="admin-eyebrow">Customer Relations</MudText>
|
||||
<MudText Typo="Typo.h4" Class="admin-page-title">문의 수정</MudText>
|
||||
<MudText Typo="Typo.body2" Class="admin-page-subtitle">고객 문의 정보를 수정합니다.</MudText>
|
||||
</div>
|
||||
<button type="button" class="site-button secondary" @onclick="GoBack">취소</button>
|
||||
<MudButton Variant="Variant.Outlined" StartIcon="@Icons.Material.Filled.Close" @onclick="GoBack">취소</MudButton>
|
||||
</section>
|
||||
|
||||
@if (isLoading)
|
||||
{
|
||||
<div class="admin-surface mt-4"><Skeleton Count="4" CssClass="taxbaik-skeleton-grid" /></div>
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="mt-4" />
|
||||
}
|
||||
else if (inquiry == null)
|
||||
{
|
||||
<div class="admin-surface mt-4">문의를 찾을 수 없습니다.</div>
|
||||
<MudAlert Severity="Severity.Error" Class="mt-4">문의를 찾을 수 없습니다.</MudAlert>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="admin-surface mt-4">
|
||||
<MudPaper Class="pa-4 mt-4" Elevation="1">
|
||||
<InquiryForm ButtonText="수정" InitialData="formModel" OnSubmit="HandleUpdate" OnCancel="GoBack" />
|
||||
<div class="mt-4">
|
||||
<button type="button" class="site-button secondary danger" @onclick="DeleteInquiry">문의 삭제</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<MudDivider Class="my-4" />
|
||||
|
||||
<MudButton Variant="Variant.Outlined" Color="Color.Error" @onclick="DeleteInquiry" Class="mt-2">
|
||||
문의 삭제
|
||||
</MudButton>
|
||||
</MudPaper>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public int Id { get; set; }
|
||||
[Parameter]
|
||||
public int Id { get; set; }
|
||||
|
||||
private Domain.Entities.Inquiry? inquiry;
|
||||
private InquiryForm.InquiryFormModel? formModel;
|
||||
private bool isLoading = true;
|
||||
@@ -63,7 +69,7 @@ else
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", $"문의 로드 실패: {ex.Message}");
|
||||
Snackbar.Add($"문의 로드 실패: {ex.Message}", Severity.Error);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -71,11 +77,16 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
private void GoBack() => Navigation.NavigateTo("/taxbaik/admin/inquiries");
|
||||
private void GoBack()
|
||||
{
|
||||
Navigation.NavigateTo("/taxbaik/admin/inquiries");
|
||||
}
|
||||
|
||||
private async Task HandleUpdate(InquiryForm.InquiryFormModel model)
|
||||
{
|
||||
if (inquiry == null) return;
|
||||
if (inquiry == null)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
inquiry.Name = model.Name;
|
||||
@@ -86,35 +97,47 @@ else
|
||||
inquiry.AdminMemo = model.AdminMemo;
|
||||
|
||||
if (inquiry.Status != model.Status)
|
||||
{
|
||||
await InquiryService.UpdateStatusAsync(inquiry.Id, model.Status);
|
||||
}
|
||||
|
||||
await InquiryService.UpdateAdminMemoAsync(inquiry.Id, model.AdminMemo);
|
||||
await JS.InvokeVoidAsync("alert", "문의가 수정되었습니다.");
|
||||
|
||||
Snackbar.Add("문의가 수정되었습니다.", Severity.Success);
|
||||
Navigation.NavigateTo("/taxbaik/admin/inquiries");
|
||||
}
|
||||
catch (ValidationException ex)
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", ex.Message);
|
||||
Snackbar.Add(ex.Message, Severity.Error);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", $"수정 실패: {ex.Message}");
|
||||
Snackbar.Add($"수정 실패: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteInquiry()
|
||||
{
|
||||
if (inquiry == null) return;
|
||||
if (!await JS.InvokeAsync<bool>("confirm", "정말 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.")) return;
|
||||
if (inquiry == null)
|
||||
return;
|
||||
|
||||
var result = await DialogService.ShowMessageBox(
|
||||
"문의 삭제",
|
||||
"정말 삭제하시겠습니까? 이 작업은 취소할 수 없습니다.",
|
||||
"삭제", "취소");
|
||||
|
||||
if (result != true)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
await InquiryService.DeleteAsync(inquiry.Id);
|
||||
await JS.InvokeVoidAsync("alert", "문의가 삭제되었습니다.");
|
||||
Snackbar.Add("문의가 삭제되었습니다.", Severity.Success);
|
||||
Navigation.NavigateTo("/taxbaik/admin/inquiries");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await JS.InvokeVoidAsync("alert", $"삭제 실패: {ex.Message}");
|
||||
Snackbar.Add($"삭제 실패: {ex.Message}", Severity.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user