...
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
@inject Fixedvalues fv;
|
||||
@page "/InvoiceDetails/{InvoiceID:int}"
|
||||
@page "/InvoiceDetails"
|
||||
<Modal @ref="modal" />
|
||||
<Preload LoadingText="در حال بارگذاری..." />
|
||||
<form>
|
||||
@* alert *@
|
||||
@@ -125,16 +126,19 @@
|
||||
<Content>
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-11">
|
||||
<LGridInvoiceItem InvoiceItems="invoice.items" />
|
||||
<LGridInvoiceItem OnMultipleOfThree="EventCallback.Factory.Create<string>(this, CallBack)" InvoiceItems="invoice.items" />
|
||||
</div>
|
||||
<div class="form-group col-md-1">
|
||||
<button class="button-8" role="button">+</button>
|
||||
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="NewItemClick" Outline="true" Type="ButtonType.Button">
|
||||
+
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</Content>
|
||||
</Tab>
|
||||
<Tab Title="پرداختی ها">
|
||||
@* <Tab Title="پرداختی ها">
|
||||
<Content>
|
||||
<div class="row g-3">
|
||||
<div class="form-group col-md-11">
|
||||
@@ -142,15 +146,15 @@
|
||||
</div>
|
||||
<div class="form-group col-md-1">
|
||||
|
||||
<Button class="mt-3" Color="ButtonColor.Secondary" @onclick="OnClickDelete" Type="ButtonType.Button">
|
||||
پرداخت جدید
|
||||
<Button class="mt-3" Color="ButtonColor.Dark" @onclick="OnClickDelete" Outline="true" Type="ButtonType.Button">
|
||||
+
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</Content>
|
||||
</Tab>
|
||||
</Tab> *@
|
||||
|
||||
</Tabs>
|
||||
</div>
|
||||
@@ -195,6 +199,7 @@
|
||||
|
||||
|
||||
@code {
|
||||
private Modal modal = default!;
|
||||
[Inject] protected PreloadService PreloadService { get; set; } = default!;
|
||||
// alert
|
||||
AlertColor alertColor = AlertColor.Primary;
|
||||
@@ -211,7 +216,7 @@
|
||||
invoice = new InvoiceDTO();
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
PreloadService.Show(SpinnerColor.Dark);
|
||||
@@ -219,14 +224,8 @@
|
||||
Patterns = await fv.GetPatterns();
|
||||
if (InvoiceID != null && InvoiceID > 0)
|
||||
{
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
}
|
||||
else
|
||||
hc._nav.NavigateTo("/Pael");
|
||||
|
||||
|
||||
await LoadData();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -247,6 +246,59 @@
|
||||
}
|
||||
}
|
||||
@functions {
|
||||
private async Task NewItemClick()
|
||||
{
|
||||
var parameters = new Dictionary<string, object>();
|
||||
|
||||
|
||||
parameters.Add("itemDTO", new InvoiceItemDTO());
|
||||
parameters.Add("OnMultipleOfThree", EventCallback.Factory.Create<ActionInResultComponent>(this, CallBack));
|
||||
await modal.ShowAsync<CUSComponent.InvoiceItem>(title: "آیتم جدید", parameters: parameters);
|
||||
|
||||
}
|
||||
private async Task LoadData()
|
||||
{
|
||||
var rsp = await hc.Get($"Invoice/Get/{InvoiceID}");
|
||||
if (rsp.IsSuccessStatusCode)
|
||||
{
|
||||
invoice = await rsp.Content.ReadFromJsonAsync<InvoiceDTO>();
|
||||
}
|
||||
else
|
||||
hc._nav.NavigateTo("/Panel");
|
||||
}
|
||||
public async Task CallBack(ActionInResultComponent result)
|
||||
{
|
||||
string msg = "";
|
||||
if (result.Action == ComponentAction.add)
|
||||
{
|
||||
if (result.Status == ComponentStatus.success)
|
||||
msg = "آیتم جدید با موفقیت اضافه شد";
|
||||
|
||||
}
|
||||
// else if (result.Action == ComponentAction.update)
|
||||
// {
|
||||
// if (result.Status == ComponentStatus.success)
|
||||
// msg = "اطلاعات آیتم با موفقیت ویرایش شد";
|
||||
// }
|
||||
// else if (result.Action == ComponentAction.delete)
|
||||
// {
|
||||
// if (result.Status == ComponentStatus.success)
|
||||
// msg = "آیتم با موفقیت حذف شد";
|
||||
// }
|
||||
await CallBack(msg);
|
||||
// if (result.Status == ComponentStatus.success)
|
||||
// await LoadCod(1);
|
||||
|
||||
await modal.HideAsync();
|
||||
}
|
||||
private async Task CallBack(string result)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
{
|
||||
ShowSuccessAlert(result);
|
||||
await LoadData();
|
||||
}
|
||||
}
|
||||
private void ShowSuccessAlert(string msg)
|
||||
{
|
||||
Hidealert = false;
|
||||
|
Reference in New Issue
Block a user