refactor interface to show gradually
This commit is contained in:
parent
a9cb522919
commit
66c92811ea
3 changed files with 22 additions and 20 deletions
|
@ -15,9 +15,9 @@
|
|||
//
|
||||
*@
|
||||
|
||||
@if (Loading)
|
||||
@if (ShowMe)
|
||||
{
|
||||
<div class="m-5 @(Loading ? "visible" : "invisible")">
|
||||
<div class="m-5">
|
||||
<div class="d-flex justify-content-center">
|
||||
<!-- loader credit: samherbert.net/svg-loaders -->
|
||||
<img src="/svg-loaders/three-dots.svg" alt="loading ..."/>
|
||||
|
|
|
@ -6,10 +6,17 @@ namespace Wonky.Client.Components;
|
|||
public partial class LoaderThreeDots
|
||||
{
|
||||
[Parameter] public bool Loading { get; set; } = true;
|
||||
[Parameter] public int Timeout { get; set; } = 30000;
|
||||
private bool ShowMe { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
ShowMe = Loading;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Delay(30000);
|
||||
Loading = false;
|
||||
await Task.Delay(Timeout);
|
||||
ShowMe = false;
|
||||
}
|
||||
}
|
|
@ -35,31 +35,26 @@ public partial class CrmCompanyInventoryPage : IDisposable
|
|||
private List<ProductInventoryView> Inventory { get; set; } = new();
|
||||
private bool Loading { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
Toaster.ShowInfo("Varekøb opdateres ....", "Vent venligst");
|
||||
Interceptor.RegisterEvent();
|
||||
Interceptor.RegisterBeforeSendEvent();
|
||||
Company = await CompanyRepo.GetCompanyById(CompanyId);
|
||||
var ts = await CrmHistoryRepo.UpdateProductHistory(Company.CompanyId, $"{DateTime.Parse(Company.HistorySync):yyyy-MM-dd}");;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await RefreshHistory();
|
||||
}
|
||||
|
||||
private async Task RefreshHistory()
|
||||
{
|
||||
Toaster.ShowInfo("Varekøb opdateres ....", "Vent venligst");
|
||||
Inventory = await CrmHistoryRepo.FetchInventory(CompanyId);
|
||||
Inventory = Inventory.OrderBy(x => x.Description).ToList();
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
// private async Task RefreshHistory()
|
||||
// {
|
||||
// _working = true;
|
||||
// _btnUpdateText = "vent venligst ...";
|
||||
// _toast.ShowInfo("Vent mens data checkes ...");
|
||||
// var ts = await CrmHistoryRepo.UpdateProductHistory(_company.CompanyId, $"{DateTime.Parse(_company.HistorySync):yyyy-MM-dd}");;
|
||||
// _company.HistorySync = ts.Replace("\"", "");
|
||||
// _btnUpdateText = "check";
|
||||
// _inventory = await CrmHistoryRepo.FetchInventory(CompanyId);
|
||||
// _inventory = _inventory.OrderBy(x => x.Description).ToList();
|
||||
// _working = false;
|
||||
// }
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Interceptor.DisposeEvent();
|
||||
|
|
Loading…
Reference in a new issue