63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
@page "/admin/inquiries/create"
|
|
@attribute [Authorize]
|
|
@using TaxBaik.Application.DTOs
|
|
@using TaxBaik.Web.Components.Admin.Forms
|
|
@inject IInquiryBrowserClient InquiryClient
|
|
@inject NavigationManager Navigation
|
|
@inject ISnackbar Snackbar
|
|
|
|
<PageTitle>문의 등록</PageTitle>
|
|
|
|
<section class="admin-page-hero">
|
|
<div>
|
|
<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>
|
|
<MudButton Variant="Variant.Outlined" StartIcon="@Icons.Material.Filled.Close" @onclick="GoBack">취소</MudButton>
|
|
</section>
|
|
|
|
<MudPaper Class="pa-4 mt-4" Elevation="1">
|
|
<InquiryForm ButtonText="등록" OnSubmit="HandleCreate" OnCancel="GoBack" />
|
|
</MudPaper>
|
|
|
|
@code {
|
|
private void GoBack()
|
|
{
|
|
Navigation.NavigateTo("/taxbaik/admin/inquiries");
|
|
}
|
|
|
|
private async Task HandleCreate(InquiryForm.InquiryFormModel model)
|
|
{
|
|
try
|
|
{
|
|
var result = await InquiryClient.CreateAsync(new SubmitInquiryDto
|
|
{
|
|
Name = model.Name,
|
|
Phone = model.Phone,
|
|
Email = model.Email,
|
|
ServiceType = model.ServiceType,
|
|
Message = model.Message,
|
|
SuppressNotification = true
|
|
});
|
|
|
|
if (result == null)
|
|
{
|
|
Snackbar.Add("문의가 등록되지 않았습니다.", Severity.Error);
|
|
return;
|
|
}
|
|
|
|
Snackbar.Add("문의가 등록되었습니다.", Severity.Success);
|
|
Navigation.NavigateTo("/taxbaik/admin/inquiries");
|
|
}
|
|
catch (ValidationException ex)
|
|
{
|
|
Snackbar.Add(ex.Message, Severity.Error);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Snackbar.Add($"등록 실패: {ex.Message}", Severity.Error);
|
|
}
|
|
}
|
|
}
|