From 8480b30607c45c58a6448a9018d4b7f31942efeb Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Wed, 17 May 2023 13:59:39 +0200 Subject: [PATCH] WIP: overlay for selecting products for documentation --- ...t.razor => ActivityKmStartComponent.razor} | 0 ...r.cs => ActivityKmStartComponent.razor.cs} | 6 +-- .../Local.Services/UserPreferenceService.cs | 27 +++++----- .../CustomerInventoryReorderOverlay.razor.cs | 10 +++- .../ProductSelectionOverlay.razor | 33 ++++++++++++ .../ProductSelectionOverlay.razor.cs | 53 +++++++++++++++++++ .../Pages/AdvisorActivityTodayListPage.razor | 2 +- .../Pages/AdvisorReportCreatePage.razor | 2 +- .../CrmCustomerWorkplaceDocumentAddPage.razor | 2 +- Wonky.Client/wwwroot/appsettings.json | 2 +- Wonky.Entity/DTO/KrvDocHeaderUpdateDto.cs | 12 +++++ Wonky.Entity/Views/ExternalProductListView.cs | 3 +- global.json | 4 +- 13 files changed, 131 insertions(+), 25 deletions(-) rename Wonky.Client/Components/{ReportActivityKmStartComponent.razor => ActivityKmStartComponent.razor} (100%) rename Wonky.Client/Components/{ReportActivityKmStartComponent.razor.cs => ActivityKmStartComponent.razor.cs} (86%) create mode 100644 Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor create mode 100644 Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor.cs create mode 100644 Wonky.Entity/DTO/KrvDocHeaderUpdateDto.cs diff --git a/Wonky.Client/Components/ReportActivityKmStartComponent.razor b/Wonky.Client/Components/ActivityKmStartComponent.razor similarity index 100% rename from Wonky.Client/Components/ReportActivityKmStartComponent.razor rename to Wonky.Client/Components/ActivityKmStartComponent.razor diff --git a/Wonky.Client/Components/ReportActivityKmStartComponent.razor.cs b/Wonky.Client/Components/ActivityKmStartComponent.razor.cs similarity index 86% rename from Wonky.Client/Components/ReportActivityKmStartComponent.razor.cs rename to Wonky.Client/Components/ActivityKmStartComponent.razor.cs index 50d9f109..9904ae41 100644 --- a/Wonky.Client/Components/ReportActivityKmStartComponent.razor.cs +++ b/Wonky.Client/Components/ActivityKmStartComponent.razor.cs @@ -20,20 +20,18 @@ using Wonky.Client.Local.Services; namespace Wonky.Client.Components; -public partial class ReportActivityKmStartComponent +public partial class ActivityKmStartComponent { // ######################################################################3 [Inject] public UserPreferenceService PreferenceService { get; set; } // ######################################################################3 private int KmMorning { get; set; } - private UserPreference Preferences { get; set; } = new(); protected override async Task OnInitializedAsync() { - Preferences = await PreferenceService.GetProfile(); - KmMorning = Preferences.KmMorning; + KmMorning = await PreferenceService.GetKmMorning(); } diff --git a/Wonky.Client/Local.Services/UserPreferenceService.cs b/Wonky.Client/Local.Services/UserPreferenceService.cs index 187f129c..5165d19a 100644 --- a/Wonky.Client/Local.Services/UserPreferenceService.cs +++ b/Wonky.Client/Local.Services/UserPreferenceService.cs @@ -35,6 +35,7 @@ public class UserPreferenceService { private readonly ILocalStorageService _localStorageService; private const string KeyName = "preferences"; + private const string KeyKm = "kmstart"; public event Action? OnChange; public UserPreferenceService(ILocalStorageService localStorageService) @@ -42,6 +43,19 @@ public class UserPreferenceService _localStorageService = localStorageService; } + + public async Task SetKmMorning(int kmMorning) + { + await _localStorageService.SetItemAsync(KeyName, kmMorning); + } + + + public async Task GetKmMorning() + { + return await _localStorageService.GetItemAsync(KeyName); + } + + public async Task SetDateConfirmed(bool confirmed) { var preferences = await GetProfile(); @@ -54,18 +68,7 @@ public class UserPreferenceService OnChange?.Invoke(newPreferences); } - public async Task SetKmMorning(int kmMorning) - { - var preferences = await GetProfile(); - var newPreferences = preferences - with - { - KmMorning = kmMorning - }; - await _localStorageService.SetItemAsync(KeyName, newPreferences); - OnChange?.Invoke(newPreferences); - } - + public async Task SetCompanyFilterPhrase(string filterPhrase) { var preferences = await GetProfile(); diff --git a/Wonky.Client/OverlayCustomer/CustomerInventoryReorderOverlay.razor.cs b/Wonky.Client/OverlayCustomer/CustomerInventoryReorderOverlay.razor.cs index 0e51b0cf..2bf29d5d 100644 --- a/Wonky.Client/OverlayCustomer/CustomerInventoryReorderOverlay.razor.cs +++ b/Wonky.Client/OverlayCustomer/CustomerInventoryReorderOverlay.razor.cs @@ -25,10 +25,15 @@ namespace Wonky.Client.OverlayCustomer; public partial class CustomerInventoryReorderOverlay { + // ############################################################## + [Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; } + + // ############################################################## + [Parameter] public EventCallback OnSelected { get; set; } [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public SalesItemView SalesItem { get; set; } = new(); - [Inject] public ICrmCustomerHistoryRepository HistoryRepo { get; set; } - [Parameter] public EventCallback OnSelected { get; set; } + + // ############################################################## private List? History { get; set; } = new(); private DraftItem SelectedItem { get; set; } = new(); private string ProductName { get; set; } = ""; @@ -36,6 +41,7 @@ public partial class CustomerInventoryReorderOverlay private bool _showBackdrop; private bool ShowDraft { get; set; } + protected override async Task OnParametersSetAsync() { if (string.IsNullOrWhiteSpace(SalesItem.Sku)) diff --git a/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor b/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor new file mode 100644 index 00000000..81ebe666 --- /dev/null +++ b/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor @@ -0,0 +1,33 @@ +@* 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 (ReportExist) diff --git a/Wonky.Client/Pages/AdvisorReportCreatePage.razor b/Wonky.Client/Pages/AdvisorReportCreatePage.razor index 7652d02f..59b1fec7 100644 --- a/Wonky.Client/Pages/AdvisorReportCreatePage.razor +++ b/Wonky.Client/Pages/AdvisorReportCreatePage.razor @@ -27,7 +27,7 @@
- +
diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor b/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor index cf0cf948..b07b39e1 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor @@ -16,7 +16,7 @@ @using Microsoft.AspNetCore.Authorization @using Wonky.Client.Components @attribute [Authorize(Roles = "Advisor")] -@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/newdoc" +@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/doc" @Workplace.CompanyName - @Workplace.Name
diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index e4778e0a..23d99769 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "142.4", + "version": "142.5", "rc": true, "sandBox": true, "image": "grumpy-coder.png" diff --git a/Wonky.Entity/DTO/KrvDocHeaderUpdateDto.cs b/Wonky.Entity/DTO/KrvDocHeaderUpdateDto.cs new file mode 100644 index 00000000..27783c34 --- /dev/null +++ b/Wonky.Entity/DTO/KrvDocHeaderUpdateDto.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace Wonky.Entity.DTO; + +public class KrvDocHeaderUpdateDto +{ + [MaxLength(128)] public string ApprovedBy { get; set; } = ""; + [MaxLength(10)] public string ApprovedDate { get; set; } = ""; + [MaxLength(128)] public string AuthoredBy { get; set; } = ""; + [MaxLength(128)] public string DocumentId { get; set; } = ""; + [MaxLength(10)] public string FollowupDate { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/Views/ExternalProductListView.cs b/Wonky.Entity/Views/ExternalProductListView.cs index 62c528cb..323d9336 100644 --- a/Wonky.Entity/Views/ExternalProductListView.cs +++ b/Wonky.Entity/Views/ExternalProductListView.cs @@ -17,5 +17,6 @@ public class ExternalProductVariantView public string ErpName { get; set; } = ""; public string ErpSku { get; set; } = ""; public string ShortName { get; set; } = ""; - public string PictureLink { get; set; } = ""; + public string PictureLink { get; set; } = ""; + public bool Selected { get; set; } } \ No newline at end of file diff --git a/global.json b/global.json index 87aef9f1..dad2db5e 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "6.0.0", + "version": "8.0.0", "rollForward": "latestMajor", - "allowPrerelease": false + "allowPrerelease": true } } \ No newline at end of file