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