This commit is contained in:
mmrbnjd
2024-10-14 17:38:18 +03:30
parent 831e5fafec
commit 595a9ea5d8
2 changed files with 12 additions and 2 deletions

View File

@@ -42,7 +42,7 @@
<input @bind-value="itemsearch.ZipCode" placeholder="کد پستی" style="text-align:center" dir="ltr" class="form-control" type="number"> <input @bind-value="itemsearch.ZipCode" placeholder="کد پستی" style="text-align:center" dir="ltr" class="form-control" type="number">
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button @onclick="() => LoadCus(1)" type="submit" class="btn btn-primary">جستجو</button> <Button Disabled="SpinnerVisible" @onclick="() => LoadCus(1)" Color="ButtonColor.Primary">جستجو</Button>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" /> <Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />

View File

@@ -54,7 +54,10 @@
OnChanged="(ForCustomerSearch customer) => OnAutoCompleteChanged(customer)" /> OnChanged="(ForCustomerSearch customer) => OnAutoCompleteChanged(customer)" />
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button @onclick="() => LoadInvoice(1)" type="submit" class="btn btn-primary">جستجو</button> <Button Disabled="SpinnerVisible" @onclick="() => LoadInvoice(1)" Color="ButtonColor.Primary">جستجو</Button>
</div>
<div class="col-auto">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div> </div>
</div> </div>
</li> </li>
@@ -120,6 +123,7 @@
@layout PanelLayout @layout PanelLayout
@code { @code {
public bool SpinnerVisible { get; set; } = false;
private string? customerName; private string? customerName;
public IEnumerable<ForCustomerSearch>? customers; public IEnumerable<ForCustomerSearch>? customers;
public List<IdName<int>> Patterns { get; set; } public List<IdName<int>> Patterns { get; set; }
@@ -147,6 +151,7 @@
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
SpinnerVisible = true;
if (PageIndex == null) PageIndex = 1; if (PageIndex == null) PageIndex = 1;
if (!string.IsNullOrEmpty(input)) if (!string.IsNullOrEmpty(input))
{ {
@@ -158,6 +163,7 @@
} }
await LoadInvoice(PageIndex.Value); await LoadInvoice(PageIndex.Value);
SpinnerVisible = false;
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }
} }
@@ -178,6 +184,7 @@
} }
public async Task LoadInvoice(int pi) public async Task LoadInvoice(int pi)
{ {
SpinnerVisible = true;
if (ItemSearchInvoicetype == 100 || ItemSearchInvoicetype == null) if (ItemSearchInvoicetype == 100 || ItemSearchInvoicetype == null)
itemsearch.invoiceType = null; itemsearch.invoiceType = null;
else else
@@ -200,6 +207,7 @@
ShowDangerAlert("خطایی در اجرای عملیات رخ داده"); ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
} }
PreloadService.Hide(); PreloadService.Hide();
SpinnerVisible = false;
} }
public async Task CallBackInvoiceItem(ActionInResultComponent result) public async Task CallBackInvoiceItem(ActionInResultComponent result)
{ {
@@ -260,6 +268,7 @@
//------------------------ //------------------------
private async Task<List<ForCustomerSearch>> GetCustomers() private async Task<List<ForCustomerSearch>> GetCustomers()
{ {
SpinnerVisible = true;
return await fv.GetCustomers(); return await fv.GetCustomers();
// var rsp = await hc.Get("Customer/GetAllForidName"); // var rsp = await hc.Get("Customer/GetAllForidName");
// if (rsp.IsSuccessStatusCode) // if (rsp.IsSuccessStatusCode)
@@ -267,6 +276,7 @@
// return await rsp.Content.ReadFromJsonAsync<List<ForCustomerSearch>>(); // return await rsp.Content.ReadFromJsonAsync<List<ForCustomerSearch>>();
// } // }
// return new List<ForCustomerSearch>(); // return new List<ForCustomerSearch>();
SpinnerVisible = false;
} }
private void OnAutoCompleteChanged(ForCustomerSearch customer) private void OnAutoCompleteChanged(ForCustomerSearch customer)