From 156ec9c558c7ffb2e5c16d008c367da72f59023c Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Tue, 12 Sep 2023 06:59:44 +0200 Subject: [PATCH] created working variable callback instead of layout --- ...mponent.razor => InfoColorComponent.razor} | 0 ...razor.css => InfoColorComponent.razor.css} | 0 .../OfficeCountryCustomerListComponent.razor | 7 +-- ...fficeCountryCustomerListComponent.razor.cs | 43 ++++++++------ .../OfficeCountryCustomerViewComponent.razor | 59 ------------------- Wonky.Client/Pages/InfoPage.razor | 2 +- .../OfficeCustomerCountryPagedListPage.razor | 4 +- ...fficeCustomerCountryPagedListPage.razor.cs | 4 +- Wonky.Client/wwwroot/appsettings.json | 2 +- Wonky.Client/wwwroot/css/app.css | 1 + 10 files changed, 36 insertions(+), 86 deletions(-) rename Wonky.Client/Components/{InfoColorCustomerComponent.razor => InfoColorComponent.razor} (100%) rename Wonky.Client/Components/{InfoColorCustomerComponent.razor.css => InfoColorComponent.razor.css} (100%) delete mode 100644 Wonky.Client/Components/OfficeCountryCustomerViewComponent.razor diff --git a/Wonky.Client/Components/InfoColorCustomerComponent.razor b/Wonky.Client/Components/InfoColorComponent.razor similarity index 100% rename from Wonky.Client/Components/InfoColorCustomerComponent.razor rename to Wonky.Client/Components/InfoColorComponent.razor diff --git a/Wonky.Client/Components/InfoColorCustomerComponent.razor.css b/Wonky.Client/Components/InfoColorComponent.razor.css similarity index 100% rename from Wonky.Client/Components/InfoColorCustomerComponent.razor.css rename to Wonky.Client/Components/InfoColorComponent.razor.css diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor index f8b32ae4..b525b86f 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor @@ -18,10 +18,6 @@ @using Wonky.Client.Helpers; @using Wonky.Client.OverlayOffice -@if (Working) -{ - -} @if (CompanyList.Any()) {
@@ -88,6 +84,9 @@ +
+ +
diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs index 534c48c1..c9093d08 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs @@ -47,7 +47,9 @@ public partial class OfficeCountryCustomerListComponent : IDisposable [Parameter] public List CompanyList { get; set; } = new(); // [Parameter] public EventCallback OnOrderItem { get; set; } [CascadingParameter] public DraftStateProvider DraftProvider { get; set; } - + + [Parameter] public EventCallback SetWorking { get; set; } + // ****************************************************** // overlays private OfficeCustomerInvoiceListOverlay InvoiceListOverlay { get; set; } = new(); @@ -68,48 +70,55 @@ public partial class OfficeCountryCustomerListComponent : IDisposable Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); } - - private async Task ShowInvoiceList(string companyId) + + private async Task RequestBusinessCentralData(string companyId, bool force) { - Working = true; + await SetWorking.InvokeAsync(true); SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); // call erp to crm sync before requesting invoices await Task.Delay(500); - var newSyncDate = await HistoryRepo.RequestErpToCrmSync(companyId, SelectedCompany.HistorySync, false); - while (string.IsNullOrEmpty(newSyncDate)) + var newSyncDate = await HistoryRepo.RequestErpToCrmSync(companyId, SelectedCompany.HistorySync, force); + while (string.IsNullOrWhiteSpace(newSyncDate)) { await Task.Delay(500); } + + await SetWorking.InvokeAsync(false); + } + + private async Task ShowInvoiceList(string companyId) + { + await SetWorking.InvokeAsync(true); + SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); + // call erp to crm sync before requesting invoices + await Task.Delay(500); + await RequestBusinessCentralData(companyId, false); InvoiceList = await HistoryRepo.GetInvoiceList(CountryCode, companyId); InvoiceListOverlay.Show(); - Working = false; + await SetWorking.InvokeAsync(false); } private async Task ShowActivityList(string companyId) { - Working = true; + await SetWorking.InvokeAsync(true); SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); await Task.Delay(500); ActivityList = await ActivityRepo.GetActivityList(companyId); await Task.Delay(500); ActivityListOverlay.Show(); - Working = false; + await SetWorking.InvokeAsync(false); } private async Task ShowInventory(string companyId) { - Working = true; + await SetWorking.InvokeAsync(true); SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); Logger.LogDebug("SelectedCompany => {}", JsonSerializer.Serialize(SelectedCompany)); await Task.Delay(500); - var newSyncDate = await HistoryRepo.RequestErpToCrmSync(companyId, SelectedCompany.HistorySync, true); - while (string.IsNullOrEmpty(newSyncDate)) - { - await Task.Delay(500); - } + await RequestBusinessCentralData(companyId, false); // request inventory await Task.Delay(500); ProductInventory = await HistoryRepo.GetInventory(SelectedCompany.CountryCode, SelectedCompany.CompanyId); @@ -117,11 +126,11 @@ public partial class OfficeCountryCustomerListComponent : IDisposable Logger.LogDebug("ProductInventory => {}", JsonSerializer.Serialize(ProductInventory)); // show the overlay InventoryListOverlay.Show(); - Working = false; + await SetWorking.InvokeAsync(false); } - private void ShowOrder(string companyId) + private void CreateNewCustomerOrder(string companyId) { SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); } diff --git a/Wonky.Client/Components/OfficeCountryCustomerViewComponent.razor b/Wonky.Client/Components/OfficeCountryCustomerViewComponent.razor deleted file mode 100644 index 94b4c58f..00000000 --- a/Wonky.Client/Components/OfficeCountryCustomerViewComponent.razor +++ /dev/null @@ -1,59 +0,0 @@ -@using Wonky.Entity.DTO -@using Wonky.Client.Helpers - -
-
- @Company.Name @(Company.HasFolded == 1 ? "(OPHØRT)" : "") -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Konto@Company.AccountOrg Nr.@(string.IsNullOrWhiteSpace(Company.VatNumber) ? "mangler" : Company.VatNumber)
Telefon@Company.Phone
Adresse@Company.Address1 @(string.IsNullOrWhiteSpace(Company.Address2) ? "" : ",") @Company.Address2
Post By@Company.CountryCode.ToUpper()-@Company.ZipCode @Company.City
- Sælgernr. - - @Company.SalesRep -
Sidst besøgt - @(Mapper.MapVisitState(Company.LastVisit) == "the-draw" ? "?" : Company.LastVisit) -
Næste besøg - @(Mapper.MapVisitState(Company.LastVisit) == "the-draw" ? "?" : Company.NextVisit) -
-
-
- - -@code { - - [Parameter] public CompanyDto Company { get; set; } = new(); - - [Parameter] public EventCallback OnReloadHistory { get; set; } - -} \ No newline at end of file diff --git a/Wonky.Client/Pages/InfoPage.razor b/Wonky.Client/Pages/InfoPage.razor index b8dd3a84..ca3050bb 100644 --- a/Wonky.Client/Pages/InfoPage.razor +++ b/Wonky.Client/Pages/InfoPage.razor @@ -31,7 +31,7 @@

Piktogrammer

- +
@*
diff --git a/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor b/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor index 3b2b9fb1..a13d8545 100644 --- a/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor +++ b/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor @@ -47,7 +47,7 @@
@*placeholder*@
-
+
Loading...
@@ -55,7 +55,7 @@
- + @if (Paging.PageSize > 10) { diff --git a/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor.cs b/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor.cs index c7d08faf..a0d2807d 100644 --- a/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor.cs +++ b/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor.cs @@ -76,9 +76,9 @@ public partial class OfficeCustomerCountryPagedListPage : IDisposable } - private async Task GetProductHistory(string companyId) + private void SetWorking(bool working) { - await Task.Delay(1); + Working = working; } private async Task FetchCustomers() diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 110724c2..cf462b26 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "238.0", + "version": "240.0", "rc": true, "sandBox": true, "image": "grumpy-coder.png", diff --git a/Wonky.Client/wwwroot/css/app.css b/Wonky.Client/wwwroot/css/app.css index 5b48dd59..f7804799 100644 --- a/Wonky.Client/wwwroot/css/app.css +++ b/Wonky.Client/wwwroot/css/app.css @@ -6,6 +6,7 @@ .draft-expires-msg { font-size: 0.8em; } + .busy-signal { float: right; z-index: 100;