From 278f116e95388363b3bf90bb534c3b885a02b72f Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Wed, 7 Jun 2023 08:40:57 +0200 Subject: [PATCH] FIX various bugs and display issues with office phone order process --- .../Components/InfoCommonComponent.razor | 2 +- .../OfficeCountryCustomerListComponent.razor | 26 ++-- ...fficeCountryCustomerListComponent.razor.cs | 2 +- .../Components/TopbarNavigation.razor | 2 +- Wonky.Client/Helpers/Utils.cs | 2 +- ...CustomerInventoryItemReorderOverlay.razor} | 0 ...tomerInventoryItemReorderOverlay.razor.cs} | 2 +- .../OfficeCustomerInventoryListOverlay.razor | 110 ----------------- ...stomerInventoryListReorderComponent.razor} | 22 +++- ...merInventoryListReorderComponent.razor.cs} | 20 ++-- .../OfficeCustomerInvoiceListOverlay.razor | 2 +- .../OfficeCustomerInvoiceListOverlay.razor.cs | 4 +- .../OfficeCustomerInvoiceViewOverlay.razor | 2 +- .../OfficeCustomerListInventoryOverlay.razor | 112 ++++++++++++++++++ ...ficeCustomerListInventoryOverlay.razor.cs} | 79 +++++------- ...iceCustomerOrderInventoryListOverlay.razor | 2 +- .../OfficeCustomerCountryPagedListPage.razor | 3 +- Wonky.Client/Shared/NavMenu.razor | 2 +- Wonky.Client/wwwroot/appsettings.json | 6 +- 19 files changed, 198 insertions(+), 202 deletions(-) rename Wonky.Client/OverlayOffice/{OfficeCustomerInventoryReorderOverlay.razor => OfficeCustomerInventoryItemReorderOverlay.razor} (100%) rename Wonky.Client/OverlayOffice/{OfficeCustomerInventoryReorderOverlay.razor.cs => OfficeCustomerInventoryItemReorderOverlay.razor.cs} (98%) delete mode 100644 Wonky.Client/OverlayOffice/OfficeCustomerInventoryListOverlay.razor rename Wonky.Client/{Components/OfficeCustomerInventoryListComponent.razor => OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor} (83%) rename Wonky.Client/{Components/OfficeCustomerInventoryListComponent.razor.cs => OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor.cs} (81%) create mode 100644 Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor rename Wonky.Client/OverlayOffice/{OfficeCustomerInventoryListOverlay.razor.cs => OfficeCustomerListInventoryOverlay.razor.cs} (60%) diff --git a/Wonky.Client/Components/InfoCommonComponent.razor b/Wonky.Client/Components/InfoCommonComponent.razor index c7dd92a2..6eb67130 100644 --- a/Wonky.Client/Components/InfoCommonComponent.razor +++ b/Wonky.Client/Components/InfoCommonComponent.razor @@ -49,7 +49,7 @@ Log af - + Hjælp/Info diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor index fb8e692b..37689bc0 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor @@ -24,20 +24,22 @@ {
+
+ @company.Name +
-
- @company.Name -
Konto
@company.Account
-
CVR / ORG
+
Org Nr.
@company.VatNumber
Telefon
@company.Phone
+
Besøg
+
@company.LastVisit
Adresse
@@ -51,16 +53,16 @@ @@ -68,13 +70,11 @@
}
- - - + + + } else {
Ingen data
-} - - +} \ No newline at end of file diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs index b6e2aa57..1fe2f634 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs @@ -48,7 +48,7 @@ public partial class OfficeCountryCustomerListComponent // overlays private OfficeCustomerInvoiceListOverlay InvoiceListOverlay { get; set; } = new(); private OfficeCustomerActivityListOverlay ActivityListOverlay { get; set; } = new(); - private OfficeCustomerInventoryListOverlay InventoryListOverlay { get; set; } = new(); + private OfficeCustomerListInventoryOverlay InventoryListOverlay { get; set; } = new(); // ****************************************************** // variables diff --git a/Wonky.Client/Components/TopbarNavigation.razor b/Wonky.Client/Components/TopbarNavigation.razor index acd881bd..5b4ca6bd 100644 --- a/Wonky.Client/Components/TopbarNavigation.razor +++ b/Wonky.Client/Components/TopbarNavigation.razor @@ -19,7 +19,7 @@
- +
diff --git a/Wonky.Client/Helpers/Utils.cs b/Wonky.Client/Helpers/Utils.cs index 46faf314..905e313e 100644 --- a/Wonky.Client/Helpers/Utils.cs +++ b/Wonky.Client/Helpers/Utils.cs @@ -336,7 +336,7 @@ public static class Utils public static string GetVisitState(string dtNextVisit) { - if (dtNextVisit is "0001-01-01" or "1970-01-01") + if (dtNextVisit is "0001-01-01" or "1970-01-01" or "2010-01-01") return "the-draw"; if (!DateTime.TryParse(dtNextVisit, out _)) return "the-draw"; diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryReorderOverlay.razor b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor similarity index 100% rename from Wonky.Client/OverlayOffice/OfficeCustomerInventoryReorderOverlay.razor rename to Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryReorderOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor.cs similarity index 98% rename from Wonky.Client/OverlayOffice/OfficeCustomerInventoryReorderOverlay.razor.cs rename to Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor.cs index 95bf9900..cb1f14dc 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryReorderOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryItemReorderOverlay.razor.cs @@ -24,7 +24,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.OverlayOffice; -public partial class OfficeCustomerInventoryReorderOverlay +public partial class OfficeCustomerInventoryItemReorderOverlay { // ############################################################## [Parameter] public CompanyDto Company { get; set; } diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListOverlay.razor b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListOverlay.razor deleted file mode 100644 index 8b20f97f..00000000 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListOverlay.razor +++ /dev/null @@ -1,110 +0,0 @@ -@* Copyright (C) 2022 FCS Frede's Computer Services. -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] -*@ - -@using Wonky.Client.Models -@using Wonky.Client.Enums - - -@if (_showBackdrop) -{ - -} -@* -reorder overlay -invoked by list component OnReorderSku=OnReorderCallback -*@ - - \ No newline at end of file diff --git a/Wonky.Client/Components/OfficeCustomerInventoryListComponent.razor b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor similarity index 83% rename from Wonky.Client/Components/OfficeCustomerInventoryListComponent.razor rename to Wonky.Client/OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor index be934cdb..d0a276a9 100644 --- a/Wonky.Client/Components/OfficeCustomerInventoryListComponent.razor +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor @@ -17,15 +17,13 @@ @using Wonky.Client.Models @using System.ComponentModel.Design @using Wonky.Client.Enums +@using Wonky.Client.Components
- @if (Inventory.Any()) {
- @*
Navn
*@ - @*
Varenr
*@
@@ -52,11 +50,23 @@
- @foreach (var product in Inventory) + @foreach (var product in DisplayList) {
-
+
+
+ @product.LastInvoiceDate + @if (product.AgedProduct() && !product.Discontinued) + { + + Længe siden + Længe siden + + } +
+
+
@product.Description @if (product.Discontinued) @@ -72,7 +82,7 @@
@product.Quantity
-
+
diff --git a/Wonky.Client/Components/OfficeCustomerInventoryListComponent.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor.cs similarity index 81% rename from Wonky.Client/Components/OfficeCustomerInventoryListComponent.razor.cs rename to Wonky.Client/OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor.cs index edc2010e..cc086033 100644 --- a/Wonky.Client/Components/OfficeCustomerInventoryListComponent.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListReorderComponent.razor.cs @@ -21,10 +21,10 @@ using Wonky.Client.Models; using Wonky.Entity.Views; using Utils = Wonky.Client.Helpers.Utils; -namespace Wonky.Client.Components; +namespace Wonky.Client.OverlayOffice; #pragma warning disable CS8618 -public partial class OfficeCustomerInventoryListComponent +public partial class OfficeCustomerInventoryListReorderComponent { // ************************************************************* // Injections @@ -39,22 +39,22 @@ public partial class OfficeCustomerInventoryListComponent // ************************************************************* // private variables private bool Descending { get; set; } = true; - private string SearchTerm { get; set; } = ""; - private List FilteredList { get; set; } = new(); + private string DisplayFilter { get; set; } = ""; + private List DisplayList { get; set; } = new(); private SortColumn SortColumn { get; set; } = SortColumn.LastInvoiceDate; protected override void OnParametersSet() { Inventory = Utils.SortInventory(Inventory, SortColumn, Descending); - FilterItems(SearchTerm); + FilterItems(DisplayFilter); } private void SetSortOrder() { Descending = !Descending; - FilteredList = Utils.SortInventory(FilteredList, SortColumn, Descending); + DisplayList = Utils.SortInventory(DisplayList, SortColumn, Descending); } @@ -66,8 +66,8 @@ public partial class OfficeCustomerInventoryListComponent private void FilterItems(string filter) { - SearchTerm = filter; - FilteredList = string.IsNullOrWhiteSpace(filter) + DisplayFilter = filter; + DisplayList = string.IsNullOrWhiteSpace(filter) ? Inventory : Inventory.Where(i => i.Description.ToLower().Contains(filter.ToLower())).ToList(); } @@ -75,13 +75,13 @@ public partial class OfficeCustomerInventoryListComponent private void SortProducts(SortColumn column) { - FilteredList = Utils.SortInventory(FilteredList, column, Descending); + SortColumn = column; + DisplayList = Utils.SortInventory(DisplayList, SortColumn, Descending); } private async Task CallShowReorderModal(string sku) { - // await ProductCheck(sku); await OnReorderSelected.InvokeAsync(sku); } } \ No newline at end of file diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor index 41556252..da933edb 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor @@ -25,7 +25,7 @@
diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs index b8f88af7..619796c9 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceListOverlay.razor.cs @@ -38,10 +38,10 @@ public partial class OfficeCustomerInvoiceListOverlay private OfficeCustomerInvoiceViewOverlay InvoiceView { get; set; } = new(); private List Invoices { get; set; } = new(); - protected override async Task OnParametersSetAsync() + protected override void OnParametersSet() { // extract company from customer invoices - Logger.LogDebug("CustomerInvoiceListOverlay => company => {}", JsonSerializer.Serialize(Company)); + 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(); diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor index 1103abb9..a117966e 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor +++ b/Wonky.Client/OverlayOffice/OfficeCustomerInvoiceViewOverlay.razor @@ -1,4 +1,4 @@ -00@* Copyright (C) 2022 FCS Frede's Computer Services. +@* Copyright (C) 2022 FCS Frede's Computer Services. // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor b/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor new file mode 100644 index 00000000..0234b443 --- /dev/null +++ b/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor @@ -0,0 +1,112 @@ +@* Copyright (C) 2022 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] +*@ + +@using Wonky.Client.Models +@using Wonky.Client.Enums +@using Wonky.Client.Components +@using System.Text.Json + + +@if (_showBackdrop) +{ + +} \ No newline at end of file diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor.cs similarity index 60% rename from Wonky.Client/OverlayOffice/OfficeCustomerInventoryListOverlay.razor.cs rename to Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor.cs index 77bb2819..e61a38e3 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerInventoryListOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerListInventoryOverlay.razor.cs @@ -14,6 +14,7 @@ // +using System.Text.Json; using Microsoft.AspNetCore.Components; using Wonky.Client.Enums; using Wonky.Client.Helpers; @@ -27,12 +28,10 @@ using Wonky.Entity.Views; namespace Wonky.Client.OverlayOffice; -public partial class OfficeCustomerInventoryListOverlay : IDisposable +public partial class OfficeCustomerListInventoryOverlay { // ############################################################## - [Inject] public HttpInterceptorService Interceptor { get; set; } - [Inject] public ICountryCatalogRepository CatalogRepo { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } // ############################################################## [Parameter] public CompanyDto Company { get; set; } = new(); @@ -41,58 +40,50 @@ public partial class OfficeCustomerInventoryListOverlay : IDisposable // ############################################################## private string _modalDisplay = ""; private bool _showBackdrop; - private DraftItem DraftItem { get; set; } = new(); - private SalesItemView SalesItem { get; set; } = new(); - private OfficeCustomerInventoryReorderOverlay ReorderOverlay { get; set; } = new(); private bool Descending { get; set; } = true; - private string SearchTerm { get; set; } = ""; - private List FilteredList { get; set; } = new(); + private string DisplayFilter { get; set; } = ""; + private List DisplayList { get; set; } = new(); private SortColumn SortColumn { get; set; } = SortColumn.LastInvoiceDate; - protected override void OnInitialized() + protected override void OnParametersSet() { - Interceptor.RegisterEvent(); - Interceptor.RegisterBeforeSendEvent(); + // sort the base Inventory Inventory = Utils.SortInventory(Inventory, SortColumn, Descending); - FilterItems(SearchTerm); - StateHasChanged(); + // initialize FilteredList + ApplyInventoryFilter(DisplayFilter); + + Logger.LogDebug("OffCustListInvenOverlay {}", JsonSerializer.Serialize(DisplayList)); } - - - private void OnSearchChanged(string searchTerm) - { - FilterItems(searchTerm); - } - - - private void SortProducts(SortColumn column) - { - Descending = !Descending; - FilteredList = Utils.SortInventory(FilteredList, column, Descending); - } - + private void SetSortOrder() { Descending = !Descending; - FilteredList = Utils.SortInventory(FilteredList, SortColumn, Descending); + SortDisplayList(SortColumn); + } + + + private void SortDisplayList(SortColumn sortColumn) + { + SortColumn = sortColumn; + DisplayList = Utils.SortInventory(DisplayList, SortColumn, Descending); } - - private void FilterItems(string filter) + + private void OnSearchChanged(string searchTerm) { - SearchTerm = filter; - FilteredList = string.IsNullOrWhiteSpace(filter) + // use search input to filter list + ApplyInventoryFilter(searchTerm); + } + + + private void ApplyInventoryFilter(string searchTerm) + { + DisplayFilter = searchTerm; + DisplayList = string.IsNullOrWhiteSpace(searchTerm) ? Inventory - : Inventory.Where(i => i.Description.ToLower().Contains(filter.ToLower())).ToList(); - } - - - private async Task ShowSkuReorder(string sku) - { - SalesItem = await CatalogRepo.GetSalesItemSku(Company.CountryCode.ToLower(), sku); - ReorderOverlay.Show(); + : Inventory.Where(i => i.Description.ToLower().Contains(searchTerm.ToLower())).ToList(); } @@ -110,10 +101,4 @@ public partial class OfficeCustomerInventoryListOverlay : IDisposable _showBackdrop = false; StateHasChanged(); } - - - public void Dispose() - { - Interceptor.DisposeEvent(); - } } \ No newline at end of file diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor b/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor index 45eaa993..2cae68f9 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor +++ b/Wonky.Client/OverlayOffice/OfficeCustomerOrderInventoryListOverlay.razor @@ -23,7 +23,7 @@
diff --git a/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor b/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor index 70602b68..3b2b9fb1 100644 --- a/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor +++ b/Wonky.Client/Pages/OfficeCustomerCountryPagedListPage.razor @@ -35,7 +35,7 @@
- @@ -70,4 +70,3 @@ { } - diff --git a/Wonky.Client/Shared/NavMenu.razor b/Wonky.Client/Shared/NavMenu.razor index 6532cde6..32557c5c 100644 --- a/Wonky.Client/Shared/NavMenu.razor +++ b/Wonky.Client/Shared/NavMenu.razor @@ -141,7 +141,7 @@