From 137df512e691dbfa2adaf3c6172ae89a08954209 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Thu, 22 Dec 2022 08:19:08 +0100 Subject: [PATCH 1/2] sales rep product check list --- .../Components/CatalogGroupComponent.razor | 4 +- .../Components/CatalogSearchComponent.razor | 8 +- .../Components/CatalogSortComponent.razor | 2 +- .../CompanySearchColumnComponent.razor | 12 +- .../Components/CompanySortComponent.razor | 2 +- .../CustomerProductCheckListComponent.razor | 73 ++++++ ...CustomerProductCheckListComponent.razor.cs | 80 ++++++ ...> CustomerProductLineTableComponent.razor} | 0 ...ustomerProductLineTableComponent.razor.cs} | 2 +- .../CustomerProductTableComponent.razor | 76 ++++++ ...=> CustomerProductTableComponent.razor.cs} | 57 ++++- .../Components/PageSizeComponent.razor | 2 +- .../ProductInventoryTableComponent.razor | 67 ----- .../CrmHistoryHttpRepository.cs | 4 +- Wonky.Client/Models/PSort.cs | 10 + ...NewPage.razor => ActivityCreatePage.razor} | 7 +- ...e.razor.cs => ActivityCreatePage.razor.cs} | 80 +++++- ...Page.razor => ActivityListTodayPage.razor} | 0 ...azor.cs => ActivityListTodayPage.razor.cs} | 4 +- ...yViewPage.razor => ActivityViewPage.razor} | 0 ...age.razor.cs => ActivityViewPage.razor.cs} | 4 +- .../Pages/CrmCompanyInvoiceListPage.razor.cs | 59 ----- Wonky.Client/Pages/CrmCompanyViewPage.razor | 242 ------------------ ...e.razor => CustomerActivityListPage.razor} | 0 ...r.cs => CustomerActivityListPage.razor.cs} | 2 +- ...age.razor => CustomerCardCreatePage.razor} | 0 ...zor.cs => CustomerCardCreatePage.razor.cs} | 4 +- Wonky.Client/Pages/CustomerCardPage.razor | 239 +++++++++++++++++ ...age.razor.cs => CustomerCardPage.razor.cs} | 4 +- ...ge.razor => CustomerInvoiceListPage.razor} | 2 +- .../Pages/CustomerInvoiceListPage.razor.cs | 78 ++++++ ...yListPage.razor => CustomerListPage.razor} | 0 ...age.razor.cs => CustomerListPage.razor.cs} | 2 +- ...ge.razor => CustomerProductListPage.razor} | 6 +- ...or.cs => CustomerProductListPage.razor.cs} | 46 +++- ...otesListPage.razor => QuoteListPage.razor} | 0 ...stPage.razor.cs => QuoteListPage.razor.cs} | 4 +- ....razor => WorkplaceDocumentListPage.razor} | 0 ....cs => WorkplaceDocumentListPage.razor.cs} | 2 +- ...ListPage.razor => WorkplaceListPage.razor} | 0 ...ge.razor.cs => WorkplaceListPage.razor.cs} | 2 +- ...ViewPage.razor => WorkplaceViewPage.razor} | 0 ...ge.razor.cs => WorkplaceViewPage.razor.cs} | 2 +- .../Services/AuthenticationService.cs | 2 +- .../Shared/ConfirmProductCheckModal.razor | 39 +++ .../Shared/ConfirmProductCheckModal.razor.cs | 43 ++++ Wonky.Client/wwwroot/appsettings.json | 6 +- Wonky.Entity/Views/ProductInventoryView.cs | 4 + 48 files changed, 848 insertions(+), 434 deletions(-) create mode 100644 Wonky.Client/Components/CustomerProductCheckListComponent.razor create mode 100644 Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs rename Wonky.Client/Components/{ProductLineTableComponent.razor => CustomerProductLineTableComponent.razor} (100%) rename Wonky.Client/Components/{ProductLineTableComponent.razor.cs => CustomerProductLineTableComponent.razor.cs} (94%) create mode 100644 Wonky.Client/Components/CustomerProductTableComponent.razor rename Wonky.Client/Components/{ProductInventoryTableComponent.razor.cs => CustomerProductTableComponent.razor.cs} (53%) delete mode 100644 Wonky.Client/Components/ProductInventoryTableComponent.razor create mode 100644 Wonky.Client/Models/PSort.cs rename Wonky.Client/Pages/{CrmActivityNewPage.razor => ActivityCreatePage.razor} (98%) rename Wonky.Client/Pages/{CrmActivityNewPage.razor.cs => ActivityCreatePage.razor.cs} (83%) rename Wonky.Client/Pages/{CrmActivityTodayPage.razor => ActivityListTodayPage.razor} (100%) rename Wonky.Client/Pages/{CrmActivityTodayPage.razor.cs => ActivityListTodayPage.razor.cs} (95%) rename Wonky.Client/Pages/{CrmActivityViewPage.razor => ActivityViewPage.razor} (100%) rename Wonky.Client/Pages/{CrmActivityViewPage.razor.cs => ActivityViewPage.razor.cs} (96%) delete mode 100644 Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs delete mode 100644 Wonky.Client/Pages/CrmCompanyViewPage.razor rename Wonky.Client/Pages/{CrmCompanyActivityListPage.razor => CustomerActivityListPage.razor} (100%) rename Wonky.Client/Pages/{CrmCompanyActivityListPage.razor.cs => CustomerActivityListPage.razor.cs} (97%) rename Wonky.Client/Pages/{CrmCompanyNewPage.razor => CustomerCardCreatePage.razor} (100%) rename Wonky.Client/Pages/{CrmCompanyNewPage.razor.cs => CustomerCardCreatePage.razor.cs} (98%) create mode 100644 Wonky.Client/Pages/CustomerCardPage.razor rename Wonky.Client/Pages/{CrmCompanyViewPage.razor.cs => CustomerCardPage.razor.cs} (99%) rename Wonky.Client/Pages/{CrmCompanyInvoiceListPage.razor => CustomerInvoiceListPage.razor} (96%) create mode 100644 Wonky.Client/Pages/CustomerInvoiceListPage.razor.cs rename Wonky.Client/Pages/{CrmCompanyListPage.razor => CustomerListPage.razor} (100%) rename Wonky.Client/Pages/{CrmCompanyListPage.razor.cs => CustomerListPage.razor.cs} (98%) rename Wonky.Client/Pages/{CrmCompanyInventoryPage.razor => CustomerProductListPage.razor} (86%) rename Wonky.Client/Pages/{CrmCompanyInventoryPage.razor.cs => CustomerProductListPage.razor.cs} (52%) rename Wonky.Client/Pages/{CrmQuotesListPage.razor => QuoteListPage.razor} (100%) rename Wonky.Client/Pages/{CrmQuotesListPage.razor.cs => QuoteListPage.razor.cs} (96%) rename Wonky.Client/Pages/{CrmWorkplaceDocumentListPage.razor => WorkplaceDocumentListPage.razor} (100%) rename Wonky.Client/Pages/{CrmWorkplaceDocumentListPage.razor.cs => WorkplaceDocumentListPage.razor.cs} (96%) rename Wonky.Client/Pages/{CrmWorkplaceListPage.razor => WorkplaceListPage.razor} (100%) rename Wonky.Client/Pages/{CrmWorkplaceListPage.razor.cs => WorkplaceListPage.razor.cs} (97%) rename Wonky.Client/Pages/{CrmWorkplaceViewPage.razor => WorkplaceViewPage.razor} (100%) rename Wonky.Client/Pages/{CrmWorkplaceViewPage.razor.cs => WorkplaceViewPage.razor.cs} (97%) create mode 100644 Wonky.Client/Shared/ConfirmProductCheckModal.razor create mode 100644 Wonky.Client/Shared/ConfirmProductCheckModal.razor.cs diff --git a/Wonky.Client/Components/CatalogGroupComponent.razor b/Wonky.Client/Components/CatalogGroupComponent.razor index af0dec22..f125ab55 100644 --- a/Wonky.Client/Components/CatalogGroupComponent.razor +++ b/Wonky.Client/Components/CatalogGroupComponent.razor @@ -15,9 +15,9 @@ // *@ - - + diff --git a/Wonky.Client/Components/CatalogSearchComponent.razor b/Wonky.Client/Components/CatalogSearchComponent.razor index 24ebd509..64fb9429 100644 --- a/Wonky.Client/Components/CatalogSearchComponent.razor +++ b/Wonky.Client/Components/CatalogSearchComponent.razor @@ -15,9 +15,9 @@ // *@ - - - - + + + \ No newline at end of file diff --git a/Wonky.Client/Components/CatalogSortComponent.razor b/Wonky.Client/Components/CatalogSortComponent.razor index 4756b94f..dfc2d245 100644 --- a/Wonky.Client/Components/CatalogSortComponent.razor +++ b/Wonky.Client/Components/CatalogSortComponent.razor @@ -15,7 +15,7 @@ // *@ - diff --git a/Wonky.Client/Components/CompanySearchColumnComponent.razor b/Wonky.Client/Components/CompanySearchColumnComponent.razor index 7915c26f..3d6d41b6 100644 --- a/Wonky.Client/Components/CompanySearchColumnComponent.razor +++ b/Wonky.Client/Components/CompanySearchColumnComponent.razor @@ -15,11 +15,11 @@ // *@ - - - - - - + + + + + diff --git a/Wonky.Client/Components/CompanySortComponent.razor b/Wonky.Client/Components/CompanySortComponent.razor index 9129b2ee..d707cc07 100644 --- a/Wonky.Client/Components/CompanySortComponent.razor +++ b/Wonky.Client/Components/CompanySortComponent.razor @@ -15,7 +15,7 @@ // *@ - diff --git a/Wonky.Client/Components/CustomerProductCheckListComponent.razor b/Wonky.Client/Components/CustomerProductCheckListComponent.razor new file mode 100644 index 00000000..9cef7991 --- /dev/null +++ b/Wonky.Client/Components/CustomerProductCheckListComponent.razor @@ -0,0 +1,73 @@ +@using Wonky.Client.Models +@using System.ComponentModel.Design +@* +// 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] +// +*@ + +
+ + @if (ProductList.Any()) + { +
+
+
+
Navn
+
Varenr
+
Antal
+
+
+
+
+ @foreach (var product in ProductList) + { +
+
+
+ @product.Description +
+
+ @product.Sku +
+
+ @product.Quantity +
+
+
+
+ + @if (product.Check) + { + + } + else + { + + } +
+
+
+ } +
+ } + else + { +
Ingen data
+ } +
\ No newline at end of file diff --git a/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs b/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs new file mode 100644 index 00000000..57fea05e --- /dev/null +++ b/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs @@ -0,0 +1,80 @@ +// 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 System.Globalization; +using System.Runtime.InteropServices; +using Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; +using Wonky.Client.HttpInterfaces; +using Wonky.Client.Models; +using Wonky.Client.Shared; +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +namespace Wonky.Client.Components; +public partial class CustomerProductCheckListComponent +{ + [Parameter] public List ProductList { get; set; } = new(); + [Parameter] public string CompanyId { get; set; } = ""; + [Inject] public ILocalStorageService Storage { get; set; } + // private variables + private bool Descending { get; set; } + + private void SortProducts(PSort column) + { + Descending = !Descending; + switch (column) + { + case PSort.Desc: + if (Descending) + { + ProductList = ProductList.OrderByDescending(x => x.Description).ToList(); + break; + } + ProductList = ProductList.OrderBy(x => x.Description).ToList(); + break; + case PSort.Sku: + if (Descending) + { + ProductList = ProductList.OrderByDescending(x => x.Sku).ToList(); + break; + } + ProductList = ProductList.OrderBy(x => x.Sku).ToList(); + break; + case PSort.Qty: + if (Descending) + { + ProductList = ProductList.OrderByDescending(x => x.Quantity).ToList(); + break; + } + ProductList = ProductList.OrderBy(x => x.Quantity).ToList(); + break; + case PSort.None: + break; + case PSort.Abbr: + break; + default: + ProductList = ProductList.OrderByDescending(x => x.Quantity).ToList(); + break; + } + } + + private async Task ProductCheck(string sku) + { + var x = ProductList.First(x => x.Sku == sku); + x.Check = !x.Check; + await Storage.SetItemAsync($"{CompanyId}-products", ProductList); + } +} \ No newline at end of file diff --git a/Wonky.Client/Components/ProductLineTableComponent.razor b/Wonky.Client/Components/CustomerProductLineTableComponent.razor similarity index 100% rename from Wonky.Client/Components/ProductLineTableComponent.razor rename to Wonky.Client/Components/CustomerProductLineTableComponent.razor diff --git a/Wonky.Client/Components/ProductLineTableComponent.razor.cs b/Wonky.Client/Components/CustomerProductLineTableComponent.razor.cs similarity index 94% rename from Wonky.Client/Components/ProductLineTableComponent.razor.cs rename to Wonky.Client/Components/CustomerProductLineTableComponent.razor.cs index 9c91ddbc..a846338e 100644 --- a/Wonky.Client/Components/ProductLineTableComponent.razor.cs +++ b/Wonky.Client/Components/CustomerProductLineTableComponent.razor.cs @@ -19,7 +19,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Components; -public partial class ProductLineTableComponent +public partial class CustomerProductLineTableComponent { [Parameter] public List ProductHistory { get; set; } = new(); diff --git a/Wonky.Client/Components/CustomerProductTableComponent.razor b/Wonky.Client/Components/CustomerProductTableComponent.razor new file mode 100644 index 00000000..07af4cf8 --- /dev/null +++ b/Wonky.Client/Components/CustomerProductTableComponent.razor @@ -0,0 +1,76 @@ +@using Wonky.Client.Models +@using System.ComponentModel.Design +@* +// 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] +// +*@ + +
+ + @if (ProductList.Any()) + { +
+
+
+
Navn
+
Varenr
+
Antal
+
+
+
+
+ @foreach (var product in ProductList) + { +
+
+
+ @product.Description +
+
+ @product.Sku +
+
+ @product.Quantity +
+ +
+ + @if (product.Check) + { + + } + else + { + + } +
+
+
+ } +
+ + + } + else + { +
Ingen data
+ } +
\ No newline at end of file diff --git a/Wonky.Client/Components/ProductInventoryTableComponent.razor.cs b/Wonky.Client/Components/CustomerProductTableComponent.razor.cs similarity index 53% rename from Wonky.Client/Components/ProductInventoryTableComponent.razor.cs rename to Wonky.Client/Components/CustomerProductTableComponent.razor.cs index 0039fd88..136a5094 100644 --- a/Wonky.Client/Components/ProductInventoryTableComponent.razor.cs +++ b/Wonky.Client/Components/CustomerProductTableComponent.razor.cs @@ -14,6 +14,8 @@ // using System.Globalization; +using System.Runtime.InteropServices; +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using Wonky.Client.HttpInterfaces; using Wonky.Client.Models; @@ -23,13 +25,13 @@ using Wonky.Entity.Views; namespace Wonky.Client.Components; -public partial class ProductInventoryTableComponent +public partial class CustomerProductTableComponent { [CascadingParameter] public DraftStateProvider DraftStateProvider { get; set; } = new(); [Parameter] public List ProductList { get; set; } = new(); [Parameter] public string CompanyId { get; set; } = ""; - [Inject] public ICatalogHttpRepository Catalog { get; set; } + [Inject] public ILocalStorageService Storage { get; set; } // private variables private SalesItemView SalesItem { get; set; } = new(); private string Price { get; set; } = "0"; @@ -37,8 +39,53 @@ public partial class ProductInventoryTableComponent private string Sku { get; set; } = ""; private InventoryReorderModal ReorderModal { get; set; } = new(); private SelectedSku Item { get; set; } = new(); - - + private bool Descending { get; set; } + + private void SortProducts(PSort column) + { + Descending = !Descending; + switch (column) + { + case PSort.Desc: + if (Descending) + { + ProductList = ProductList.OrderByDescending(x => x.Description).ToList(); + break; + } + ProductList = ProductList.OrderBy(x => x.Description).ToList(); + break; + case PSort.Sku: + if (Descending) + { + ProductList = ProductList.OrderByDescending(x => x.Sku).ToList(); + break; + } + ProductList = ProductList.OrderBy(x => x.Sku).ToList(); + break; + case PSort.Qty: + if (Descending) + { + ProductList = ProductList.OrderByDescending(x => x.Quantity).ToList(); + break; + } + ProductList = ProductList.OrderBy(x => x.Quantity).ToList(); + break; + case PSort.None: + break; + case PSort.Abbr: + break; + default: + ProductList = ProductList.OrderByDescending(x => x.Quantity).ToList(); + break; + } + } + + private async Task ProductCheck(string sku) + { + var x = ProductList.First(x => x.Sku == sku); + x.Check = !x.Check; + await Storage.SetItemAsync($"{CompanyId}-products", ProductList); + } private async Task CallShowReorderModal(string sku) { // fetch item from http repo @@ -51,6 +98,8 @@ public partial class ProductInventoryTableComponent // add item to order draft DraftStateProvider.Draft.DraftType = "order"; DraftStateProvider.Draft.Items.Add(draftItem); + // set item checked + await ProductCheck(draftItem.Item.Sku); await DraftStateProvider.SaveChangesAsync(); } } \ No newline at end of file diff --git a/Wonky.Client/Components/PageSizeComponent.razor b/Wonky.Client/Components/PageSizeComponent.razor index 28704c52..8ec20608 100644 --- a/Wonky.Client/Components/PageSizeComponent.razor +++ b/Wonky.Client/Components/PageSizeComponent.razor @@ -15,7 +15,7 @@ // *@ - diff --git a/Wonky.Client/Components/ProductInventoryTableComponent.razor b/Wonky.Client/Components/ProductInventoryTableComponent.razor deleted file mode 100644 index 1d346cd9..00000000 --- a/Wonky.Client/Components/ProductInventoryTableComponent.razor +++ /dev/null @@ -1,67 +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] -// -*@ - -@if (ProductList.Any()) -{ - @* -
- @foreach (var product in Inventory) - { -
-
-
- @product.Description -
-
@product.Sku
-
- @product.Quantity -
-
- -
-
-
- } -
- *@ - - - @foreach (var product in ProductList) - { - - - - - - - } - -
- @product.Description - - @product.Sku - - @product.Quantity - - Genbestil -
- -} -else -{ -
Ingen data
-} diff --git a/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs b/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs index fcb900c2..2d33cbde 100644 --- a/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs +++ b/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs @@ -132,8 +132,8 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository { var x = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmRpcSyncExt}/{syncDate}"); if (!x.IsSuccessStatusCode) - return ""; + return string.Empty; var content = await x.Content.ReadAsStringAsync(); - return content; + return content.Replace("\"", ""); } } \ No newline at end of file diff --git a/Wonky.Client/Models/PSort.cs b/Wonky.Client/Models/PSort.cs new file mode 100644 index 00000000..147f27f7 --- /dev/null +++ b/Wonky.Client/Models/PSort.cs @@ -0,0 +1,10 @@ +namespace Wonky.Client.Models; + +public enum PSort +{ + None, + Desc, + Sku, + Qty, + Abbr +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmActivityNewPage.razor b/Wonky.Client/Pages/ActivityCreatePage.razor similarity index 98% rename from Wonky.Client/Pages/CrmActivityNewPage.razor rename to Wonky.Client/Pages/ActivityCreatePage.razor index ea304e21..e240c5af 100644 --- a/Wonky.Client/Pages/CrmActivityNewPage.razor +++ b/Wonky.Client/Pages/ActivityCreatePage.razor @@ -329,12 +329,13 @@ else Kundekort
- +
} - + - \ No newline at end of file + + \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmActivityNewPage.razor.cs b/Wonky.Client/Pages/ActivityCreatePage.razor.cs similarity index 83% rename from Wonky.Client/Pages/CrmActivityNewPage.razor.cs rename to Wonky.Client/Pages/ActivityCreatePage.razor.cs index 5ea699df..42bfe47e 100644 --- a/Wonky.Client/Pages/CrmActivityNewPage.razor.cs +++ b/Wonky.Client/Pages/ActivityCreatePage.razor.cs @@ -31,13 +31,13 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmActivityNewPage : IDisposable +public partial class ActivityCreatePage : IDisposable { // Parameters [CascadingParameter] DraftStateProvider DraftProvider { get; set; } [Parameter] public string CompanyId { get; set; } // Services - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public UserPrefService Prefs { get; set; } [Inject] public IToastService Toast { get; set; } @@ -47,6 +47,7 @@ public partial class CrmActivityNewPage : IDisposable [Inject] public ICrmCompanyHttpRepository CompanyRepo { get; set; } [Inject] public ICrmActivityHttpRepository ActivityRepo { get; set; } [Inject] public ICrmReportHttpRepository ReportRepo { get; set; } + [Inject] public ICrmHistoryHttpRepository HistoryRepo { get; set; } // variables private readonly JsonSerializerOptions? _options = new() {PropertyNameCaseInsensitive = true}; private SalesItemView SelectedItem { get; set; } = new(); @@ -75,7 +76,10 @@ public partial class CrmActivityNewPage : IDisposable private PriceListModal PriceListModal { get; set; } private ProductHistoryModal HistoryModal { get; set; } private ProductPriceHistoryModal PriceHistoryModal { get; set; } - private ConfirmWorkDateModal ConfirmWorkDate { get; set; } = new(); + private ConfirmWorkDateModal ConfirmWorkDateModal { get; set; } = new(); + private ConfirmProductCheckModal ConfirmProductCheckModal { get; set; } = new(); + private List CheckList { get; set; } = new(); + /// /// Page initialization @@ -138,7 +142,7 @@ public partial class CrmActivityNewPage : IDisposable if (!UserPrefs.DateConfirmed) { PromptDateConfirm = $"Aktiviteter oprettes med dato {SelectedDate.ToShortDateString()}. Er dette OK?"; - ConfirmWorkDate.Show(); + ConfirmWorkDateModal.Show(); } // Lines may already have been added from the company inventory page if (DraftProvider.Draft.DraftType == "order") @@ -151,6 +155,70 @@ public partial class CrmActivityNewPage : IDisposable Working = false; //StateHasChanged(); } + + private async Task CallConfirmProductCheckModel() + { + // check if new account + if (string.IsNullOrWhiteSpace(Company.Account) + || Company.Account.ToLower() == "ny" + || Activity.ActivityStatusEnum.ToLower() == "quote") + { + // proceed to create activity - as there is no product check to be done + await CreateActivity(); + return; + } + + // check if product has been checked + // fetch products from storage + var storage = await Storage.GetItemAsStringAsync($"{CompanyId}-products"); + // fetch pDate from storage + var pDate = await Storage.GetItemAsStringAsync($"{CompanyId}-pDate"); + // check if product data is valid and updated today + if (string.IsNullOrWhiteSpace(storage) || DateTime.Parse(pDate.Replace("\"", "")) < DateTime.Now) + { + Working = true; + + // pop a message + Toast.ShowError("Produkt gennemgang mangler. Vent mens produkt oversigt indlæses. Gå ikke væk fra siden!", "Produkt check ..."); + // product inventory has not been updated + // send rpc call to sync ERP to CRM + Toast.ShowInfo("Vent mens data synkroniseres ...", "ERP til CRM ..."); + var ts = await HistoryRepo.ErpInvoiceToCrmRpc(CompanyId, Company.HistorySync); + while (string.IsNullOrWhiteSpace(ts)) + { + await Task.Delay(1000); + } + // save pDate + await Storage.SetItemAsync($"{CompanyId}-pDate", ts); + // request products from backend + Toast.ShowInfo("Vent mens produkt oversigt hentes", "CRM produkt liste"); + CheckList = await HistoryRepo.FetchInventory(CompanyId); + CheckList = CheckList.OrderBy(x => x.Description).ToList(); + await Storage.SetItemAsync($"{CompanyId}-products", CheckList); + Working = false; + } + else + { + // deserialize storage data + CheckList = JsonSerializer.Deserialize>(storage); + if(CheckList.Any()) + CheckList = CheckList.OrderBy(x => x.Description).ToList(); + } + + // Show CheckList modal + ConfirmProductCheckModal.Show(); + } + private async Task ConfirmProductCheckCallback() + { + await CreateActivity(); + foreach (var item in CheckList) + { + item.Check = false; + } + + await Storage.SetItemAsync($"{CompanyId}-products", CheckList); + ConfirmProductCheckModal.Hide(); + } /// /// Work Date confirm callback @@ -158,7 +226,7 @@ public partial class CrmActivityNewPage : IDisposable private async Task WorkDateConfirmCallback() { await Prefs.SetDateConfirmed(true); - ConfirmWorkDate.Hide(); + ConfirmWorkDateModal.Hide(); StateHasChanged(); } @@ -223,7 +291,7 @@ public partial class CrmActivityNewPage : IDisposable /// private async Task CreateActivity() { - // disable submit button to avoid multiple clicks + // avoid duplication if (Working) return; // validate customer address1 - this is a required input diff --git a/Wonky.Client/Pages/CrmActivityTodayPage.razor b/Wonky.Client/Pages/ActivityListTodayPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmActivityTodayPage.razor rename to Wonky.Client/Pages/ActivityListTodayPage.razor diff --git a/Wonky.Client/Pages/CrmActivityTodayPage.razor.cs b/Wonky.Client/Pages/ActivityListTodayPage.razor.cs similarity index 95% rename from Wonky.Client/Pages/CrmActivityTodayPage.razor.cs rename to Wonky.Client/Pages/ActivityListTodayPage.razor.cs index 8aeb11d3..287372ee 100644 --- a/Wonky.Client/Pages/CrmActivityTodayPage.razor.cs +++ b/Wonky.Client/Pages/ActivityListTodayPage.razor.cs @@ -25,10 +25,10 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmActivityTodayPage : IDisposable +public partial class ActivityListTodayPage : IDisposable { [Inject] public UserPrefService UserPrefService { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public NavigationManager Navigator { get; set; } [Inject] public ICrmActivityHttpRepository CrmActivityRepo { get; set; } diff --git a/Wonky.Client/Pages/CrmActivityViewPage.razor b/Wonky.Client/Pages/ActivityViewPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmActivityViewPage.razor rename to Wonky.Client/Pages/ActivityViewPage.razor diff --git a/Wonky.Client/Pages/CrmActivityViewPage.razor.cs b/Wonky.Client/Pages/ActivityViewPage.razor.cs similarity index 96% rename from Wonky.Client/Pages/CrmActivityViewPage.razor.cs rename to Wonky.Client/Pages/ActivityViewPage.razor.cs index 7eeee6b7..068a48fe 100644 --- a/Wonky.Client/Pages/CrmActivityViewPage.razor.cs +++ b/Wonky.Client/Pages/ActivityViewPage.razor.cs @@ -29,13 +29,13 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmActivityViewPage : IDisposable +public partial class ActivityViewPage : IDisposable { [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string OrderId { get; set; } = ""; [Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public ICrmActivityHttpRepository ActivityRepo { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public IToastService Toaster { get; set; } [Inject] public NavigationManager Navigator { get; set; } private ReportItemView ReportItem { get; set; } = new(); diff --git a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs deleted file mode 100644 index 35a77f8c..00000000 --- a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Net.NetworkInformation; -using System.Text.Json; -using Blazored.Toast.Services; -using Microsoft.AspNetCore.Components; -using Wonky.Client.HttpInterceptors; -using Wonky.Client.HttpInterfaces; -using Wonky.Entity.DTO; -using Wonky.Entity.Views; - -namespace Wonky.Client.Pages; - -public partial class CrmCompanyInvoiceListPage : IDisposable -{ - [Parameter] public string CompanyId { get; set; } = ""; - [Inject] public ICrmCompanyHttpRepository CompanyRepo { get; set; } - [Inject] public HttpInterceptorService Interceptor { get; set; } - [Inject] public ICrmHistoryHttpRepository HistoryRepo { get; set; } - [Inject] public IToastService Toaster { get; set; } - private InvoiceListView History { get; set; } = new(); - private CompanyDto Company { get; set; } = new(); - private bool Working { get; set; } = true; - - protected override async Task OnInitializedAsync() - { - Interceptor.RegisterEvent(); - Interceptor.RegisterBeforeSendEvent(); - - Company = await CompanyRepo.GetCompanyById(CompanyId); - - while (string.IsNullOrWhiteSpace(Company.HistorySync)) - { - await Task.Delay(1000); - } - var ts = await HistoryRepo.ErpInvoiceToCrmRpc(CompanyId, Company.HistorySync); - while (string.IsNullOrWhiteSpace(ts)) - { - await Task.Delay(1000); - } - - Company = await CompanyRepo.GetCompanyById(CompanyId); - - while (string.IsNullOrWhiteSpace(Company.HistorySync)) - { - await Task.Delay(1000); - } - ts = await HistoryRepo.ErpInvoiceToCrmRpc(CompanyId, Company.HistorySync); - while (string.IsNullOrWhiteSpace(ts)) - { - await Task.Delay(1000); - } - History = await HistoryRepo.FetchInvoiceList(CompanyId); - Working = false; - } - - public void Dispose() - { - Interceptor.DisposeEvent(); - } -} diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor b/Wonky.Client/Pages/CrmCompanyViewPage.razor deleted file mode 100644 index 1c4714bf..00000000 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor +++ /dev/null @@ -1,242 +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 Microsoft.AspNetCore.Authorization -@using Microsoft.AspNetCore.Components -@using Wonky.Client.Components -@attribute [Authorize(Roles = "Advisor")] -@page "/companies/{CompanyId}" - -@if (!string.IsNullOrWhiteSpace(Company.Account)) -{ - @if (!string.IsNullOrWhiteSpace(Company.Blocked)) - { -
-

Ring til kontoret. Denne konto er spærret med kode '@Company.Blocked'

-
- } -
-

