Refine admin login flow and verification harness
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m21s
TaxBaik CI/CD / build-and-deploy (push) Successful in 2m21s
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: true))
|
||||
@attribute [Authorize]
|
||||
@using TaxBaik.Web.Services
|
||||
@using TaxBaik.Domain.Entities
|
||||
@inject IFaqBrowserClient FaqClient
|
||||
@inject NavigationManager Navigation
|
||||
@inject ISnackbar Snackbar
|
||||
@@ -24,7 +23,7 @@
|
||||
<MudForm @ref="form" @bind-IsValid="isValid">
|
||||
<MudGrid Spacing="3">
|
||||
<MudItem xs="12">
|
||||
<MudTextField @bind-Value="faq.Question"
|
||||
<MudTextField @bind-Value="model.Question"
|
||||
Label="질문 *" Required="true"
|
||||
RequiredError="질문을 입력하세요."
|
||||
Counter="300" MaxLength="300"
|
||||
@@ -32,24 +31,24 @@
|
||||
Placeholder="예: 기장료가 얼마인지 미리 알 수 있나요?" />
|
||||
</MudItem>
|
||||
<MudItem xs="12">
|
||||
<MudTextField @bind-Value="faq.Answer"
|
||||
<MudTextField @bind-Value="model.Answer"
|
||||
Label="답변 *" Required="true"
|
||||
RequiredError="답변을 입력하세요."
|
||||
Lines="5" AutoGrow="true"
|
||||
Placeholder="방문자에게 보여질 답변을 입력하세요." />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="6">
|
||||
<CommonCodeSelect @bind-Value="faq.Category" Group="FAQ_CATEGORY" Label="카테고리" Clearable="true" Placeholder="전체" />
|
||||
<CommonCodeSelect @bind-Value="model.Category" Group="FAQ_CATEGORY" Label="카테고리" Clearable="true" Placeholder="전체" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="3">
|
||||
<MudNumericField @bind-Value="faq.SortOrder"
|
||||
<MudNumericField @bind-Value="model.SortOrder"
|
||||
Label="정렬 순서"
|
||||
HelperText="작을수록 위에 노출"
|
||||
Min="0" Max="9999" />
|
||||
</MudItem>
|
||||
<MudItem xs="12" md="3" Class="d-flex align-center">
|
||||
<MudSwitch T="bool" @bind-Value="faq.IsActive" Color="Color.Success"
|
||||
Label="@(faq.IsActive ? "노출 중" : "비활성")" />
|
||||
<MudSwitch T="bool" @bind-Value="model.IsActive" Color="Color.Success"
|
||||
Label="@(model.IsActive ? "노출 중" : "비활성")" />
|
||||
</MudItem>
|
||||
|
||||
<MudItem xs="12" Class="d-flex gap-2 mt-2">
|
||||
@@ -71,7 +70,7 @@
|
||||
[Parameter] public int? Id { get; set; }
|
||||
|
||||
private MudForm form = null!;
|
||||
private Faq faq = new() { SortOrder = 10, IsActive = true };
|
||||
private FaqFormModel model = new() { SortOrder = 10, IsActive = true };
|
||||
private bool isValid;
|
||||
private bool isLoading = true;
|
||||
private bool isSaving;
|
||||
@@ -97,7 +96,14 @@
|
||||
Navigation.NavigateTo("/taxbaik/admin/faqs");
|
||||
return;
|
||||
}
|
||||
faq = existing;
|
||||
model = new FaqFormModel
|
||||
{
|
||||
Question = existing.Question,
|
||||
Answer = existing.Answer,
|
||||
Category = existing.Category,
|
||||
SortOrder = existing.SortOrder,
|
||||
IsActive = existing.IsActive
|
||||
};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -117,6 +123,16 @@
|
||||
isSaving = true;
|
||||
try
|
||||
{
|
||||
var faq = new Faq
|
||||
{
|
||||
Id = Id ?? 0,
|
||||
Question = model.Question,
|
||||
Answer = model.Answer,
|
||||
Category = model.Category,
|
||||
SortOrder = model.SortOrder,
|
||||
IsActive = model.IsActive
|
||||
};
|
||||
|
||||
if (Id.HasValue)
|
||||
{
|
||||
var result = await FaqClient.UpdateAsync(Id.Value, faq);
|
||||
@@ -144,4 +160,5 @@
|
||||
isSaving = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user