diff --git a/Wonky.Client/Components/OfficeCountryAdvisorListComponent.razor b/Wonky.Client/Components/OfficeCountryAdvisorListComponent.razor index e69cceda..eb90f023 100644 --- a/Wonky.Client/Components/OfficeCountryAdvisorListComponent.razor +++ b/Wonky.Client/Components/OfficeCountryAdvisorListComponent.razor @@ -22,7 +22,7 @@ {
-
@user.SalesRep
+
@user.CountryCode @user.SalesRep
@user.FullName
@user.PhoneNumber
@@ -31,13 +31,6 @@ -
- - - Rediger - - -
} diff --git a/Wonky.Client/Pages/PreferencesPage.razor b/Wonky.Client/Pages/CommonPreferencesPage.razor similarity index 100% rename from Wonky.Client/Pages/PreferencesPage.razor rename to Wonky.Client/Pages/CommonPreferencesPage.razor diff --git a/Wonky.Client/Pages/ReportPrintOrderPage.razor b/Wonky.Client/Pages/CommonReportPrintOrderPage.razor similarity index 100% rename from Wonky.Client/Pages/ReportPrintOrderPage.razor rename to Wonky.Client/Pages/CommonReportPrintOrderPage.razor diff --git a/Wonky.Client/Pages/ReportPrintOrderPage.razor.cs b/Wonky.Client/Pages/CommonReportPrintOrderPage.razor.cs similarity index 96% rename from Wonky.Client/Pages/ReportPrintOrderPage.razor.cs rename to Wonky.Client/Pages/CommonReportPrintOrderPage.razor.cs index 08b2edcc..4bf9bf87 100644 --- a/Wonky.Client/Pages/ReportPrintOrderPage.razor.cs +++ b/Wonky.Client/Pages/CommonReportPrintOrderPage.razor.cs @@ -27,7 +27,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class ReportPrintOrderPage +public partial class CommonReportPrintOrderPage { [Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string UserId { get; set; } = ""; @@ -36,7 +36,7 @@ public partial class ReportPrintOrderPage [Inject] public NavigationManager Navigator { get; set; } [Inject] public IOrderProcessRepository ProcessRepo { get; set; } [Inject] public IJSRuntime JsRuntime { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public IToastService Toaster { get; set; } private ReportView Report { get; set; } = new(); private List Items { get; set; } = new(); diff --git a/Wonky.Client/Pages/ReportPrintSummaryPage.razor b/Wonky.Client/Pages/CommonReportPrintSummaryPage.razor similarity index 100% rename from Wonky.Client/Pages/ReportPrintSummaryPage.razor rename to Wonky.Client/Pages/CommonReportPrintSummaryPage.razor diff --git a/Wonky.Client/Pages/ReportPrintSummaryPage.razor.cs b/Wonky.Client/Pages/CommonReportPrintSummaryPage.razor.cs similarity index 94% rename from Wonky.Client/Pages/ReportPrintSummaryPage.razor.cs rename to Wonky.Client/Pages/CommonReportPrintSummaryPage.razor.cs index 78ac4046..7aceebc9 100644 --- a/Wonky.Client/Pages/ReportPrintSummaryPage.razor.cs +++ b/Wonky.Client/Pages/CommonReportPrintSummaryPage.razor.cs @@ -23,7 +23,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Pages; -public partial class ReportPrintSummaryPage +public partial class CommonReportPrintSummaryPage { [Parameter] public string CountryCode { get; set; } = ""; [Parameter] public string UserId { get; set; } = ""; @@ -31,7 +31,7 @@ public partial class ReportPrintSummaryPage [Inject] public ILocalStorageService Storage { get; set; } [Inject] public NavigationManager Navigator { get; set; } [Inject] public IJSRuntime JsRuntime { get; set; } - [Inject] public ILogger Logger { get; set; } + [Inject] public ILogger Logger { get; set; } private ReportView Report { get; set; } = new(); private IJSObjectReference JsModule { get; set; } private string ReturnUrl { get; set; } = ""; diff --git a/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor b/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor new file mode 100644 index 00000000..ed1180d3 --- /dev/null +++ b/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor @@ -0,0 +1,148 @@ +@* +// 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" + +
+
+

Bruger info

+
+
+ @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 new file mode 100644 index 00000000..5a26cadb --- /dev/null +++ b/Wonky.Client/Pages/OfficeUserAdvisorViewEditPage.razor.cs @@ -0,0 +1,116 @@ + +// 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 UserManagerEditView UserInfo { get; set; } = new(); + private EditContext UserEditContext { get; set; } + private ResetPasswordDto 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/Pages/SystemKrvProductsAdminPage.razor b/Wonky.Client/Pages/SystemKrvProductsAdminPage.razor new file mode 100644 index 00000000..0f3004f7 --- /dev/null +++ b/Wonky.Client/Pages/SystemKrvProductsAdminPage.razor @@ -0,0 +1,6 @@ +@page "/system/krv/products" +

SystemKrvProductsAdminPage

+ +@code { + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/SystemKrvProtectionsAdminPage.razor b/Wonky.Client/Pages/SystemKrvProtectionsAdminPage.razor new file mode 100644 index 00000000..43322d64 --- /dev/null +++ b/Wonky.Client/Pages/SystemKrvProtectionsAdminPage.razor @@ -0,0 +1,6 @@ +@page "/system/krv/protections" +

SystemKrvProtectionsAdminPage

+ +@code { + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/SystemKrvTextsAdminPage.razor b/Wonky.Client/Pages/SystemKrvTextsAdminPage.razor new file mode 100644 index 00000000..6791d14e --- /dev/null +++ b/Wonky.Client/Pages/SystemKrvTextsAdminPage.razor @@ -0,0 +1,6 @@ +@page "/system/krv/texts" +

SystemKrvTextsAdminPage

+ +@code { + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/SystemManagerLandingPage.razor b/Wonky.Client/Pages/SystemManagerLandingPage.razor new file mode 100644 index 00000000..69babeed --- /dev/null +++ b/Wonky.Client/Pages/SystemManagerLandingPage.razor @@ -0,0 +1,29 @@ +@* +// 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 +@attribute [Authorize(Roles = "Admin")] +@page "/system" +System Mmanager + + \ No newline at end of file diff --git a/Wonky.Client/Components/OfficeCountryUserListComponent.razor.cs b/Wonky.Client/Pages/SystemManagerManagerLandingPage.razor.cs similarity index 80% rename from Wonky.Client/Components/OfficeCountryUserListComponent.razor.cs rename to Wonky.Client/Pages/SystemManagerManagerLandingPage.razor.cs index e60ebac4..a065b06a 100644 --- a/Wonky.Client/Components/OfficeCountryUserListComponent.razor.cs +++ b/Wonky.Client/Pages/SystemManagerManagerLandingPage.razor.cs @@ -1,3 +1,4 @@ + // 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 @@ -14,11 +15,10 @@ // using Microsoft.AspNetCore.Components; -using Wonky.Entity.DTO; -namespace Wonky.Client.Components; +namespace Wonky.Client.Pages; -public partial class OfficeCountryUserListComponent +public partial class SystemManagerLandingPage { - [Parameter] public List UserList { get; set; } = new(); + [Parameter] public string CountryCode { get; set; } = ""; } \ No newline at end of file diff --git a/Wonky.Client/Pages/SystemSupervisorListPage.razor b/Wonky.Client/Pages/SystemSupervisorListPage.razor new file mode 100644 index 00000000..e79549f5 --- /dev/null +++ b/Wonky.Client/Pages/SystemSupervisorListPage.razor @@ -0,0 +1,28 @@ +@* +// 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 +@attribute [Authorize(Roles = "Admin")] +@page "/system/supervisors" + +SupervisorUserListPage + +

Supervisor User List Page

+ +@code { + +} \ No newline at end of file diff --git a/Wonky.Client/Components/OfficeCountryUserListComponent.razor b/Wonky.Client/Pages/SystemUserListPage.razor similarity index 54% rename from Wonky.Client/Components/OfficeCountryUserListComponent.razor rename to Wonky.Client/Pages/SystemUserListPage.razor index 3f0f1bfe..920bffc2 100644 --- a/Wonky.Client/Components/OfficeCountryUserListComponent.razor +++ b/Wonky.Client/Pages/SystemUserListPage.razor @@ -15,41 +15,51 @@ // *@ -@if (UserList.Any()) -{ -
-
-
-
- Navn -
-
- Telefon -
-
- Email -
+@using Microsoft.AspNetCore.Authorization +@attribute [Authorize(Roles = "Admin")] +@page "/system/users" + +Admin User List Page + +

Admin User List Page

+ +
+
+
+
-
- @foreach (var user in UserList) +
+
Navn
+
+
+
Email
+
+
+
Telefon
+
+
+
+ + @if (UserList.Any()) + { + foreach (var user in UserList) { - + \ No newline at end of file diff --git a/Wonky.Client/Pages/SystemUserListPage.razor.cs b/Wonky.Client/Pages/SystemUserListPage.razor.cs new file mode 100644 index 00000000..400a39ef --- /dev/null +++ b/Wonky.Client/Pages/SystemUserListPage.razor.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Components; +using Wonky.Client.HttpInterceptors; +using Wonky.Client.HttpRepository; +using Wonky.Entity.DTO; + +namespace Wonky.Client.Pages; + +public partial class SystemUserListPage : IDisposable +{ + [Inject] public HttpInterceptorService Interceptor { get; set; } + [Inject] public ISystemUserRepository UserRepo { get; set; } + + private List UserList { get; set; } = new(); + + protected override async Task OnInitializedAsync() + { + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); + + UserList = await UserRepo.GetUsers(); + } + + public void Dispose() + { + Interceptor.DisposeEvent(); + } +} \ No newline at end of file diff --git a/Wonky.Client/Pages/SystemUserViewEditPage.razor b/Wonky.Client/Pages/SystemUserViewEditPage.razor index ed1180d3..ee6c93fb 100644 --- a/Wonky.Client/Pages/SystemUserViewEditPage.razor +++ b/Wonky.Client/Pages/SystemUserViewEditPage.razor @@ -18,7 +18,7 @@ @using Microsoft.AspNetCore.Authorization @using Wonky.Client.Components @attribute [Authorize(Roles = "Admin")] -@page "/office/users/advisors/{CountryCode}/{UserId}/view" +@page "/system/users/{UserId}"
@@ -27,7 +27,7 @@
@if (!string.IsNullOrWhiteSpace(UserInfo.UserId)) { - +
@@ -102,10 +102,7 @@
- Tilbage -
-
diff --git a/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs b/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs index 713d6f23..50333a08 100644 --- a/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs +++ b/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs @@ -22,7 +22,7 @@ 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; @@ -33,8 +33,7 @@ public partial class SystemUserViewEditPage : IDisposable [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 NavigationManager Navigator { get; set; } + [Inject] public ILogger Logger { get; set; } [Inject] public IToastService Toaster { get; set; } private UserManagerEditView UserInfo { get; set; } = new(); private EditContext UserEditContext { get; set; } @@ -43,7 +42,6 @@ public partial class SystemUserViewEditPage : IDisposable 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 { @@ -54,25 +52,25 @@ public partial class SystemUserViewEditPage : IDisposable { Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); + UserInfo = await UserRepo.GetUserInfo(UserId); UserEditContext = new EditContext(UserInfo); PasswdContext = new EditContext(Passwords); - PasswdContext.OnFieldChanged += PwHandleFieldChanged; + PasswdContext.OnFieldChanged += PwHandleFieldChanged!; PasswdContext.OnValidationStateChanged += PwValidationChanged; Working = false; } - private async Task UpdateAdvisor() + private async Task UpdateUser() { 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}"); + Toaster.ShowInfo("Bruger er opdateret ..."); } private void PwHandleFieldChanged(object sender, FieldChangedEventArgs e) @@ -80,18 +78,18 @@ public partial class SystemUserViewEditPage : IDisposable PwInvalid = !PasswdContext.Validate(); StateHasChanged(); } - private void PwValidationChanged(object sender, ValidationStateChangedEventArgs e) + private void PwValidationChanged(object? sender, ValidationStateChangedEventArgs e) { PwInvalid = true; - if (!Utils.IsValidPasswd(Passwords.NewPassword, MinPwLength)) + if (!Utils.IsValidPasswd(Passwords.NewPassword)) return; - PasswdContext.OnFieldChanged -= PwHandleFieldChanged; + PasswdContext.OnFieldChanged -= PwHandleFieldChanged!; PasswdContext.OnValidationStateChanged -= PwValidationChanged; PasswdContext = new EditContext(Passwords); - PasswdContext.OnFieldChanged += PwHandleFieldChanged; + PasswdContext.OnFieldChanged += PwHandleFieldChanged!; PasswdContext.OnValidationStateChanged += PwValidationChanged; } @@ -106,12 +104,11 @@ public partial class SystemUserViewEditPage : IDisposable 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.OnFieldChanged -= PwHandleFieldChanged!; PasswdContext.OnValidationStateChanged -= PwValidationChanged; } } \ No newline at end of file diff --git a/Wonky.Client/Shared/NavMenu.razor b/Wonky.Client/Shared/NavMenu.razor index 01cd8dd3..c232dc3c 100644 --- a/Wonky.Client/Shared/NavMenu.razor +++ b/Wonky.Client/Shared/NavMenu.razor @@ -109,6 +109,14 @@
+ + + + +
diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 78e6cb3b..33f1dc5d 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "0.118.5", + "version": "0.119.0", "rc": true, "sandBox": false, "image": "grumpy-coder.png" @@ -19,7 +19,7 @@ } }, "apiConfig": { - "baseUrl": "https://zeta.innotec.dk", + "baseUrl": "https://dev.innotec.dk", "catalog": "api/v2/catalog/country", "crmCustomers": "api/v2/crm/companies", "crmInventoryExt": "history/inventory",