@Company.Name

-
- // erp context - - -
- @* Company Name *@ - -
- - -
- @* Company Attention *@ - -
- - -
- @* Address 1 *@ - -
- - -
- @* Address 2 *@ - -
- - -
- @* Post Code *@ - -
- - -
- @* City Name *@ - -
- - -
- @* Phone *@ - -
- - -
- @* Mobile *@ - -
- - -
- @* Email *@ - -
- - -
-
- -
-
- -
- - @* account *@ - -
- -
- @* vat number*@ - -
-
- - - - - -
-
- @* vat lookup *@ -
- -
- @* save vat number *@ -
- -
-
- -
- @* activity buttons *@ -
-
- Faktura -
- @* -
- Tilbud -
- *@ - -
- Produkter -
-
- - -
-
- -
- @* crm context - OBS note *@ -
- -
- @if (string.IsNullOrWhiteSpace(Company.Note)) - { - - } - else - { - - } - -
- @* Save CRM data button *@ -
- -
-
- @* crm context - contacts *@ -
- -
-
-
-
-
Stilling
-
Navn
-
Direkte
-
- -
-
-
- @if (Contacts.Any()) - { - @foreach (var contact in Contacts) - { -
-
-
@contact.JobTitle
-
@contact.FirstName @contact.LastName
-
@contact.PhoneDirect
-
- -
-
-
- } - } -
-
- -
- -
-
- @* crm context - dates and interval *@ -
- -
-
- - - - -
-
- -
- -
- -
- - -
-
-
-} - - - - -@if (Working) -{ - -} diff --git a/Wonky.Client/Pages/CrmCompanyActivityListPage.razor b/Wonky.Client/Pages/CustomerActivityListPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmCompanyActivityListPage.razor rename to Wonky.Client/Pages/CustomerActivityListPage.razor diff --git a/Wonky.Client/Pages/CrmCompanyActivityListPage.razor.cs b/Wonky.Client/Pages/CustomerActivityListPage.razor.cs similarity index 97% rename from Wonky.Client/Pages/CrmCompanyActivityListPage.razor.cs rename to Wonky.Client/Pages/CustomerActivityListPage.razor.cs index b14c4d40..c6d9eb78 100644 --- a/Wonky.Client/Pages/CrmCompanyActivityListPage.razor.cs +++ b/Wonky.Client/Pages/CustomerActivityListPage.razor.cs @@ -25,7 +25,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmCompanyActivityListPage : IDisposable +public partial class CustomerActivityListPage : IDisposable { [Parameter] public string CompanyId { get; set; } = ""; [Inject] public HttpInterceptorService _interceptor { get; set; } diff --git a/Wonky.Client/Pages/CrmCompanyNewPage.razor b/Wonky.Client/Pages/CustomerCardCreatePage.razor similarity index 100% rename from Wonky.Client/Pages/CrmCompanyNewPage.razor rename to Wonky.Client/Pages/CustomerCardCreatePage.razor diff --git a/Wonky.Client/Pages/CrmCompanyNewPage.razor.cs b/Wonky.Client/Pages/CustomerCardCreatePage.razor.cs similarity index 98% rename from Wonky.Client/Pages/CrmCompanyNewPage.razor.cs rename to Wonky.Client/Pages/CustomerCardCreatePage.razor.cs index b1ed425d..4597141f 100644 --- a/Wonky.Client/Pages/CrmCompanyNewPage.razor.cs +++ b/Wonky.Client/Pages/CustomerCardCreatePage.razor.cs @@ -37,10 +37,10 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages { - public partial class CrmCompanyNewPage : IDisposable + public partial class CustomerCardCreatePage : IDisposable { [Inject] public IToastService Toaster { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public ILocalStorageService Storage { get; set; } [Inject] public NavigationManager Navigator { get; set; } [Inject] public ICrmCompanyHttpRepository CompanyRepo { get; set; } diff --git a/Wonky.Client/Pages/CustomerCardPage.razor b/Wonky.Client/Pages/CustomerCardPage.razor new file mode 100644 index 00000000..aaebfbba --- /dev/null +++ b/Wonky.Client/Pages/CustomerCardPage.razor @@ -0,0 +1,239 @@ +@* +// 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 Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Components +@using Wonky.Client.Components +@attribute [Authorize(Roles = "Advisor")] +@page "/companies/{CompanyId}" + +@if (!string.IsNullOrWhiteSpace(Company.Account)) +{ + @if (!string.IsNullOrWhiteSpace(Company.Blocked)) + { +
+

Ring til kontoret. Denne konto er spærret med kode '@Company.Blocked'

+
+ } +
+

@Company.Name

+
+ // erp context + + +
+ @* Company Name *@ + +
+ + +
+ @* Company Attention *@ + +
+ + +
+ @* Address 1 *@ + +
+ + +
+ @* Address 2 *@ + +
+ + +
+ @* Post Code *@ + +
+ + +
+ @* City Name *@ + +
+ + +
+ @* Phone *@ + +
+ + +
+ @* Mobile *@ + +
+ + +
+ @* Email *@ + +
+ + +
+
+ +
+
+ +
+ + @* account *@ + +
+ +
+ @* vat number*@ + +
+
+ + + + + +
+
+ @* vat lookup *@ +
+ +
+ @* save vat number *@ +
+ +
+
+ +
+ @* activity buttons *@ +
+
+ Faktura +
+ +
+ Produkter +
+
+ + +
+
+ +
+ @* crm context - OBS note *@ +
+ +
+ @if (string.IsNullOrWhiteSpace(Company.Note)) + { + + } + else + { + + } + +
+ @* Save CRM data button *@ +
+ +
+
+ @* crm context - contacts *@ +
+ +
+
+
+
+
Stilling
+
Navn
+
Direkte
+
+ +
+
+
+ @if (Contacts.Any()) + { + @foreach (var contact in Contacts) + { +
+
+
@contact.JobTitle
+
@contact.FirstName @contact.LastName
+
@contact.PhoneDirect
+
+ +
+
+
+ } + } +
+
+
+ @* crm context - dates and interval *@ +
+ +
+
+ + + + +
+
+ +
+ +
+ +
+ + +
+
+
+ +
+ +
+
+
+} + + + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs b/Wonky.Client/Pages/CustomerCardPage.razor.cs similarity index 99% rename from Wonky.Client/Pages/CrmCompanyViewPage.razor.cs rename to Wonky.Client/Pages/CustomerCardPage.razor.cs index 19f50765..3b485028 100644 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs +++ b/Wonky.Client/Pages/CustomerCardPage.razor.cs @@ -31,11 +31,11 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmCompanyViewPage : IDisposable +public partial class CustomerCardPage : IDisposable { [Parameter] public string CompanyId { get; set; } = ""; [Inject] public IToastService Toaster { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public NavigationManager Navigator { get; set; } [Inject] public ICrmCompanyHttpRepository CompanyRepo { get; set; } [Inject] public ICrmHistoryHttpRepository HistoryRepo { get; set; } diff --git a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor b/Wonky.Client/Pages/CustomerInvoiceListPage.razor similarity index 96% rename from Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor rename to Wonky.Client/Pages/CustomerInvoiceListPage.razor index acf3ae97..16a620c4 100644 --- a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor +++ b/Wonky.Client/Pages/CustomerInvoiceListPage.razor @@ -14,7 +14,7 @@ Besøg - + } @if (Working) diff --git a/Wonky.Client/Pages/CustomerInvoiceListPage.razor.cs b/Wonky.Client/Pages/CustomerInvoiceListPage.razor.cs new file mode 100644 index 00000000..b23fb487 --- /dev/null +++ b/Wonky.Client/Pages/CustomerInvoiceListPage.razor.cs @@ -0,0 +1,78 @@ +using System.Globalization; +using System.Net.NetworkInformation; +using System.Text.Json; +using Blazored.LocalStorage; +using Blazored.Toast.Services; +using Microsoft.AspNetCore.Components; +using Wonky.Client.HttpInterceptors; +using Wonky.Client.HttpInterfaces; +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +namespace Wonky.Client.Pages; + +public partial class CustomerInvoiceListPage : IDisposable +{ + [Parameter] public string CompanyId { get; set; } = ""; + [Inject] public ICrmCompanyHttpRepository CompanyRepo { get; set; } + [Inject] public HttpInterceptorService Interceptor { get; set; } + [Inject] public ICrmHistoryHttpRepository HistoryRepo { get; set; } + [Inject] public IToastService Toaster { get; set; } + [Inject] public ILocalStorageService Storage { get; set; } + [Inject] public ILogger Logger { get; set; } + private InvoiceListView CompanyInvoices { get; set; } = new(); + private CompanyDto Company { get; set; } = new(); + private bool Working { get; set; } = true; + + protected override async Task OnInitializedAsync() + { + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); + + Company = await CompanyRepo.GetCompanyById(CompanyId); + while (string.IsNullOrWhiteSpace(Company.HistorySync)) + { + await Task.Delay(1000); + } + + var iDate = await Storage.GetItemAsStringAsync($"{Company.CompanyId}-iDate"); + if (string.IsNullOrWhiteSpace(iDate) || (iDate == Company.HistorySync && iDate != $"{DateTime.Now:yyyy-MM-dd}")) + { + // send rpc to sync invoices from ERP to CRM + var ts = await HistoryRepo.ErpInvoiceToCrmRpc(CompanyId, Company.HistorySync); + // wait until we have the result + while (string.IsNullOrWhiteSpace(ts)) + { + await Task.Delay(1000); + } + await Storage.SetItemAsync($"{Company.CompanyId}-iDate", ts); + } + + CompanyInvoices = await FetchCompanyInvoices(); + Working = false; + } + + private async Task FetchCompanyInvoices() + { + var storage = await Storage.GetItemAsStringAsync($"{Company.CompanyId}-invoices"); + var iDate = await Storage.GetItemAsStringAsync($"{Company.CompanyId}-iDate"); + // if we have a list and iDate was today return the list + if (!string.IsNullOrWhiteSpace(storage) && DateTime.Parse(iDate.Replace("\"", "")) >= DateTime.Now) + { + Logger.LogDebug("return invoices from storage"); + return JsonSerializer.Deserialize(storage); + } + Logger.LogDebug("pulling invoices from backend"); + // pull invoices + var invoices = await HistoryRepo.FetchInvoiceList(CompanyId); + // send invoices to storage + await Storage.SetItemAsync($"{Company.CompanyId}-invoices", invoices); + Logger.LogDebug("return invoices from backend"); + return invoices; + } + + public void Dispose() + { + Interceptor.DisposeEvent(); + } +} diff --git a/Wonky.Client/Pages/CrmCompanyListPage.razor b/Wonky.Client/Pages/CustomerListPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmCompanyListPage.razor rename to Wonky.Client/Pages/CustomerListPage.razor diff --git a/Wonky.Client/Pages/CrmCompanyListPage.razor.cs b/Wonky.Client/Pages/CustomerListPage.razor.cs similarity index 98% rename from Wonky.Client/Pages/CrmCompanyListPage.razor.cs rename to Wonky.Client/Pages/CustomerListPage.razor.cs index d1ac537c..d791ec3e 100644 --- a/Wonky.Client/Pages/CrmCompanyListPage.razor.cs +++ b/Wonky.Client/Pages/CustomerListPage.razor.cs @@ -28,7 +28,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages { - public partial class CrmCompanyListPage : IDisposable + public partial class CustomerListPage : IDisposable { [Inject] public ILocalStorageService Storage { get; set; } [Inject] public UserPrefService PrefService { get; set; } diff --git a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor b/Wonky.Client/Pages/CustomerProductListPage.razor similarity index 86% rename from Wonky.Client/Pages/CrmCompanyInventoryPage.razor rename to Wonky.Client/Pages/CustomerProductListPage.razor index 9f40ab62..f4899d73 100644 --- a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor +++ b/Wonky.Client/Pages/CustomerProductListPage.razor @@ -24,13 +24,13 @@

@Company.Name

- + @if (Working) diff --git a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor.cs b/Wonky.Client/Pages/CustomerProductListPage.razor.cs similarity index 52% rename from Wonky.Client/Pages/CrmCompanyInventoryPage.razor.cs rename to Wonky.Client/Pages/CustomerProductListPage.razor.cs index af1224ea..50428004 100644 --- a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor.cs +++ b/Wonky.Client/Pages/CustomerProductListPage.razor.cs @@ -14,7 +14,9 @@ // +using System.Globalization; using System.Text.Json; +using Blazored.LocalStorage; using Blazored.Toast.Services; using Microsoft.AspNetCore.Components; using Wonky.Client.HttpInterceptors; @@ -25,14 +27,15 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmCompanyInventoryPage : IDisposable +public partial class CustomerProductListPage : IDisposable { [Parameter] public string CompanyId { get; set; } = ""; [Inject] public ICrmHistoryHttpRepository HistoryRepo { get; set; } [Inject] public ICrmCompanyHttpRepository CompanyRepo { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public IToastService Toaster { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } + [Inject] public ILocalStorageService Storage { get; set; } private CompanyDto Company { get; set; } = new(); private List Inventory { get; set; } = new(); private bool Working { get; set; } = true; @@ -48,22 +51,41 @@ public partial class CrmCompanyInventoryPage : IDisposable { await Task.Delay(1000); } - var ts = await HistoryRepo.ErpInvoiceToCrmRpc(CompanyId, Company.HistorySync); - while (string.IsNullOrWhiteSpace(ts)) + + var pDate = await Storage.GetItemAsStringAsync($"{Company.CompanyId}-pDate"); + if (string.IsNullOrWhiteSpace(pDate) || (pDate == Company.HistorySync && pDate != $"{DateTime.Now:yyyy-MM-dd}")) { - await Task.Delay(1000); + var ts = await HistoryRepo.ErpInvoiceToCrmRpc(CompanyId, Company.HistorySync); + while (string.IsNullOrWhiteSpace(ts)) + { + await Task.Delay(1000); + } + await Storage.SetItemAsync($"{Company.CompanyId}-pDate", ts); } - - await FetchInventory(); + // fetch product inventory + Inventory = await FetchProductInventory(); Working = false; } - private async Task FetchInventory() + private async Task> FetchProductInventory() { - Working = true; - Inventory = await HistoryRepo.FetchInventory(CompanyId); - Inventory = Inventory.Any() ? Inventory.OrderBy(x => x.Description).ToList() : new List(); - Working = false; + var storage = await Storage.GetItemAsStringAsync($"{Company.CompanyId}-products"); + var pDate = await Storage.GetItemAsStringAsync($"{Company.CompanyId}-pDate"); + // if we have a list and pDate was today return the list + if (!string.IsNullOrWhiteSpace(storage) || DateTime.Parse(pDate.Replace("\"", "")) >= DateTime.Now) + { + Logger.LogDebug("return products from storage"); + return JsonSerializer.Deserialize>(storage); + } + Logger.LogDebug("pulling products from backend"); + // fetch product history + var inventory = await HistoryRepo.FetchInventory(CompanyId); + // default sort order by description + inventory = inventory.Any() ? inventory.OrderBy(x => x.Description).ToList() : new List(); + // send products to storage + await Storage.SetItemAsync($"{Company.CompanyId}-products", inventory); + Logger.LogDebug("return products from backend"); + return inventory; } public void Dispose() diff --git a/Wonky.Client/Pages/CrmQuotesListPage.razor b/Wonky.Client/Pages/QuoteListPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmQuotesListPage.razor rename to Wonky.Client/Pages/QuoteListPage.razor diff --git a/Wonky.Client/Pages/CrmQuotesListPage.razor.cs b/Wonky.Client/Pages/QuoteListPage.razor.cs similarity index 96% rename from Wonky.Client/Pages/CrmQuotesListPage.razor.cs rename to Wonky.Client/Pages/QuoteListPage.razor.cs index a029be4e..d3a39159 100644 --- a/Wonky.Client/Pages/CrmQuotesListPage.razor.cs +++ b/Wonky.Client/Pages/QuoteListPage.razor.cs @@ -13,11 +13,11 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmQuotesListPage : IDisposable +public partial class QuoteListPage : IDisposable { [Inject] public ICrmActivityHttpRepository ActivityRepo { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public IToastService Toaster { get; set; } [Inject] public ILocalStorageService Storage { get; set; } private List Quotes { get; set; } = new(); diff --git a/Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor b/Wonky.Client/Pages/WorkplaceDocumentListPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor rename to Wonky.Client/Pages/WorkplaceDocumentListPage.razor diff --git a/Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor.cs b/Wonky.Client/Pages/WorkplaceDocumentListPage.razor.cs similarity index 96% rename from Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor.cs rename to Wonky.Client/Pages/WorkplaceDocumentListPage.razor.cs index 57b89bc1..7083f2e9 100644 --- a/Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor.cs +++ b/Wonky.Client/Pages/WorkplaceDocumentListPage.razor.cs @@ -21,7 +21,7 @@ using Wonky.Client.HttpRepository; namespace Wonky.Client.Pages; -public partial class CrmWorkplaceDocumentListPage +public partial class WorkplaceDocumentListPage { [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string WorkplaceId { get; set; } = ""; diff --git a/Wonky.Client/Pages/CrmWorkplaceListPage.razor b/Wonky.Client/Pages/WorkplaceListPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmWorkplaceListPage.razor rename to Wonky.Client/Pages/WorkplaceListPage.razor diff --git a/Wonky.Client/Pages/CrmWorkplaceListPage.razor.cs b/Wonky.Client/Pages/WorkplaceListPage.razor.cs similarity index 97% rename from Wonky.Client/Pages/CrmWorkplaceListPage.razor.cs rename to Wonky.Client/Pages/WorkplaceListPage.razor.cs index 720bae46..143fc09b 100644 --- a/Wonky.Client/Pages/CrmWorkplaceListPage.razor.cs +++ b/Wonky.Client/Pages/WorkplaceListPage.razor.cs @@ -24,7 +24,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmWorkplaceListPage : IDisposable +public partial class WorkplaceListPage : IDisposable { [Parameter] public string CompanyId { get; set; } = ""; [Inject] public ICrmWorkplaceHttpRepository CrmWorkplaceRepo { get; set; } diff --git a/Wonky.Client/Pages/CrmWorkplaceViewPage.razor b/Wonky.Client/Pages/WorkplaceViewPage.razor similarity index 100% rename from Wonky.Client/Pages/CrmWorkplaceViewPage.razor rename to Wonky.Client/Pages/WorkplaceViewPage.razor diff --git a/Wonky.Client/Pages/CrmWorkplaceViewPage.razor.cs b/Wonky.Client/Pages/WorkplaceViewPage.razor.cs similarity index 97% rename from Wonky.Client/Pages/CrmWorkplaceViewPage.razor.cs rename to Wonky.Client/Pages/WorkplaceViewPage.razor.cs index 2bc11932..479f2146 100644 --- a/Wonky.Client/Pages/CrmWorkplaceViewPage.razor.cs +++ b/Wonky.Client/Pages/WorkplaceViewPage.razor.cs @@ -25,7 +25,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CrmWorkplaceViewPage : IDisposable +public partial class WorkplaceViewPage : IDisposable { [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string WorkplaceId { get; set; } = ""; diff --git a/Wonky.Client/Services/AuthenticationService.cs b/Wonky.Client/Services/AuthenticationService.cs index 4b835a68..7856b45b 100644 --- a/Wonky.Client/Services/AuthenticationService.cs +++ b/Wonky.Client/Services/AuthenticationService.cs @@ -120,7 +120,7 @@ namespace Wonky.Client.Services { ((AuthStateProvider)_authStateProvider).NotifyUserLogout(); _client.DefaultRequestHeaders.Authorization = null; - await _localStorage.RemoveItemsAsync(new List {"_xa", "_xe", "_xr", "_xu"}); + await _localStorage.ClearAsync(); } public async Task UserInfo(bool write = false) diff --git a/Wonky.Client/Shared/ConfirmProductCheckModal.razor b/Wonky.Client/Shared/ConfirmProductCheckModal.razor new file mode 100644 index 00000000..6aa75cee --- /dev/null +++ b/Wonky.Client/Shared/ConfirmProductCheckModal.razor @@ -0,0 +1,39 @@ +@* +// 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.Components + +@if (_showBackdrop) +{ + +} \ No newline at end of file diff --git a/Wonky.Client/Shared/ConfirmProductCheckModal.razor.cs b/Wonky.Client/Shared/ConfirmProductCheckModal.razor.cs new file mode 100644 index 00000000..ccee0e0d --- /dev/null +++ b/Wonky.Client/Shared/ConfirmProductCheckModal.razor.cs @@ -0,0 +1,43 @@ +// 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 Microsoft.AspNetCore.Components; +using Wonky.Entity.Views; + +namespace Wonky.Client.Shared; + +public partial class ConfirmProductCheckModal +{ + private string _modalDisplay = ""; + private bool _showBackdrop; + [Parameter] public string BodyMessage { get; set; } = ""; + [Parameter] public string CompanyId { get; set; } = ""; + [Parameter] public List Products { get; set; } = new(); + [Parameter] public EventCallback OnOkClicked { get; set; } + + public void Show() + { + _modalDisplay = "block;"; + _showBackdrop = true; + StateHasChanged(); + } + + public void Hide() + { + _modalDisplay = "none;"; + _showBackdrop = false; + StateHasChanged(); + } +} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index d6d0f6f3..6aee5bcf 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,13 +1,13 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.86.0", + "version": "0.86.1", "rc": true, "sandBox": false, "image": "grumpy-coder.png" }, "apiConfig": { - "baseUrl": "https://dev.innotec.dk", + "baseUrl": "https://zeta.innotec.dk", "catalog": "api/v2/catalog", "crmCustomers": "api/v2/crm/companies", "crmInventoryExt": "history/inventory", @@ -34,7 +34,7 @@ }, "Logging": { "LogLevel": { - "Default": "Information", + "Default": "Debug", "System": "Information", "Microsoft": "Information" }, diff --git a/Wonky.Entity/Views/ProductInventoryView.cs b/Wonky.Entity/Views/ProductInventoryView.cs index 27250d3c..afce9ed2 100644 --- a/Wonky.Entity/Views/ProductInventoryView.cs +++ b/Wonky.Entity/Views/ProductInventoryView.cs @@ -29,4 +29,8 @@ public class ProductInventoryView /// quantity bought over time ///
public int Quantity { get; set; } + /// + /// Virtual checkmark + /// + public virtual bool Check { get; set; } } \ No newline at end of file From 6a246b1dc56f25258a3f04bab7cb62893d7c2e52 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Thu, 22 Dec 2022 15:00:07 +0100 Subject: [PATCH 2/2] built v.0.87.1 --- .../OfficeReportTableComponent.razor.cs | 2 +- .../Components/ReportTableComponent.razor.cs | 4 +- .../Components/WorkDateComponent.razor | 4 +- .../ICrmReportHttpRepository.cs | 2 +- .../IOfficeReportHttpRepository.cs | 2 +- .../HttpRepository/CrmReportHttpRepository.cs | 4 +- .../OfficeReportHttpRepository.cs | 4 +- Wonky.Client/Models/PTarget.cs | 9 ++ Wonky.Client/Pages/ActivityCreatePage.razor | 17 ---- Wonky.Client/Pages/CatalogPage.razor | 2 +- Wonky.Client/Pages/CrmReportListPage.razor.cs | 2 +- Wonky.Client/Pages/CrmReportViewPage.razor | 43 +++++---- Wonky.Client/Pages/CrmReportViewPage.razor.cs | 32 +++++-- Wonky.Client/Pages/OfficeReportListPage.razor | 2 +- .../Pages/OfficeReportListPage.razor.cs | 23 +++-- Wonky.Client/Pages/OfficeReportViewPage.razor | 96 ++++++++++--------- .../Pages/OfficeReportViewPage.razor.cs | 77 ++++++++++----- ...PrintPage.razor => PrintCatalogPage.razor} | 2 +- ...age.razor.cs => PrintCatalogPage.razor.cs} | 2 +- Wonky.Client/Pages/PrintOrdersPage.razor | 32 +++++++ Wonky.Client/Pages/PrintOrdersPage.razor.cs | 64 +++++++++++++ Wonky.Client/Pages/PrintReportPage.razor | 46 +++++++++ Wonky.Client/Pages/PrintReportPage.razor.cs | 63 ++++++++++++ Wonky.Client/Shared/MainLayout.razor | 2 +- Wonky.Client/wwwroot/appsettings.json | 2 +- .../wwwroot/css/{app-v0.38.css => app.css} | 52 ---------- Wonky.Client/wwwroot/css/print.css | 53 ++++++++++ Wonky.Client/wwwroot/index.html | 17 ++-- Wonky.Client/wwwroot/scripts/bsTooltip.js | 4 - Wonky.Client/wwwroot/scripts/print-invoke.js | 7 ++ Wonky.Client/wwwroot/scripts/scripts.js | 16 ---- ...portListView.cs => SalesReportListView.cs} | 2 +- 32 files changed, 466 insertions(+), 223 deletions(-) create mode 100644 Wonky.Client/Models/PTarget.cs rename Wonky.Client/Pages/{CatalogPrintPage.razor => PrintCatalogPage.razor} (97%) rename Wonky.Client/Pages/{CatalogPrintPage.razor.cs => PrintCatalogPage.razor.cs} (97%) create mode 100644 Wonky.Client/Pages/PrintOrdersPage.razor create mode 100644 Wonky.Client/Pages/PrintOrdersPage.razor.cs create mode 100644 Wonky.Client/Pages/PrintReportPage.razor create mode 100644 Wonky.Client/Pages/PrintReportPage.razor.cs rename Wonky.Client/wwwroot/css/{app-v0.38.css => app.css} (73%) create mode 100644 Wonky.Client/wwwroot/css/print.css delete mode 100644 Wonky.Client/wwwroot/scripts/bsTooltip.js create mode 100644 Wonky.Client/wwwroot/scripts/print-invoke.js delete mode 100644 Wonky.Client/wwwroot/scripts/scripts.js rename Wonky.Entity/Views/{NgSalesReportListView.cs => SalesReportListView.cs} (97%) diff --git a/Wonky.Client/Components/OfficeReportTableComponent.razor.cs b/Wonky.Client/Components/OfficeReportTableComponent.razor.cs index 9e0f86e9..5f21c66e 100644 --- a/Wonky.Client/Components/OfficeReportTableComponent.razor.cs +++ b/Wonky.Client/Components/OfficeReportTableComponent.razor.cs @@ -20,7 +20,7 @@ namespace Wonky.Client.Components; public partial class OfficeReportTableComponent { - [Parameter] public List ReportList { get; set; } = new(); + [Parameter] public List ReportList { get; set; } = new(); [Parameter] public string UserId { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = ""; } \ No newline at end of file diff --git a/Wonky.Client/Components/ReportTableComponent.razor.cs b/Wonky.Client/Components/ReportTableComponent.razor.cs index 4da8d7c1..f7646d44 100644 --- a/Wonky.Client/Components/ReportTableComponent.razor.cs +++ b/Wonky.Client/Components/ReportTableComponent.razor.cs @@ -21,8 +21,8 @@ namespace Wonky.Client.Components; public partial class ReportTableComponent { - [Parameter] public List ReportList { get; set; } = new(); - private List _reports { get; set; } = new(); + [Parameter] public List ReportList { get; set; } = new(); + private List _reports { get; set; } = new(); protected override void OnParametersSet() { _reports = ReportList; diff --git a/Wonky.Client/Components/WorkDateComponent.razor b/Wonky.Client/Components/WorkDateComponent.razor index 6dbc50a3..e9e1d862 100644 --- a/Wonky.Client/Components/WorkDateComponent.razor +++ b/Wonky.Client/Components/WorkDateComponent.razor @@ -21,10 +21,10 @@
-
+
@SelectedDate.ToLongDateString()
-
+
diff --git a/Wonky.Client/HttpInterfaces/ICrmReportHttpRepository.cs b/Wonky.Client/HttpInterfaces/ICrmReportHttpRepository.cs index 2ab9f1ef..d6211053 100644 --- a/Wonky.Client/HttpInterfaces/ICrmReportHttpRepository.cs +++ b/Wonky.Client/HttpInterfaces/ICrmReportHttpRepository.cs @@ -21,7 +21,7 @@ namespace Wonky.Client.HttpInterfaces; public interface ICrmReportHttpRepository { Task ReportExist(string workDate); - Task> GetReports(); + Task> GetReports(); Task GetReport(string workDate); Task InitializeReportData(string workDate); Task PostReport(string workDate, ReportDto reportDto); diff --git a/Wonky.Client/HttpInterfaces/IOfficeReportHttpRepository.cs b/Wonky.Client/HttpInterfaces/IOfficeReportHttpRepository.cs index 8c989461..bcb6bf69 100644 --- a/Wonky.Client/HttpInterfaces/IOfficeReportHttpRepository.cs +++ b/Wonky.Client/HttpInterfaces/IOfficeReportHttpRepository.cs @@ -20,6 +20,6 @@ namespace Wonky.Client.HttpInterfaces; public interface IOfficeReportHttpRepository { - Task> GetReports(string userId); + Task> GetReports(string userId); Task GetReport(string userId, string workDate); } \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/CrmReportHttpRepository.cs b/Wonky.Client/HttpRepository/CrmReportHttpRepository.cs index 84d5c462..71074793 100644 --- a/Wonky.Client/HttpRepository/CrmReportHttpRepository.cs +++ b/Wonky.Client/HttpRepository/CrmReportHttpRepository.cs @@ -47,9 +47,9 @@ public class CrmReportHttpRepository :ICrmReportHttpRepository _apiConfig = configuration.Value; } - public async Task> GetReports() + public async Task> GetReports() { - return await _client.GetFromJsonAsync>($"{_apiConfig.CrmReports}"); + return await _client.GetFromJsonAsync>($"{_apiConfig.CrmReports}"); } public async Task ReportExist(string workDate) { diff --git a/Wonky.Client/HttpRepository/OfficeReportHttpRepository.cs b/Wonky.Client/HttpRepository/OfficeReportHttpRepository.cs index e5814c79..42319199 100644 --- a/Wonky.Client/HttpRepository/OfficeReportHttpRepository.cs +++ b/Wonky.Client/HttpRepository/OfficeReportHttpRepository.cs @@ -46,9 +46,9 @@ public class OfficeReportHttpRepository : IOfficeReportHttpRepository _apiConfig = configuration.Value; } - public async Task> GetReports(string userId) + public async Task> GetReports(string userId) { - return await _client.GetFromJsonAsync>($"{_apiConfig.OfficeReports}/{userId}"); + return await _client.GetFromJsonAsync>($"{_apiConfig.OfficeReports}/{userId}"); } public async Task GetReport(string userId, string workDate) diff --git a/Wonky.Client/Models/PTarget.cs b/Wonky.Client/Models/PTarget.cs new file mode 100644 index 00000000..122d24d5 --- /dev/null +++ b/Wonky.Client/Models/PTarget.cs @@ -0,0 +1,9 @@ +namespace Wonky.Client.Models; + +public enum PTarget +{ + None, + All, + Report, + Order +} \ No newline at end of file diff --git a/Wonky.Client/Pages/ActivityCreatePage.razor b/Wonky.Client/Pages/ActivityCreatePage.razor index e240c5af..7c5d3665 100644 --- a/Wonky.Client/Pages/ActivityCreatePage.razor +++ b/Wonky.Client/Pages/ActivityCreatePage.razor @@ -262,23 +262,6 @@ else @* end draft line ------------------------------------------------- *@
- @* - $1$ Order lines #1# -
-

- -

-
-
- -
-
-
- *@ @* Delivery address *@

diff --git a/Wonky.Client/Pages/CatalogPage.razor b/Wonky.Client/Pages/CatalogPage.razor index 9bd50259..6f941ed9 100644 --- a/Wonky.Client/Pages/CatalogPage.razor +++ b/Wonky.Client/Pages/CatalogPage.razor @@ -42,7 +42,7 @@

diff --git a/Wonky.Client/Pages/CrmReportListPage.razor.cs b/Wonky.Client/Pages/CrmReportListPage.razor.cs index 4fed94f5..73926284 100644 --- a/Wonky.Client/Pages/CrmReportListPage.razor.cs +++ b/Wonky.Client/Pages/CrmReportListPage.razor.cs @@ -27,7 +27,7 @@ public partial class CrmReportListPage : IDisposable [Inject] public ICrmReportHttpRepository CrmReportRepo { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; } - private List ReportList { get; set; } = new(); + private List ReportList { get; set; } = new(); private bool Working { get; set; } = true; protected override async Task OnInitializedAsync() diff --git a/Wonky.Client/Pages/CrmReportViewPage.razor b/Wonky.Client/Pages/CrmReportViewPage.razor index a4926e4a..fa04ef17 100644 --- a/Wonky.Client/Pages/CrmReportViewPage.razor +++ b/Wonky.Client/Pages/CrmReportViewPage.razor @@ -17,36 +17,43 @@ @using Wonky.Client.Components @using Microsoft.AspNetCore.Authorization +@using Wonky.Client.Models @page "/sales-reports/view/{ReportDate}" @attribute [Authorize(Roles = "Advisor,Admin,Supervisor")]
-
- +
+
-
- +
+
-
+
+ +
+
+ +
+
- @if (!string.IsNullOrWhiteSpace(_report.ReportData.DayTypeEnum)) + @if (!string.IsNullOrWhiteSpace(Report.ReportData.DayTypeEnum)) { - @_report.ReportData.Name + @Report.ReportData.Name
-

@_report.ReportData.Name

+

@Report.ReportData.Name

- +
- +
- - + + } else { @@ -56,13 +63,9 @@ }
-
-   -
- -@if (_items.Any()) +@if (Items.Any()) { - @foreach (var item in _items) + @foreach (var item in Items) { } @@ -71,5 +74,5 @@ @if (Working) { - -} + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmReportViewPage.razor.cs b/Wonky.Client/Pages/CrmReportViewPage.razor.cs index 8b0f29d9..44d46280 100644 --- a/Wonky.Client/Pages/CrmReportViewPage.razor.cs +++ b/Wonky.Client/Pages/CrmReportViewPage.razor.cs @@ -13,9 +13,11 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using Wonky.Client.HttpInterfaces; using Wonky.Client.HttpRepository; +using Wonky.Client.Models; using Wonky.Entity.DTO; using Wonky.Entity.Views; @@ -24,10 +26,12 @@ namespace Wonky.Client.Pages; public partial class CrmReportViewPage { [Parameter] public string ReportDate { get; set; } - [Inject] public ICrmReportHttpRepository CrmReportRepo { get; set; } - [Inject] public NavigationManager _navigator { get; set; } - private ReportView _report { get; set; } = new(); - private List _items { get; set; } = new (); + [Inject] public ICrmReportHttpRepository ReportRepo { get; set; } + [Inject] public NavigationManager Navigator { get; set; } + [Inject] public ILocalStorageService Storage { get; set; } + private ReportView Report { get; set; } = new(); + private List Items { get; set; } = new (); + private bool Working { get; set; } = true; protected override async Task OnInitializedAsync() @@ -40,17 +44,27 @@ public partial class CrmReportViewPage Working = false; } + private async Task Print(PTarget target) + { + var ux = await Storage.GetItemAsync("_ux"); + if (target == PTarget.Order) + { + Navigator.NavigateTo($"/print/orders/{ux.CountryCode}/{ux.Id}/{ReportDate}"); + return; + } + Navigator.NavigateTo($"/print/report/{ux.CountryCode}/{ux.Id}/{ReportDate}"); + } private async Task GetReport(string workDate) { Working = true; - _report = new ReportView(); - _items = new List(); + Report = new ReportView(); + Items = new List(); if(workDate != ReportDate) - _navigator.NavigateTo($"/sales-reports/view/{workDate}"); - _report = await CrmReportRepo.GetReport(workDate); + Navigator.NavigateTo($"/sales-reports/view/{workDate}"); + Report = await ReportRepo.GetReport(workDate); - _items = _report.ReportItems.Where(x => x.Lines.Any()).ToList(); + Items = Report.ReportItems.Where(x => x.Lines.Any()).ToList(); Working = false; } } \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeReportListPage.razor b/Wonky.Client/Pages/OfficeReportListPage.razor index 7caa6c9d..e9fddd8c 100644 --- a/Wonky.Client/Pages/OfficeReportListPage.razor +++ b/Wonky.Client/Pages/OfficeReportListPage.razor @@ -29,7 +29,7 @@
- +
diff --git a/Wonky.Client/Pages/OfficeReportListPage.razor.cs b/Wonky.Client/Pages/OfficeReportListPage.razor.cs index 9106d49e..b859771d 100644 --- a/Wonky.Client/Pages/OfficeReportListPage.razor.cs +++ b/Wonky.Client/Pages/OfficeReportListPage.razor.cs @@ -26,22 +26,31 @@ public partial class OfficeReportListPage : IDisposable { [Parameter] public string UserId { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = ""; - [Inject] public IOfficeReportHttpRepository _reportRepo { get; set; } - [Inject] public HttpInterceptorService _interceptor { get; set; } - private List _reports { get; set; } + [Inject] public IOfficeReportHttpRepository ReportRepo { get; set; } + [Inject] public HttpInterceptorService Interceptor { get; set; } + private List ActivityReports { get; set; } = new(); private bool Working { get; set; } = true; + protected override async Task OnInitializedAsync() { - _interceptor.RegisterEvent(); - _interceptor.RegisterBeforeSendEvent(); + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); - _reports = await _reportRepo.GetReports(UserId); + await FetchReports(); Working = false; } + private async Task FetchReports() + { + var reports = await ReportRepo.GetReports(UserId); + if (reports.Any()) + ActivityReports = reports.OrderByDescending(x => x.ReportDate).ToList(); + } + + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { - _interceptor.DisposeEvent(); + Interceptor.DisposeEvent(); } } \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeReportViewPage.razor b/Wonky.Client/Pages/OfficeReportViewPage.razor index 588e745e..55494943 100644 --- a/Wonky.Client/Pages/OfficeReportViewPage.razor +++ b/Wonky.Client/Pages/OfficeReportViewPage.razor @@ -17,60 +17,66 @@ @using Wonky.Client.Components @using Microsoft.AspNetCore.Authorization +@using Wonky.Client.Models @page "/office/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}" @attribute [Authorize(Roles = "Admin")] -
-
- @*
*@ - @*

@DateTime.Parse(ReportDate).ToLongDateString()

*@ - @*
*@ -
- -
-
- -
- @* todo - option wo print only report - *@ +
+
+ +
+
+ +
+
+ +
+
+
- @if (!string.IsNullOrWhiteSpace(Report.ReportData.DayTypeEnum)) - { - @Report.ReportData.Name -
-
-

@Report.ReportData.Name

-
-
-
-
- -
-
- -
-
- - - } - else - { -
-
Ingen data
-
- }
-@* todo - add flag for printing only report *@ -@if (_items.Any()) +@if (ThisTarget is PTarget.Report or PTarget.All) { - @foreach (var item in _items.Where(item => item.StatusTypeEnum.ToLower() == "order" && item.ProcessStatusEnum.ToLower() == "none")) - { - - } +
+ @if (!string.IsNullOrWhiteSpace(Report.ReportData.DayTypeEnum)) + { + @Report.ReportData.Name +
+
+

@Report.ReportData.Name

+
+
+
+
+ +
+
+ +
+
+ + + } + else + { +
+
Ingen data
+
+ } +
} +@if (ThisTarget is PTarget.Order or PTarget.All) +{ + if (Activities.Any()) + { + foreach (var item in Activities.Where(item => item.StatusTypeEnum.ToLower() == "order" && item.ProcessStatusEnum.ToLower() == "none")) + { + + } + } +} @if (Working) { diff --git a/Wonky.Client/Pages/OfficeReportViewPage.razor.cs b/Wonky.Client/Pages/OfficeReportViewPage.razor.cs index 4cd69f6c..2e15f94b 100644 --- a/Wonky.Client/Pages/OfficeReportViewPage.razor.cs +++ b/Wonky.Client/Pages/OfficeReportViewPage.razor.cs @@ -13,11 +13,11 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // -using System.Text.Json; +using Blazored.LocalStorage; using Microsoft.AspNetCore.Components; using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpInterfaces; -using Wonky.Client.HttpRepository; +using Wonky.Client.Models; using Wonky.Entity.Views; namespace Wonky.Client.Pages; @@ -27,46 +27,71 @@ public partial class OfficeReportViewPage : IDisposable /// /// Country code from url parameter /// - [Parameter] public string CountryCode { get; set; } = ""; + [Parameter] + public string CountryCode { get; set; } = ""; + /// /// Report date from url parameter /// - [Parameter] public string ReportDate { get; set; } = ""; + [Parameter] + public string ReportDate { get; set; } = ""; + /// /// User entity Id from url parameter /// - [Parameter] public string UserId { get; set; } = ""; + [Parameter] + public string UserId { get; set; } = ""; + /// /// Injected interceptor service /// - [Inject] public HttpInterceptorService _interceptor { get; set; } + [Inject] + public HttpInterceptorService Interceptor { get; set; } + /// /// Injected administrative report http repo /// - [Inject] public IOfficeReportHttpRepository _reportRepo { get; set; } + [Inject] + public IOfficeReportHttpRepository ReportRepo { get; set; } + /// /// Navigation Manager /// - [Inject] public NavigationManager _navigator { get; set; } + [Inject] + public NavigationManager Navigator { get; set; } + + [Inject] public ILogger Logger { get; set; } + [Inject] public ILocalStorageService Storage { get; set; } /// /// Report to render /// private ReportView Report { get; set; } = new(); - private List _items { get; set; } = new(); - private string _workDate { get; set; } = ""; + private PTarget ThisTarget { get; set; } = PTarget.All; + private List Activities { get; set; } = new(); private bool Working { get; set; } = true; - + protected override async Task OnParametersSetAsync() { - _interceptor.RegisterEvent(); - _interceptor.RegisterBeforeSendEvent(); - + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); + await Task.Delay(100); await FetchReport(ReportDate); Working = false; } - + + private void Print(PTarget target) + { + if (target == PTarget.Order) + { + Navigator.NavigateTo($"/print/orders/{CountryCode}/{UserId}/{ReportDate}"); + return; + } + Navigator.NavigateTo($"/print/report/{CountryCode}/{UserId}/{ReportDate}"); + + } + /// /// Work date component event handler /// @@ -75,20 +100,20 @@ public partial class OfficeReportViewPage : IDisposable { if (workDate != ReportDate) { - _navigator.NavigateTo($"/office/users/advisors/{CountryCode}/{UserId}/reports/{workDate}"); + Navigator.NavigateTo($"/office/users/advisors/{CountryCode}/{UserId}/reports/{workDate}"); return; } Working = true; Report = new ReportView(); - _items = new List(); - - Report = await FetchUserReport(UserId, workDate); - //_items = Report.ReportItems.Where(x => x.OrderAmount > 0).ToList(); - _items = Report.ReportItems.Where(x => x.Lines.Any()).ToList(); - Working = false; + Activities = new List(); + Report = await FetchUserReport(UserId, workDate); + Activities = Report.ReportItems.Where(x => x.Lines.Any()).ToList(); + await Storage.SetItemAsync($"{UserId}-{ReportDate}", Report); + Working = false; } + /// /// Get report for user with entity Id for work date /// @@ -98,13 +123,13 @@ public partial class OfficeReportViewPage : IDisposable private async Task FetchUserReport(string userId, string workDate) { Working = true; - var x =Report = await _reportRepo.GetReport(userId, workDate); + var x = Report = await ReportRepo.GetReport(userId, workDate); Working = false; - return x; + return x; } public void Dispose() { - _interceptor.DisposeEvent(); + Interceptor.DisposeEvent(); } -} +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CatalogPrintPage.razor b/Wonky.Client/Pages/PrintCatalogPage.razor similarity index 97% rename from Wonky.Client/Pages/CatalogPrintPage.razor rename to Wonky.Client/Pages/PrintCatalogPage.razor index ea83190b..ccced787 100644 --- a/Wonky.Client/Pages/CatalogPrintPage.razor +++ b/Wonky.Client/Pages/PrintCatalogPage.razor @@ -15,7 +15,7 @@ // *@ -@page "/price-catalog/print" +@page "/print/catalog" @using Wonky.Client.Components @using Microsoft.AspNetCore.Authorization diff --git a/Wonky.Client/Pages/CatalogPrintPage.razor.cs b/Wonky.Client/Pages/PrintCatalogPage.razor.cs similarity index 97% rename from Wonky.Client/Pages/CatalogPrintPage.razor.cs rename to Wonky.Client/Pages/PrintCatalogPage.razor.cs index 3b6cad5d..a7246b2b 100644 --- a/Wonky.Client/Pages/CatalogPrintPage.razor.cs +++ b/Wonky.Client/Pages/PrintCatalogPage.razor.cs @@ -29,7 +29,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class CatalogPrintPage : IDisposable +public partial class PrintCatalogPage : IDisposable { [Inject] public ILocalStorageService Storage { get; set; } [Inject] public ICatalogHttpRepository ItemRepo { get; set; } diff --git a/Wonky.Client/Pages/PrintOrdersPage.razor b/Wonky.Client/Pages/PrintOrdersPage.razor new file mode 100644 index 00000000..2ea578f5 --- /dev/null +++ b/Wonky.Client/Pages/PrintOrdersPage.razor @@ -0,0 +1,32 @@ +@* +// 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.Components +@using Microsoft.AspNetCore.Authorization +@page "/print/orders/{CountryCode}/{UserId}/{ReportDate}" +@attribute [Authorize(Roles = "Admin,Advisor")] + +
+
+ +
+
+ +@foreach (var item in Items.Where(item => item.StatusTypeEnum.ToLower() == "order" && item.ProcessStatusEnum.ToLower() == "none")) +{ + +} diff --git a/Wonky.Client/Pages/PrintOrdersPage.razor.cs b/Wonky.Client/Pages/PrintOrdersPage.razor.cs new file mode 100644 index 00000000..d7e46dd1 --- /dev/null +++ b/Wonky.Client/Pages/PrintOrdersPage.razor.cs @@ -0,0 +1,64 @@ +// 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 Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using Wonky.Entity.Views; + +namespace Wonky.Client.Pages; + +public partial class PrintOrdersPage +{ + [Parameter] public string CountryCode { get; set; } = ""; + [Parameter] public string UserId { get; set; } = ""; + [Parameter] public string ReportDate { get; set; } = ""; + [Inject] public ILocalStorageService Storage { get; set; } + [Inject] public NavigationManager Navigator { get; set; } + [Inject] private IJSRuntime JSRuntime { get; set; } + [Inject] public ILogger Logger { get; set; } + private ReportView Report { get; set; } = new(); + private List Items { get; set; } = new(); + private IJSObjectReference JsModule { get; set; } + + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + JsModule = await JSRuntime + .InvokeAsync("import", "/scripts/print-invoke.js"); + } + } + + protected override async Task OnInitializedAsync() + { + Report = await Storage.GetItemAsync($"{UserId}-{ReportDate}"); + Items = Report.ReportItems; + } + + private async Task Print() + { + await JsModule.InvokeVoidAsync("printInvoke"); + + Navigator.NavigateTo($"/office/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}"); + } + + /* + * await Task.Delay(1000); + * JS.InvokeVoidAsync("invokePrint"); + * InvokeAsync(() => StateHasChanged()); + */ +} diff --git a/Wonky.Client/Pages/PrintReportPage.razor b/Wonky.Client/Pages/PrintReportPage.razor new file mode 100644 index 00000000..e50aca41 --- /dev/null +++ b/Wonky.Client/Pages/PrintReportPage.razor @@ -0,0 +1,46 @@ +@* +// 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.Components +@using Microsoft.AspNetCore.Authorization +@page "/print/report/{CountryCode}/{UserId}/{ReportDate}" +@attribute [Authorize(Roles = "Admin,Advisor")] + +
+
+ +
+
+ +
+ @Report.ReportData.Name +
+
+

@Report.ReportData.Name

+
+
+
+
+ +
+
+ +
+
+ + +
\ No newline at end of file diff --git a/Wonky.Client/Pages/PrintReportPage.razor.cs b/Wonky.Client/Pages/PrintReportPage.razor.cs new file mode 100644 index 00000000..6f504d86 --- /dev/null +++ b/Wonky.Client/Pages/PrintReportPage.razor.cs @@ -0,0 +1,63 @@ +// 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 Blazored.LocalStorage; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using Wonky.Entity.Views; + +namespace Wonky.Client.Pages; + +public partial class PrintReportPage +{ + [Parameter] public string CountryCode { get; set; } = ""; + [Parameter] public string UserId { get; set; } = ""; + [Parameter] public string ReportDate { get; set; } = ""; + [Inject] public ILocalStorageService Storage { get; set; } + [Inject] public NavigationManager Navigator { get; set; } + [Inject] private IJSRuntime JSRuntime { get; set; } + [Inject] public ILogger Logger { get; set; } + private ReportView Report { get; set; } = new(); + private IJSObjectReference JsModule { get; set; } + private bool Printed { get; set; } + + protected override async Task OnInitializedAsync() + { + Report = await Storage.GetItemAsync($"{UserId}-{ReportDate}"); + } + + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + JsModule = await JSRuntime + .InvokeAsync("import", "/scripts/print-invoke.js"); + } + } + + private async Task Print() + { + if(!Printed) + Printed = true; + await JsModule.InvokeVoidAsync("printInvoke"); + Navigator.NavigateTo($"/office/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}"); + } + + /* + * await Task.Delay(1000); + * JS.InvokeVoidAsync("invokePrint"); + * InvokeAsync(() => StateHasChanged()); + */ +} diff --git a/Wonky.Client/Shared/MainLayout.razor b/Wonky.Client/Shared/MainLayout.razor index bb572576..c64c9a6b 100644 --- a/Wonky.Client/Shared/MainLayout.razor +++ b/Wonky.Client/Shared/MainLayout.razor @@ -32,6 +32,6 @@
@Body
- +
diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 6aee5bcf..a0421445 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.86.1", + "version": "0.87.1", "rc": true, "sandBox": false, "image": "grumpy-coder.png" diff --git a/Wonky.Client/wwwroot/css/app-v0.38.css b/Wonky.Client/wwwroot/css/app.css similarity index 73% rename from Wonky.Client/wwwroot/css/app-v0.38.css rename to Wonky.Client/wwwroot/css/app.css index d04a5d2e..2cb2a5d5 100644 --- a/Wonky.Client/wwwroot/css/app-v0.38.css +++ b/Wonky.Client/wwwroot/css/app.css @@ -152,55 +152,3 @@ footer.version { right: 25px; display: none; } - -/* printer classes */ -@media print { - @page { - size: a4; - } - @font-face { - font-family: 'Montserrat'; - src: url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); - } - html, body { - height: 290mm; - width: 210mm; - -webkit-print-color-adjust: exact; - color-adjust: exact; - } - .report-main { - font-size: 10px; - break-before: page; - break-after: page; - page-break-after: always; - height: initial; - border: initial; - border-radius: initial; - box-shadow: initial; - margin: 0; - width: initial; - -webkit-print-color-adjust: exact; - color-adjust: exact; - } - .report-visit { - page-break-before: always; - break-after: page; - break-before: page; - break-inside: avoid-page; - height: initial; - border: initial; - border-radius: initial; - box-shadow: initial; - margin: 0; - width: initial; - -webkit-print-color-adjust: exact; - color-adjust: exact; - } - .distance-ledger {} - .report-ledger { - page-break-inside: avoid; - page-break-after: always; - break-after: recto; - min-height: 300px; - } -} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/css/print.css b/Wonky.Client/wwwroot/css/print.css new file mode 100644 index 00000000..775f3c3e --- /dev/null +++ b/Wonky.Client/wwwroot/css/print.css @@ -0,0 +1,53 @@ +/* printer classes */ +@media print { + @page { + size: a4; + } + @font-face { + font-family: 'Montserrat'; + src: url('https://fonts.googleapis.com/css2?family=Montserrat&display=swap'); + } + html, body { + height: 290mm; + width: 210mm; + -webkit-print-color-adjust: exact; + color-adjust: exact; + } + .report-main { + font-size: 10px; + break-before: page; + break-after: page; + page-break-after: always; + height: initial; + border: initial; + border-radius: initial; + box-shadow: initial; + margin: 0; + width: initial; + -webkit-print-color-adjust: exact; + color-adjust: exact; + } + .report-visit { + page-break-before: always; + page-break-after: always; + break-after: page; + break-before: page; + break-inside: avoid-page; + height: initial; + border: initial; + border-radius: initial; + box-shadow: initial; + min-height: 250mm; + margin: 0; + width: initial; + -webkit-print-color-adjust: exact; + color-adjust: exact; + } + .distance-ledger {} + .report-ledger { + page-break-inside: avoid; + page-break-after: always; + break-after: recto; + min-height: 300px; + } +} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/index.html b/Wonky.Client/wwwroot/index.html index db9415af..9374b8fd 100644 --- a/Wonky.Client/wwwroot/index.html +++ b/Wonky.Client/wwwroot/index.html @@ -14,12 +14,13 @@ - - - - - - + + + + + + +
@@ -29,7 +30,7 @@
- - + + diff --git a/Wonky.Client/wwwroot/scripts/bsTooltip.js b/Wonky.Client/wwwroot/scripts/bsTooltip.js deleted file mode 100644 index 9bb45d48..00000000 --- a/Wonky.Client/wwwroot/scripts/bsTooltip.js +++ /dev/null @@ -1,4 +0,0 @@ -var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) -var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { - return new bootstrap.Tooltip(tooltipTriggerEl) -}) diff --git a/Wonky.Client/wwwroot/scripts/print-invoke.js b/Wonky.Client/wwwroot/scripts/print-invoke.js new file mode 100644 index 00000000..7623b1e3 --- /dev/null +++ b/Wonky.Client/wwwroot/scripts/print-invoke.js @@ -0,0 +1,7 @@ +export function printInvoke() { + window.print(); +} + +document.addEventListener("load", function() { + window.print(); +}); diff --git a/Wonky.Client/wwwroot/scripts/scripts.js b/Wonky.Client/wwwroot/scripts/scripts.js deleted file mode 100644 index 9444efad..00000000 --- a/Wonky.Client/wwwroot/scripts/scripts.js +++ /dev/null @@ -1,16 +0,0 @@ -(document).ready(function(){ - $(window).scroll(function () { - if ($(this).scrollTop() > 50) { - $('#back-to-top').fadeIn(); - } else { - $('#back-to-top').fadeOut(); - } - }); - // scroll body to 0px on click - $('#back-to-top').click(function () { - $('body,html').animate({ - scrollTop: 0 - }, 400); - return false; - }); -}); \ No newline at end of file diff --git a/Wonky.Entity/Views/NgSalesReportListView.cs b/Wonky.Entity/Views/SalesReportListView.cs similarity index 97% rename from Wonky.Entity/Views/NgSalesReportListView.cs rename to Wonky.Entity/Views/SalesReportListView.cs index 4cf5fbd2..f7c360c9 100644 --- a/Wonky.Entity/Views/NgSalesReportListView.cs +++ b/Wonky.Entity/Views/SalesReportListView.cs @@ -15,7 +15,7 @@ namespace Wonky.Entity.Views; -public class NgSalesReportListView +public class SalesReportListView { public string ReportId { get; set; } = ""; public string UserId { get; set; } = "";