This commit is contained in:
mmrbnjd
2024-10-14 16:26:20 +03:30
parent 35cad6876b
commit 831e5fafec
3 changed files with 22 additions and 5 deletions

View File

@@ -109,7 +109,7 @@ else
} }
} }
</div> </div>
<div class="col-md-2" style="align-content:center"> <div class="col-md-2" >
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" /> <Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div> </div>
</div> </div>

View File

@@ -43,7 +43,10 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
<button @onclick="() => LoadCod(1)" type="submit" class="btn btn-primary">جستجو</button> <Button @onclick="() => LoadCod(1)" Color="ButtonColor.Primary">جستجو</Button>
</div>
<div class="col-auto">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div> </div>
</div> </div>
</li> </li>
@@ -125,6 +128,7 @@
@layout PanelLayout @layout PanelLayout
@code { @code {
public bool SpinnerVisible { get; set; } = false;
//private Modal stuffmodal = default!; //private Modal stuffmodal = default!;
[Inject] protected PreloadService PreloadService { get; set; } = default!; [Inject] protected PreloadService PreloadService { get; set; } = default!;
ItemSerchGetCOD itemsearch = new ItemSerchGetCOD(); ItemSerchGetCOD itemsearch = new ItemSerchGetCOD();
@@ -141,15 +145,18 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
SpinnerVisible = true;
Unitrequest =await fv.GetUnits(); Unitrequest =await fv.GetUnits();
SpinnerVisible = false;
await base.OnInitializedAsync(); await base.OnInitializedAsync();
} }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
SpinnerVisible = false;
if (PageIndex == null) PageIndex = 1; if (PageIndex == null) PageIndex = 1;
await LoadCod(PageIndex.Value); await LoadCod(PageIndex.Value);
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }
} }
@@ -170,6 +177,7 @@
} }
public async Task LoadCod(int pi) public async Task LoadCod(int pi)
{ {
SpinnerVisible = true;
if (itemsearch.UnitID == 0) itemsearch.UnitID = null; if (itemsearch.UnitID == 0) itemsearch.UnitID = null;
itemsearch.PageSize = 10; itemsearch.PageSize = 10;
itemsearch.PageIndex = pi; itemsearch.PageIndex = pi;
@@ -188,6 +196,7 @@
ShowDangerAlert("خطایی در اجرای عملیات رخ داده"); ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
} }
PreloadService.Hide(); PreloadService.Hide();
SpinnerVisible = false;
} }
public async Task CallBackCodItem(ActionInResultComponent result) public async Task CallBackCodItem(ActionInResultComponent result)
{ {

View File

@@ -44,6 +44,9 @@
<div class="col-auto"> <div class="col-auto">
<button @onclick="() => LoadCus(1)" type="submit" class="btn btn-primary">جستجو</button> <button @onclick="() => LoadCus(1)" type="submit" class="btn btn-primary">جستجو</button>
</div> </div>
<div class="col-auto">
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
</div>
</div> </div>
</li> </li>
</ul> </ul>
@@ -62,6 +65,7 @@
<div class="col-auto"> <div class="col-auto">
<button type="submit" @onclick="()=>CustomerItem(0)" class="btn btn-primary">جدید</button> <button type="submit" @onclick="()=>CustomerItem(0)" class="btn btn-primary">جدید</button>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
@@ -108,7 +112,7 @@
@layout PanelLayout @layout PanelLayout
@code { @code {
public bool SpinnerVisible { get; set; } = false;
[Inject] protected PreloadService PreloadService { get; set; } = default!; [Inject] protected PreloadService PreloadService { get; set; } = default!;
public int? ItemSearchCustomertype { get; set; } public int? ItemSearchCustomertype { get; set; }
ItemSerchGetCustomer itemsearch = new ItemSerchGetCustomer(); ItemSerchGetCustomer itemsearch = new ItemSerchGetCustomer();
@@ -124,8 +128,10 @@
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
SpinnerVisible = true;
if (PageIndex == null) PageIndex = 1; if (PageIndex == null) PageIndex = 1;
await LoadCus(PageIndex.Value); await LoadCus(PageIndex.Value);
SpinnerVisible = false;
await base.OnParametersSetAsync(); await base.OnParametersSetAsync();
} }
} }
@@ -146,6 +152,7 @@
} }
public async Task LoadCus(int pi) public async Task LoadCus(int pi)
{ {
SpinnerVisible = true;
if (ItemSearchCustomertype > 0) if (ItemSearchCustomertype > 0)
itemsearch.CustomerType = (CustomerType)ItemSearchCustomertype; itemsearch.CustomerType = (CustomerType)ItemSearchCustomertype;
else else
@@ -168,6 +175,7 @@
ShowDangerAlert("خطایی در اجرای عملیات رخ داده"); ShowDangerAlert("خطایی در اجرای عملیات رخ داده");
} }
PreloadService.Hide(); PreloadService.Hide();
SpinnerVisible = false;
} }
public async Task CallBackCustomerItem(ActionInResultComponent result) public async Task CallBackCustomerItem(ActionInResultComponent result)
{ {