From 532cd08827800d7782a89fb27f3f2b86c57cbe9d Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Sun, 21 May 2023 08:23:47 +0200 Subject: [PATCH] WIP --- .../Pages/OfficeUserAdvisorViewEditPage.razor | 149 ------------------ .../OfficeUserAdvisorViewEditPage.razor.cs | 116 -------------- Wonky.Client/Wonky.Client.csproj | 1 - Wonky.Client/wwwroot/appsettings.json | 2 +- .../wwwroot/scripts/document-event-load.js | 3 - Wonky.Entity/DTO/ActivityDto.cs | 1 + Wonky.Entity/DTO/CompanyDto.cs | 2 + Wonky.Entity/DTO/EmailMessage.cs | 2 + Wonky.Entity/DTO/ReportInitDto.cs | 1 + Wonky.Entity/DTO/UserManagerCreateView.cs | 1 + Wonky.Entity/DTO/UserManagerEditView.cs | 1 + Wonky.Entity/DTO/WorkplaceBopCreate.cs | 2 + Wonky.Entity/Models/VirkRegInfo.cs | 2 + Wonky.Entity/Views/ClxMessage.cs | 1 + Wonky.Entity/Views/ExternalProductListView.cs | 2 + Wonky.Entity/Views/InvoiceListView.cs | 2 + Wonky.Entity/Views/InvoiceView.cs | 2 + Wonky.Entity/Views/ReportActivityInfoView.cs | 2 + Wonky.Entity/Views/ReportItemView.cs | 2 + Wonky.Entity/Views/ReportStatusView.cs | 2 + Wonky.Entity/Views/ReportView.cs | 2 + Wonky.Entity/Views/SalesItemView.cs | 2 + Wonky.Entity/Views/WarehouseOrderView.cs | 2 + Wonky.Entity/Views/WorkplaceInventory.cs | 1 + Wonky.Entity/Views/WorkplaceProduct.cs | 2 + Wonky.Entity/Views/WorkplaceProductVariant.cs | 2 + global.json | 4 +- 27 files changed, 39 insertions(+), 272 deletions(-) delete mode 100644 Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor delete mode 100644 Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor.cs delete mode 100644 Wonky.Client/wwwroot/scripts/document-event-load.js diff --git a/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor b/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor deleted file mode 100644 index b184b609..00000000 --- a/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor +++ /dev/null @@ -1,149 +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 Wonky.Client.Components -@attribute [Authorize(Roles = "Admin")] -@page "/office/users/advisors/{CountryCode}/{UserId}/view" - -
-
-
- Sælger Vedligeholdelse -
-
-
- @if (!string.IsNullOrWhiteSpace(UserInfo.UserId)) - { - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
- Fornavn - - - - - Efternavn - - - -
- Email - - - - - Mobilnummer - - - -
- Sælgernr. - - - - - Landekode - - - -
- Spærret - - - -
-
-
-
-
- -
-
- -
-
- Tilbage -
-
- Salg -
-
-
- - -

NULSTIL ADGANGSKODE

-
-

Password politik

-

Mindst 10 tegn bestående af store og små bogstaver samt tal.

-

Du kan teste pasword og danne stærke password på pw.nix.dk

-
-
- -
- - -
-
-
- -
- - -
-
-
-
- -
-
-
- } -
-
- - -@if (Working) -{ - -} diff --git a/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor.cs b/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor.cs deleted file mode 100644 index 04460874..00000000 --- a/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor.cs +++ /dev/null @@ -1,116 +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 System.Text.Json; -using Blazored.Toast.Services; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Forms; -using Wonky.Client.Helpers; -using Wonky.Client.HttpInterceptors; -using Wonky.Client.HttpRepository; -using Wonky.Entity.DTO; -using Wonky.Entity.Views; -#pragma warning disable CS8618 - -namespace Wonky.Client.Pages; - -public partial class OfficeUserAdvisorViewEditPage : IDisposable -{ - [Parameter] public string UserId { get; set; } = ""; - [Parameter] public string CountryCode { get; set; } = ""; - [Inject] public HttpInterceptorService Interceptor { get; set; } - [Inject] public ISystemUserRepository UserRepo { get; set; } - [Inject] public ILogger Logger { get; set; } - [Inject] public IToastService Toaster { get; set; } - private UserAdminEditView UserInfo { get; set; } = new(); - private EditContext UserEditContext { get; set; } - private ResetPasswordModel Passwords { get; set; } = new(); - private EditContext PasswdContext { get; set; } - private bool PwInvalid { get; set; } = true; - private bool Working { get; set; } = true; - private bool ReadOnly { get; set; } = true; - private const int MinPwLength = 10; - - private readonly JsonSerializerOptions _options = new JsonSerializerOptions - { - PropertyNameCaseInsensitive = true - }; - - protected override async Task OnParametersSetAsync() - { - Interceptor.RegisterEvent(); - Interceptor.RegisterBeforeSendEvent(); - UserInfo = await UserRepo.GetUserInfo(UserId); - - UserEditContext = new EditContext(UserInfo); - PasswdContext = new EditContext(Passwords); - - PasswdContext.OnFieldChanged += PwHandleFieldChanged; - PasswdContext.OnValidationStateChanged += PwValidationChanged; - Working = false; - } - - private async Task UpdateAdvisor() - { - ReadOnly = true; - Working = true; - Toaster.ShowInfo("Sender data til server ..."); - await UserRepo.UpdateUserInfo(UserId, UserInfo); - Working = false; - Toaster.ShowInfo("Sælger er opdateret ..."); - // _navigator.NavigateTo($"/office/users/advisors/{CountryCode}/{UserId}"); - } - - private void PwHandleFieldChanged(object sender, FieldChangedEventArgs e) - { - PwInvalid = !PasswdContext.Validate(); - StateHasChanged(); - } - private void PwValidationChanged(object sender, ValidationStateChangedEventArgs e) - { - PwInvalid = true; - if (!Utils.IsValidPasswd(Passwords.NewPassword, MinPwLength)) - return; - - PasswdContext.OnFieldChanged -= PwHandleFieldChanged; - PasswdContext.OnValidationStateChanged -= PwValidationChanged; - - PasswdContext = new EditContext(Passwords); - - PasswdContext.OnFieldChanged += PwHandleFieldChanged; - PasswdContext.OnValidationStateChanged += PwValidationChanged; - } - - private async Task SetPassword() - { - if (Working) - return; - Working = true; - Toaster.ShowInfo("Nulstiller adgangskode."); - await UserRepo.ResetUserPassword(UserId, Passwords.NewPassword, Passwords.ConfirmPassword); - Passwords.NewPassword = ""; - Passwords.ConfirmPassword = ""; - Working = false; - Toaster.ShowInfo("Adgangskode er nulstillet."); - // _navigator.NavigateTo($"/office/users/advisors/{CountryCode}/{UserId}"); - } - public void Dispose() - { - Interceptor.DisposeEvent(); - PasswdContext.OnFieldChanged -= PwHandleFieldChanged; - PasswdContext.OnValidationStateChanged -= PwValidationChanged; - } -} \ No newline at end of file diff --git a/Wonky.Client/Wonky.Client.csproj b/Wonky.Client/Wonky.Client.csproj index e7611c4c..460ce19f 100644 --- a/Wonky.Client/Wonky.Client.csproj +++ b/Wonky.Client/Wonky.Client.csproj @@ -34,7 +34,6 @@ - diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index d3cbc116..11776ad2 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "142.5", + "version": "145.1", "rc": true, "sandBox": true, "image": "grumpy-coder.png" diff --git a/Wonky.Client/wwwroot/scripts/document-event-load.js b/Wonky.Client/wwwroot/scripts/document-event-load.js deleted file mode 100644 index ab266c8b..00000000 --- a/Wonky.Client/wwwroot/scripts/document-event-load.js +++ /dev/null @@ -1,3 +0,0 @@ -document.addEventListener("load", function() { - window.print(); -}); diff --git a/Wonky.Entity/DTO/ActivityDto.cs b/Wonky.Entity/DTO/ActivityDto.cs index f8a18ec6..6c28ec78 100644 --- a/Wonky.Entity/DTO/ActivityDto.cs +++ b/Wonky.Entity/DTO/ActivityDto.cs @@ -14,6 +14,7 @@ // +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Wonky.Entity.DTO; diff --git a/Wonky.Entity/DTO/CompanyDto.cs b/Wonky.Entity/DTO/CompanyDto.cs index bf3b9271..01a39de8 100644 --- a/Wonky.Entity/DTO/CompanyDto.cs +++ b/Wonky.Entity/DTO/CompanyDto.cs @@ -13,6 +13,8 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Wonky.Entity.DTO; diff --git a/Wonky.Entity/DTO/EmailMessage.cs b/Wonky.Entity/DTO/EmailMessage.cs index 7ee965c7..49bc511e 100644 --- a/Wonky.Entity/DTO/EmailMessage.cs +++ b/Wonky.Entity/DTO/EmailMessage.cs @@ -14,6 +14,8 @@ // +using System.Collections.Generic; + namespace Wonky.Entity.DTO; public class EmailMessage diff --git a/Wonky.Entity/DTO/ReportInitDto.cs b/Wonky.Entity/DTO/ReportInitDto.cs index 26e8933d..59b5f00a 100644 --- a/Wonky.Entity/DTO/ReportInitDto.cs +++ b/Wonky.Entity/DTO/ReportInitDto.cs @@ -14,6 +14,7 @@ // +using System.Collections.Generic; using Wonky.Entity.Views; namespace Wonky.Entity.DTO; diff --git a/Wonky.Entity/DTO/UserManagerCreateView.cs b/Wonky.Entity/DTO/UserManagerCreateView.cs index 84a555dc..2717ccf2 100644 --- a/Wonky.Entity/DTO/UserManagerCreateView.cs +++ b/Wonky.Entity/DTO/UserManagerCreateView.cs @@ -14,6 +14,7 @@ // +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Wonky.Entity.DTO; diff --git a/Wonky.Entity/DTO/UserManagerEditView.cs b/Wonky.Entity/DTO/UserManagerEditView.cs index 0f6f9828..bc298590 100644 --- a/Wonky.Entity/DTO/UserManagerEditView.cs +++ b/Wonky.Entity/DTO/UserManagerEditView.cs @@ -13,6 +13,7 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Wonky.Entity.DTO; diff --git a/Wonky.Entity/DTO/WorkplaceBopCreate.cs b/Wonky.Entity/DTO/WorkplaceBopCreate.cs index 18d747a0..cfdcd98a 100644 --- a/Wonky.Entity/DTO/WorkplaceBopCreate.cs +++ b/Wonky.Entity/DTO/WorkplaceBopCreate.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Wonky.Entity.DTO; public class WorkplaceBopCreate diff --git a/Wonky.Entity/Models/VirkRegInfo.cs b/Wonky.Entity/Models/VirkRegInfo.cs index ea973ebb..7a6ba26a 100644 --- a/Wonky.Entity/Models/VirkRegInfo.cs +++ b/Wonky.Entity/Models/VirkRegInfo.cs @@ -13,6 +13,8 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Collections.Generic; + namespace Wonky.Entity.Models; public class VirkRegInfo diff --git a/Wonky.Entity/Views/ClxMessage.cs b/Wonky.Entity/Views/ClxMessage.cs index a093334c..ca738b54 100644 --- a/Wonky.Entity/Views/ClxMessage.cs +++ b/Wonky.Entity/Views/ClxMessage.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Text.Json.Serialization; namespace Wonky.Entity.Views; diff --git a/Wonky.Entity/Views/ExternalProductListView.cs b/Wonky.Entity/Views/ExternalProductListView.cs index 323d9336..f8d8e5a2 100644 --- a/Wonky.Entity/Views/ExternalProductListView.cs +++ b/Wonky.Entity/Views/ExternalProductListView.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class ExternalProductListView diff --git a/Wonky.Entity/Views/InvoiceListView.cs b/Wonky.Entity/Views/InvoiceListView.cs index deb540d2..021861a3 100644 --- a/Wonky.Entity/Views/InvoiceListView.cs +++ b/Wonky.Entity/Views/InvoiceListView.cs @@ -14,6 +14,8 @@ // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class InvoiceListView diff --git a/Wonky.Entity/Views/InvoiceView.cs b/Wonky.Entity/Views/InvoiceView.cs index a5f9982b..7ffeb02a 100644 --- a/Wonky.Entity/Views/InvoiceView.cs +++ b/Wonky.Entity/Views/InvoiceView.cs @@ -14,6 +14,8 @@ // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class InvoiceView diff --git a/Wonky.Entity/Views/ReportActivityInfoView.cs b/Wonky.Entity/Views/ReportActivityInfoView.cs index 3a27e7cc..a22c030d 100644 --- a/Wonky.Entity/Views/ReportActivityInfoView.cs +++ b/Wonky.Entity/Views/ReportActivityInfoView.cs @@ -14,6 +14,8 @@ // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class ReportActivityInfoView diff --git a/Wonky.Entity/Views/ReportItemView.cs b/Wonky.Entity/Views/ReportItemView.cs index 6d7853a9..872cde8b 100644 --- a/Wonky.Entity/Views/ReportItemView.cs +++ b/Wonky.Entity/Views/ReportItemView.cs @@ -13,6 +13,8 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class ReportItemView diff --git a/Wonky.Entity/Views/ReportStatusView.cs b/Wonky.Entity/Views/ReportStatusView.cs index bd8792f0..3c8239b5 100644 --- a/Wonky.Entity/Views/ReportStatusView.cs +++ b/Wonky.Entity/Views/ReportStatusView.cs @@ -13,6 +13,8 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class ReportStatusView diff --git a/Wonky.Entity/Views/ReportView.cs b/Wonky.Entity/Views/ReportView.cs index 8589eaaa..18da5dec 100644 --- a/Wonky.Entity/Views/ReportView.cs +++ b/Wonky.Entity/Views/ReportView.cs @@ -13,6 +13,8 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class ReportView diff --git a/Wonky.Entity/Views/SalesItemView.cs b/Wonky.Entity/Views/SalesItemView.cs index 0132efb3..aed9771a 100644 --- a/Wonky.Entity/Views/SalesItemView.cs +++ b/Wonky.Entity/Views/SalesItemView.cs @@ -13,6 +13,8 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class SalesItemView diff --git a/Wonky.Entity/Views/WarehouseOrderView.cs b/Wonky.Entity/Views/WarehouseOrderView.cs index 0ed14d11..71c05007 100644 --- a/Wonky.Entity/Views/WarehouseOrderView.cs +++ b/Wonky.Entity/Views/WarehouseOrderView.cs @@ -14,6 +14,8 @@ // +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class WarehouseOrderView diff --git a/Wonky.Entity/Views/WorkplaceInventory.cs b/Wonky.Entity/Views/WorkplaceInventory.cs index 0571f1dc..9c905476 100644 --- a/Wonky.Entity/Views/WorkplaceInventory.cs +++ b/Wonky.Entity/Views/WorkplaceInventory.cs @@ -1,3 +1,4 @@ +using System.Collections.Generic; using System.Diagnostics.Contracts; namespace Wonky.Entity.Views; diff --git a/Wonky.Entity/Views/WorkplaceProduct.cs b/Wonky.Entity/Views/WorkplaceProduct.cs index 2a4773d1..ce3e941d 100644 --- a/Wonky.Entity/Views/WorkplaceProduct.cs +++ b/Wonky.Entity/Views/WorkplaceProduct.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class WorkplaceProduct diff --git a/Wonky.Entity/Views/WorkplaceProductVariant.cs b/Wonky.Entity/Views/WorkplaceProductVariant.cs index 6f24faa0..babe936c 100644 --- a/Wonky.Entity/Views/WorkplaceProductVariant.cs +++ b/Wonky.Entity/Views/WorkplaceProductVariant.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Wonky.Entity.Views; public class WorkplaceProductVariant diff --git a/global.json b/global.json index dad2db5e..87aef9f1 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "8.0.0", + "version": "6.0.0", "rollForward": "latestMajor", - "allowPrerelease": true + "allowPrerelease": false } } \ No newline at end of file