feat: implement admin inquiry create/edit/delete functionality
TaxBaik CI/CD / build-and-deploy (push) Successful in 48s
TaxBaik CI/CD / build-and-deploy (push) Successful in 48s
Core Components: - Create reusable InquiryForm.razor component following SOLID principles - Implement InquiryCreate.razor for registering new inquiries (offline, phone) - Implement InquiryEdit.razor for modifying existing inquiries with delete - Add DeleteAsync method to InquiryRepository and InquiryService - Update InquiryList with 'Create' button and Edit link in table Architecture: - InquiryForm: Encapsulates form logic, can be reused for create/edit - Service Layer: All operations go through InquiryService for cache invalidation - Repository Pattern: Database operations isolated in InquiryRepository - UI Consistency: Both pages follow admin-page-hero pattern Features: - Admin can create inquiries from phone/offline consultations - Admin can modify inquiry details (name, phone, email, message, status, memo) - Admin can delete inquiries with confirmation dialog - All operations update dashboard cache - Status validation and error handling throughout Testing: - Updated FakeInquiryRepository in tests to implement DeleteAsync
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
@using TaxBaik.Application.DTOs
|
||||
@using TaxBaik.Application.Services
|
||||
|
||||
<MudForm @ref="form">
|
||||
<MudTextField @bind-Value="model.Name" Label="이름"
|
||||
Variant="Variant.Outlined" Class="mb-4" Required="true" />
|
||||
|
||||
<MudTextField @bind-Value="model.Phone" Label="전화번호 (예: 010-1234-5678)"
|
||||
Variant="Variant.Outlined" Class="mb-4" Required="true" />
|
||||
|
||||
<MudTextField @bind-Value="model.Email" Label="이메일"
|
||||
Variant="Variant.Outlined" Class="mb-4" InputType="InputType.Email" />
|
||||
|
||||
<MudSelect @bind-Value="model.ServiceType" Label="문의 유형"
|
||||
Variant="Variant.Outlined" Class="mb-4">
|
||||
<MudSelectItem Value="@("사업자세무")">사업자세무</MudSelectItem>
|
||||
<MudSelectItem Value="@("부동산세금")">부동산세금</MudSelectItem>
|
||||
<MudSelectItem Value="@("가족자산")">가족자산</MudSelectItem>
|
||||
<MudSelectItem Value="@("기타")">기타</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudTextField @bind-Value="model.Message" Label="문의 내용"
|
||||
Variant="Variant.Outlined" Lines="5" Class="mb-4" Required="true" />
|
||||
|
||||
<MudSelect @bind-Value="model.Status" Label="상태"
|
||||
Variant="Variant.Outlined" Class="mb-4">
|
||||
<MudSelectItem Value="@("new")">신규</MudSelectItem>
|
||||
<MudSelectItem Value="@("consulting")">상담중</MudSelectItem>
|
||||
<MudSelectItem Value="@("contracted")">계약완료</MudSelectItem>
|
||||
<MudSelectItem Value="@("rejected")">거절</MudSelectItem>
|
||||
<MudSelectItem Value="@("closed")">종결</MudSelectItem>
|
||||
</MudSelect>
|
||||
|
||||
<MudTextField @bind-Value="model.AdminMemo" Label="관리 메모"
|
||||
Variant="Variant.Outlined" Lines="3" Class="mb-4" />
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" @onclick="HandleSubmit">
|
||||
@ButtonText
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Outlined" @onclick="OnCancel">취소</MudButton>
|
||||
</div>
|
||||
</MudForm>
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired]
|
||||
public string ButtonText { get; set; } = "저장";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<InquiryFormModel> OnSubmit { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback OnCancel { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public InquiryFormModel? InitialData { get; set; }
|
||||
|
||||
private MudForm? form;
|
||||
private InquiryFormModel model = new();
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
if (InitialData != null)
|
||||
{
|
||||
model = new InquiryFormModel
|
||||
{
|
||||
Name = InitialData.Name,
|
||||
Phone = InitialData.Phone,
|
||||
Email = InitialData.Email,
|
||||
ServiceType = InitialData.ServiceType,
|
||||
Message = InitialData.Message,
|
||||
Status = InitialData.Status,
|
||||
AdminMemo = InitialData.AdminMemo
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HandleSubmit()
|
||||
{
|
||||
if (form == null)
|
||||
return;
|
||||
|
||||
await form.Validate();
|
||||
if (!form.IsValid)
|
||||
return;
|
||||
|
||||
await OnSubmit.InvokeAsync(model);
|
||||
}
|
||||
|
||||
public class InquiryFormModel
|
||||
{
|
||||
public string Name { get; set; } = "";
|
||||
public string Phone { get; set; } = "";
|
||||
public string? Email { get; set; }
|
||||
public string ServiceType { get; set; } = "기타";
|
||||
public string Message { get; set; } = "";
|
||||
public string Status { get; set; } = "new";
|
||||
public string? AdminMemo { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user