diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor index cc83d675..1db21666 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor @@ -91,10 +91,10 @@
- Bestilling + Bestilling
- +
diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs index c9093d08..d933f26d 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs @@ -47,8 +47,7 @@ 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; } + [Parameter] public EventCallback SetWorking { get; set; } // ****************************************************** // overlays @@ -70,62 +69,49 @@ public partial class OfficeCountryCustomerListComponent : IDisposable Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); } - - - private async Task RequestBusinessCentralData(string companyId, bool force) - { - 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, 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); + Logger.LogDebug("SelectedCompany => {}", SelectedCompany); + await SetWorking.InvokeAsync(true); + + await RequestBusinessCentralData(companyId, true); + InvoiceList = await HistoryRepo.GetInvoiceList(CountryCode, companyId); + InvoiceListOverlay.Show(); await SetWorking.InvokeAsync(false); + } private async Task ShowActivityList(string companyId) { - await SetWorking.InvokeAsync(true); SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); - await Task.Delay(500); + + await SetWorking.InvokeAsync(true); + ActivityList = await ActivityRepo.GetActivityList(companyId); - await Task.Delay(500); + ActivityListOverlay.Show(); + await SetWorking.InvokeAsync(false); } private async Task ShowInventory(string companyId) { - await SetWorking.InvokeAsync(true); SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); - Logger.LogDebug("SelectedCompany => {}", JsonSerializer.Serialize(SelectedCompany)); - await Task.Delay(500); + + await SetWorking.InvokeAsync(true); + await RequestBusinessCentralData(companyId, false); - // request inventory - await Task.Delay(500); - ProductInventory = await HistoryRepo.GetInventory(SelectedCompany.CountryCode, SelectedCompany.CompanyId); - await Task.Delay(500); - Logger.LogDebug("ProductInventory => {}", JsonSerializer.Serialize(ProductInventory)); - // show the overlay + + ProductInventory = await HistoryRepo.GetInventory(CountryCode, companyId); + InventoryListOverlay.Show(); + await SetWorking.InvokeAsync(false); } @@ -136,6 +122,18 @@ public partial class OfficeCountryCustomerListComponent : IDisposable } + private async Task RequestBusinessCentralData(string companyId, bool force) + { + SelectedCompany = CompanyList.First(x => x.CompanyId == companyId); + + await SetWorking.InvokeAsync(true); + + SelectedCompany.HistorySync = await HistoryRepo.RequestErpToCrmSync(companyId, SelectedCompany.HistorySync, force); + + await SetWorking.InvokeAsync(false); + } + + public void Dispose() { Interceptor.DisposeEvent(); diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerActivityListOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerActivityListOverlay.razor.cs index 78d7058a..2a721999 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerActivityListOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerActivityListOverlay.razor.cs @@ -41,6 +41,7 @@ public partial class OfficeCustomerActivityListOverlay { _modalDisplay = "none;"; _showBackdrop = false; + ActivityList = new List(); StateHasChanged(); } } \ No newline at end of file diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerActivityViewOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerActivityViewOverlay.razor.cs index 70b7c4f7..0ba56482 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerActivityViewOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerActivityViewOverlay.razor.cs @@ -39,6 +39,7 @@ public partial class OfficeCustomerActivityViewOverlay { _modalDisplay = "none;"; _showBackdrop = false; + Activity = new ReportItemView(); StateHasChanged(); } diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemHistoryOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemHistoryOverlay.razor.cs index 0cbe26ea..50110b97 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemHistoryOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemHistoryOverlay.razor.cs @@ -57,6 +57,7 @@ public partial class OfficeCustomerInventoryItemHistoryOverlay { _modalDisplay = "none;"; _showBackdrop = false; + History = new List(); StateHasChanged(); } } \ No newline at end of file diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor.cs index cb1f14dc..b2566511 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor.cs @@ -48,8 +48,6 @@ public partial class OfficeCustomerInventoryItemReorderOverlay return; History = await HistoryRepo.GetSkuHistory(Company.CountryCode, Company.CompanyId, SalesItem.Sku); - // if (!History.Any()) - // await Task.Delay(500); SelectedItem.Item = SalesItem; SelectedItem.Discount = 0; SelectedItem.Quantity = 1; diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs index 619796c9..498f8e64 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs @@ -40,12 +40,7 @@ public partial class OfficeCustomerInvoiceListOverlay protected override void OnParametersSet() { - // extract company from customer invoices - Logger.LogDebug("OfficeInvoiceListOverlay => company => {}", JsonSerializer.Serialize(Company)); - // if there is invoices -> order by document date - if (InvoiceList.Invoices.Any()) - Invoices = InvoiceList.Invoices.OrderByDescending(x => x.DocumentDate).ToList(); - Logger.LogDebug("invoices => {}", JsonSerializer.Serialize(Invoices)); + Invoices = InvoiceList.Invoices.OrderByDescending(x => x.DocumentDate).ToList(); } protected override void OnInitialized() @@ -68,6 +63,7 @@ public partial class OfficeCustomerInvoiceListOverlay private void Hide() { + InvoiceList = new InvoiceListView(); _modalDisplay = "none;"; _showBackdrop = false; StateHasChanged(); diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor.cs index 1d513674..29a5a2a6 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor.cs @@ -38,44 +38,19 @@ public partial class OfficeCustomerInvoiceViewOverlay : IDisposable private string _modalDisplay = ""; private bool _showBackdrop; private InvoiceView Invoice { get; set; } = new(); - // private string SasAmount { get; set; } = "0.00"; - // private string NormalAmount { get; set; } = "0.00"; - // private string DiscountAmount { get; set; } = "0.00"; protected override async Task OnParametersSetAsync() { Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); - - if (!string.IsNullOrWhiteSpace(InvoiceId)) + + if (string.IsNullOrWhiteSpace(InvoiceId)) { - Invoice = await HistoryRepo.GetInvoice( CountryCode, CompanyId, InvoiceId); - // CalculateDisplaySums(); + return; } + Invoice = await HistoryRepo.GetInvoice(CountryCode, CompanyId, InvoiceId); } - // private void CalculateDisplaySums() - // { - // var invoiceAmount = decimal.Parse(Invoice.InvoiceAmount); - // var normalLines = Invoice.Lines.Where(x => !x.Sas && !x.Price.Contains("-")); - // var normalSale = ( - // from line in normalLines - // let price = int.Parse(line.Qty) * decimal.Parse(line.Price) - // select decimal.Parse(line.Qty) == 0 - // ? price : price + price * decimal.Parse(line.Qty) / 100).Sum(); - // NormalAmount = $"{normalSale:N2}"; - // - // var sasLines = Invoice.Lines.Where(x => x.Sas && !x.Price.Contains("-")); - // var sasSale = ( - // from line in sasLines - // let price = int.Parse(line.Qty) * decimal.Parse(line.Price) - // select price).Sum(); - // SasAmount = $"{sasSale:N2}"; - // - // if (normalSale > invoiceAmount) - // DiscountAmount = $"{normalSale - invoiceAmount:N2}"; - // } - public void Show() { _modalDisplay = "block;"; diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor.cs index 5d045822..3f4e2efd 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor.cs @@ -49,12 +49,9 @@ public partial class OfficeCustomerListInventoryOverlay protected override void OnParametersSet() { - // sort the base Inventory + if (Inventory.Count <= 0) return; Inventory = Utils.SortInventory(Inventory, SortColumn, Descending); - // initialize FilteredList ApplyInventoryFilter(DisplayFilter); - - Logger.LogDebug("OfficeCustomerListInventoryOverlay {}", JsonSerializer.Serialize(DisplayList)); } @@ -106,6 +103,7 @@ public partial class OfficeCustomerListInventoryOverlay { _modalDisplay = "none;"; _showBackdrop = false; + Inventory = new List(); StateHasChanged(); } } \ No newline at end of file diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor.cs index 0ced4cc1..e7b78c73 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor.cs @@ -80,6 +80,7 @@ public partial class OfficeCustomerOrderInventoryListOverlay : IDisposable { _modalDisplay = "none;"; _showBackdrop = false; + Inventory = new List(); StateHasChanged(); } diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryReorderOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryReorderOverlay.razor.cs index 74be9383..3e1148d2 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryReorderOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryReorderOverlay.razor.cs @@ -92,6 +92,7 @@ public partial class OfficeCustomerOrderInventoryReorderOverlay SelectedItem = new DraftItem(); _modalDisplay = "none;"; _showBackdrop = false; + ProductHistory = new List(); StateHasChanged(); } } \ No newline at end of file diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 67f23fe8..2ff300eb 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,8 +1,8 @@ { "appInfo": { "name": "Wonky Online", - "version": "309.0", - "rc": true, + "version": "310.0", + "rc": false, "sandBox": true, "image": "grumpy-coder.png", "sdk": "dotnet 8.0" diff --git a/next-build.sh b/next-build.sh index 99496550..aa37f6fc 100755 --- a/next-build.sh +++ b/next-build.sh @@ -14,8 +14,9 @@ sed -i "s|\"version\":.*|\"version\": \"$1\",|g" "${FILE}" sed -i 's|\"rc\":.*|\"rc\": true,|g' "${FILE}" sed -i 's|\"sandBox\":.*|\"sandBox\": false,|g' "${FILE}" -sed -i 's|\"Default": \"Debug\",|\"Default": \"None\",|g' "${FILE}" -sed -i 's|\"System": \"Debug\",|\"System": \"None\",|g' "${FILE}" +# need debugging in next build +#sed -i 's|\"Default": \"Debug\",|\"Default": \"None\",|g' "${FILE}" +#sed -i 's|\"System": \"Debug\",|\"System": \"None\",|g' "${FILE}" sed -i 's|\"Microsoft\": \"Information\",|\"Microsoft\": \"None\",|g' "${FILE}" sed -i 's|\"Microsoft\": \"Debug\",|\"Microsoft\": \"None\",|g' "${FILE}"