From f9ea3f400111c3eed852a9e766810a34d27d809e Mon Sep 17 00:00:00 2001
From: Adam
Date: Mon, 18 Dec 2023 23:03:00 +0100
Subject: [PATCH] InputWizard
---
.../ServiceProviders/ServiceProviderDal.cs | 3 +-
.../ServiceProviderDbContext.cs | 3 +-
.../TransferDestination.cs | 33 +-
TIAMResources/Class1.cs | 7 +
TIAMResources/TIAM.Resources.csproj | 28 +
TIAMResources/TIAMResources.Designer.cs | 99 +++
TIAMResources/TIAMResources.hu.resx | 132 ++++
TIAMResources/TIAMResources.resx | 132 ++++
TIAMSharedUI/Pages/AppLaunch.razor | 2 +-
.../Pages/Components/AuthComponent.razor.cs | 3 +
.../Pages/Components/InputWizard.razor | 16 +-
.../Pages/Components/InputWizard.razor.cs | 293 ++++----
.../Pages/Components/SettingsBasic.razor.cs | 2 +-
TIAMSharedUI/Pages/Components/Step1.razor | 4 +-
TIAMSharedUI/Pages/Components/Step2.razor | 6 +-
TIAMSharedUI/Pages/ServiceProvider.razor | 2 +-
TIAMSharedUI/Pages/TestPage.razor | 16 +-
TIAMSharedUI/Pages/User/Admin.razor | 633 +-----------------
TIAMSharedUI/Pages/User/GuideComponent.razor | 5 +
TIAMSharedUI/Pages/User/HotelComponent.razor | 234 +++++++
.../Pages/User/HotelComponent.razor.cs | 102 +++
TIAMSharedUI/Pages/User/Properties.razor | 5 +-
.../Pages/User/SysAdminComponent.razor | 280 ++++++++
.../Pages/User/SysAdminComponent.razor.cs | 62 ++
.../Resources/MyResources.Designer.cs | 9 +
TIAMSharedUI/Resources/MyResources.hu.resx | 3 +
TIAMSharedUI/Resources/MyResources.resx | 3 +
TIAMSharedUI/Shared/Components/Navbar.razor | 15 +-
.../Shared/Components/Navbar.razor.cs | 43 +-
.../Shared/Components/Navbar.razor.css | 7 +-
TIAMSharedUI/Shared/Users/AdminNavMenu.razor | 11 +-
TIAMSharedUI/TIAMSharedUI.csproj | 1 +
.../Services/ServiceProviderDataServiceWeb.cs | 2 +
.../Client/Services/UserDataServiceWeb.cs | 30 +-
.../ServiceProviderAPIController.cs | 5 +-
.../Controllers/SupplierAPIController.cs | 68 +-
.../Interfaces/IServiceProviderDataService.cs | 1 +
.../Shared/Interfaces/IUserDataService.cs | 2 +-
.../UI/WizardModels/RegisterWizardModel.cs | 54 ++
.../TransferDestinationWizardModel.cs | 45 ++
.../Models/{Product.cs => ProductDTO.cs} | 2 +-
TIAMWebApp/Shared/Models/Supplier.cs | 2 +-
.../TIAMWebApp.Shared.Application.csproj | 2 +
TIAMWebApp/Shared/Utility/RenderWizard.cs | 12 +
TIAMWebApp/Shared/Utility/ResourceKeys.cs | 8 +
.../Shared/Utility/TIAMRegularExpressions.cs | 16 +
TourIAmProject.sln | 6 +
47 files changed, 1546 insertions(+), 903 deletions(-)
create mode 100644 TIAMResources/Class1.cs
create mode 100644 TIAMResources/TIAM.Resources.csproj
create mode 100644 TIAMResources/TIAMResources.Designer.cs
create mode 100644 TIAMResources/TIAMResources.hu.resx
create mode 100644 TIAMResources/TIAMResources.resx
create mode 100644 TIAMSharedUI/Pages/User/GuideComponent.razor
create mode 100644 TIAMSharedUI/Pages/User/HotelComponent.razor
create mode 100644 TIAMSharedUI/Pages/User/HotelComponent.razor.cs
create mode 100644 TIAMSharedUI/Pages/User/SysAdminComponent.razor
create mode 100644 TIAMSharedUI/Pages/User/SysAdminComponent.razor.cs
create mode 100644 TIAMWebApp/Shared/Models/ClientSide/UI/WizardModels/RegisterWizardModel.cs
create mode 100644 TIAMWebApp/Shared/Models/ClientSide/UI/WizardModels/TransferDestinationWizardModel.cs
rename TIAMWebApp/Shared/Models/{Product.cs => ProductDTO.cs} (92%)
create mode 100644 TIAMWebApp/Shared/Utility/RenderWizard.cs
create mode 100644 TIAMWebApp/Shared/Utility/ResourceKeys.cs
create mode 100644 TIAMWebApp/Shared/Utility/TIAMRegularExpressions.cs
diff --git a/TIAM.Database/DataLayers/ServiceProviders/ServiceProviderDal.cs b/TIAM.Database/DataLayers/ServiceProviders/ServiceProviderDal.cs
index 36065d93..cd6843b2 100644
--- a/TIAM.Database/DataLayers/ServiceProviders/ServiceProviderDal.cs
+++ b/TIAM.Database/DataLayers/ServiceProviders/ServiceProviderDal.cs
@@ -31,8 +31,7 @@ namespace TIAM.Database.DataLayers.ServiceProviders
{
}
- public User? GetUserById(Guid userId, bool autoInclude = true) => Session(x => x.GetUserById(userId, autoInclude));
- public User? GetUserByEmail(string email, bool autoInclude = true) => Session(x => x.GetUserByEmail(email, autoInclude));
+
public UserProductMapping? GetUserProductMappingById(Guid userProductMappingId) => Session(x => x.GetUserProductMappingById(userProductMappingId));
diff --git a/TIAM.Database/DbContexts/ServiceProviders/ServiceProviderDbContext.cs b/TIAM.Database/DbContexts/ServiceProviders/ServiceProviderDbContext.cs
index fbabee23..b4e3e562 100644
--- a/TIAM.Database/DbContexts/ServiceProviders/ServiceProviderDbContext.cs
+++ b/TIAM.Database/DbContexts/ServiceProviders/ServiceProviderDbContext.cs
@@ -8,6 +8,7 @@ using AyCode.Database.DbContexts.Users;
using AyCode.Entities.Users;
using Microsoft.EntityFrameworkCore;
using TIAM.Database.DbContexts.Users;
+using TIAM.Database.DbSets.Users;
using TIAM.Database.ModelBuilders.Products;
using TIAM.Database.ModelBuilders.Users;
using TIAM.Entities.Permissions;
@@ -17,7 +18,7 @@ using TIAM.Entities.Users;
namespace TIAM.Database.DbContexts.ServiceProviders
{
- public class ServiceProviderDbContext : DbContextBase, IServiceProviderDbContext
+ public class ServiceProviderDbContext : DbContextBase, IServiceProviderDbContext, IUserProductMappingDbSet
{
public DbSet Users { get; set; }
public DbSet UserProductMappings { get; set; }
diff --git a/TIAM.Entities/TransferDestinations/TransferDestination.cs b/TIAM.Entities/TransferDestinations/TransferDestination.cs
index d51da3dc..34e1db41 100644
--- a/TIAM.Entities/TransferDestinations/TransferDestination.cs
+++ b/TIAM.Entities/TransferDestinations/TransferDestination.cs
@@ -7,16 +7,12 @@ using System.Text.RegularExpressions;
namespace TIAM.Entities.TransferDestinations
{
- [Table("TransferDestination")]
+ [Table("TransferDestinations")]
public class TransferDestination : LocationBase, ITimeStampInfo
{
- //[Required(ErrorMessage = "The Username value should be specified.")]
- [DataType(DataType.Text)]
- [Display(Name = "Destination name")]
+ //[Required(ErrorMessage = "The Username value should be specified.")]
public string? Name { get; set; }
- [DataType(DataType.MultilineText)]
- [Display(Name = "Destination info")]
public string? Description { get; set; }
public DateTime Created { get; set; }
@@ -29,30 +25,5 @@ namespace TIAM.Entities.TransferDestinations
public TransferDestination(Guid id, string name, string description, double latitude, double longitude, string address) : base(id, latitude,longitude, address) { }
}
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class MinPasswordLengthAttribute : ValidationAttribute
- {
- int MinLength { get; }
- public MinPasswordLengthAttribute(int minLength, string errorMsg) : base(errorMsg)
- {
- MinLength = minLength;
- }
-
- public override bool IsValid(object value)
- {
- return ((string)value).Length >= MinLength;
- }
- }
-
- [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]
- public class EmailAttribute : ValidationAttribute
- {
- public override bool IsValid(object value)
- {
- return Regex.IsMatch((string)value, @"^[\w!#$%&'*+\-/=?\^_`{|}~]+(\.[\w!#$%&'*+\-/=?\^_`{|}~]+)*"
- + "@"
- + @"((([\-\w]+\.)+[a-zA-Z]{2,4})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$");
- }
- }
}
diff --git a/TIAMResources/Class1.cs b/TIAMResources/Class1.cs
new file mode 100644
index 00000000..d2409d7e
--- /dev/null
+++ b/TIAMResources/Class1.cs
@@ -0,0 +1,7 @@
+namespace TIAM.Resources
+{
+ public class Class1
+ {
+
+ }
+}
diff --git a/TIAMResources/TIAM.Resources.csproj b/TIAMResources/TIAM.Resources.csproj
new file mode 100644
index 00000000..cd8b2454
--- /dev/null
+++ b/TIAMResources/TIAM.Resources.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net8.0
+ enable
+ enable
+
+
+
+
+ True
+ True
+ TIAMResources.resx
+
+
+
+
+
+ Always
+
+
+ PublicResXFileCodeGenerator
+ TIAMResources.Designer.cs
+ Always
+
+
+
+
diff --git a/TIAMResources/TIAMResources.Designer.cs b/TIAMResources/TIAMResources.Designer.cs
new file mode 100644
index 00000000..322bfc8a
--- /dev/null
+++ b/TIAMResources/TIAMResources.Designer.cs
@@ -0,0 +1,99 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace TIAM.Resources {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class TIAMResources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal TIAMResources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TIAM.Resources.TIAMResources", typeof(TIAMResources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Address.
+ ///
+ public static string DestinationAddress {
+ get {
+ return ResourceManager.GetString("DestinationAddress", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Details about the destination.
+ ///
+ public static string DestinationInfo {
+ get {
+ return ResourceManager.GetString("DestinationInfo", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Name of destination.
+ ///
+ public static string DestinationName {
+ get {
+ return ResourceManager.GetString("DestinationName", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to This works!.
+ ///
+ public static string Test {
+ get {
+ return ResourceManager.GetString("Test", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/TIAMResources/TIAMResources.hu.resx b/TIAMResources/TIAMResources.hu.resx
new file mode 100644
index 00000000..7578f720
--- /dev/null
+++ b/TIAMResources/TIAMResources.hu.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Cím
+
+
+ Több információ az uticélról
+
+
+ Uticél neve
+
+
+ Müxik!
+
+
\ No newline at end of file
diff --git a/TIAMResources/TIAMResources.resx b/TIAMResources/TIAMResources.resx
new file mode 100644
index 00000000..21bc2e2d
--- /dev/null
+++ b/TIAMResources/TIAMResources.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Address
+
+
+ Details about the destination
+
+
+ Name of destination
+
+
+ This works!
+
+
\ No newline at end of file
diff --git a/TIAMSharedUI/Pages/AppLaunch.razor b/TIAMSharedUI/Pages/AppLaunch.razor
index f4f19107..edddb85c 100644
--- a/TIAMSharedUI/Pages/AppLaunch.razor
+++ b/TIAMSharedUI/Pages/AppLaunch.razor
@@ -84,7 +84,7 @@ Loading....
string _userId = jsontoken.Claims.First(claim => claim.Type == JwtRegisteredClaimNames.NameId).Value;
string _email = jsontoken.Claims.First(claim => claim.Type == JwtRegisteredClaimNames.Email).Value;
var user = await UserDataService.IsLoggedInAsync(Guid.Parse(_userId));
- sessionService.User = user;
+ sessionService.User = user;
logToBrowserConsole.LogToBC($"Saved user in db is: {user.Email}, setting autenthicated state");
sessionService.IsAuthenticated = true;
NavManager.NavigateTo("/index");
diff --git a/TIAMSharedUI/Pages/Components/AuthComponent.razor.cs b/TIAMSharedUI/Pages/Components/AuthComponent.razor.cs
index a182e74f..9956e312 100644
--- a/TIAMSharedUI/Pages/Components/AuthComponent.razor.cs
+++ b/TIAMSharedUI/Pages/Components/AuthComponent.razor.cs
@@ -13,11 +13,14 @@ namespace TIAMSharedUI.Pages.Components
[Inject]
public ISessionService sessionService { get; set; }
public bool IsLoggedIn = false;
+ [Inject]
+ public IComponentUpdateService componentUpdateService { get; set; }
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
IsLoggedIn = sessionService.IsAuthenticated;
+ componentUpdateService.CallRequestRefresh();
StateHasChanged();
}
diff --git a/TIAMSharedUI/Pages/Components/InputWizard.razor b/TIAMSharedUI/Pages/Components/InputWizard.razor
index 2b51e392..3a4b9408 100644
--- a/TIAMSharedUI/Pages/Components/InputWizard.razor
+++ b/TIAMSharedUI/Pages/Components/InputWizard.razor
@@ -1,5 +1,6 @@
@using System.Linq.Expressions
@using System.ComponentModel.DataAnnotations
+@inject IStringLocalizer Localizer
Edit Form
@@ -20,21 +21,10 @@
-
-
-
-
- @CreateDynamicTest()
-
-
-
+
+
@Localizer.GetString("DestinationName")
@FormSubmitResult
diff --git a/TIAMSharedUI/Pages/Components/InputWizard.razor.cs b/TIAMSharedUI/Pages/Components/InputWizard.razor.cs
index c0b503b1..0fccbc97 100644
--- a/TIAMSharedUI/Pages/Components/InputWizard.razor.cs
+++ b/TIAMSharedUI/Pages/Components/InputWizard.razor.cs
@@ -1,17 +1,14 @@
-using AyCode.Entities.Users;
-using DevExpress.Blazor;
+using DevExpress.Blazor;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms;
-using System;
-using System.Collections.Generic;
+using Microsoft.AspNetCore.Components.Web;
using System.ComponentModel.DataAnnotations;
-using System.Linq;
using System.Linq.Expressions;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
using TIAM.Entities.TransferDestinations;
using TIAMWebApp.Shared.Application.Utility;
+using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
+using TIAMWebApp.Shared.Application.Models.PageModels;
+using DevExpress.Pdf.Native.BouncyCastle.Asn1.X509.Qualified;
namespace TIAMSharedUI.Pages.Components
@@ -21,49 +18,104 @@ namespace TIAMSharedUI.Pages.Components
[Inject]
LogToBrowserConsole logToBrowserConsole { get; set; }
- string FormSubmitResult = "";
+ public Dictionary FormSteps { get; set; } = new Dictionary();
+ public int CurrentStep { get; set; } = 0;
+
+
//TestUserData Data { get; set; } = new TestUserData();
- TransferDestination Data { get; set; } = new TransferDestination();
+
+ [Parameter]
+ public object Data { get; set; } = new object();
+
+ [Parameter]
+ public EventCallback