52 lines
1.5 KiB
Plaintext
52 lines
1.5 KiB
Plaintext
@page "/admin/companies/create"
|
|
@attribute [Authorize]
|
|
@using TaxBaik.Web.Components.Admin.Forms
|
|
@inject IApiClient ApiClient
|
|
@inject NavigationManager Navigation
|
|
@inject IJSRuntime JS
|
|
|
|
<PageTitle>고객사 등록</PageTitle>
|
|
|
|
<section class="admin-page-hero">
|
|
<div>
|
|
<div class="admin-eyebrow">Settings</div>
|
|
<h1 class="admin-page-title">새 고객사 등록</h1>
|
|
<p class="admin-page-subtitle">새로운 고객사를 추가합니다.</p>
|
|
</div>
|
|
<button type="button" class="site-button secondary" @onclick="GoBack">취소</button>
|
|
</section>
|
|
|
|
<div class="admin-surface mt-4">
|
|
<CompanyForm ButtonText="등록" OnSubmit="HandleCreate" OnCancel="GoBack" />
|
|
</div>
|
|
|
|
@code {
|
|
private void GoBack()
|
|
{
|
|
Navigation.NavigateTo("/taxbaik/admin/companies");
|
|
}
|
|
|
|
private async Task HandleCreate(CompanyForm.CompanyFormModel model)
|
|
{
|
|
try
|
|
{
|
|
await ApiClient.PostAsync<object>("company", new
|
|
{
|
|
companyCode = model.CompanyCode,
|
|
companyName = model.CompanyName,
|
|
contactPerson = model.ContactPerson,
|
|
phone = model.Phone,
|
|
email = model.Email,
|
|
memo = model.Memo
|
|
});
|
|
|
|
await JS.InvokeVoidAsync("alert", "고객사가 등록되었습니다.");
|
|
Navigation.NavigateTo("/taxbaik/admin/companies");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
await JS.InvokeVoidAsync("alert", $"등록 실패: {ex.Message}");
|
|
}
|
|
}
|
|
}
|