...
This commit is contained in:
60
TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor
Normal file
60
TaxPayerFull/Pages/UserPanel/TaxPayerInvoiceItem.razor
Normal file
@@ -0,0 +1,60 @@
|
||||
@page "/TaxPayerInvoiceItem/{InvoiceID:int}"
|
||||
@using Front.Services
|
||||
@using Shared.DTOs
|
||||
@layout PanelLayout
|
||||
@inject HttpClientController hc;
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
<ConfirmDialog @ref="dialog" />
|
||||
<Toasts AutoHide="true" Delay="6000" class="p-3" Messages="messages" Placement="ToastsPlacement.TopRight" />
|
||||
<PageTitle>آماده سازی صورتحساب</PageTitle>
|
||||
|
||||
@code {
|
||||
private ConfirmDialog dialog = default!;
|
||||
[Parameter] public int? InvoiceID { get; set; }
|
||||
List<ToastMessage> messages = new List<ToastMessage>();
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
public InvoiceDTO? invoice { get; set; }
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
IconName alertIconName = IconName.CheckCircleFill;
|
||||
bool Hidealert = true;
|
||||
string alertMessage = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
@functions{
|
||||
private void ShowSuccessAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Success;
|
||||
alertIconName = IconName.CheckCircleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private void ShowDangerAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
alertColor = AlertColor.Danger;
|
||||
alertIconName = IconName.ExclamationTriangleFill;
|
||||
alertMessage = msg;
|
||||
}
|
||||
private async Task LoadData()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}/{true}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
}
|
||||
else
|
||||
{
|
||||
var request = await rsp.Content.ReadFromJsonAsync<List<string>>();
|
||||
ShowDangerAlert(request[0]);
|
||||
}
|
||||
PreloadService.Hide();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user