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 @@
-
- -
-

Register with DevExpress

-

- Create a new account to see it in action -

-
-
- @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 onSubmit { get; set; } + string PhoneMask { get; set; } = "(999)000-0000"; + string FormSubmitResult = ""; + private string spinnerClass = ""; - void HandleValidSubmit() + async Task HandleValidSubmit() { + spinnerClass = "spinner-border spinner-border-sm"; + await Task.Delay(500); FormSubmitResult = "You have been registred successully."; + spinnerClass = ""; + + await onSubmit.InvokeAsync(Data); + } void HandleInvalidSubmit() { FormSubmitResult = "Please correct all errors"; } + public void OnNext(MouseEventArgs args) + { + logToBrowserConsole.LogToBC("OnNext called"); + CurrentStep++; + } + + public void OnPrevious(MouseEventArgs args) + { + logToBrowserConsole.LogToBC("OnPrev called"); + CurrentStep--; + } + public RenderFragment CreateEditFormFields() => formLayoutBuilder => { - logToBrowserConsole.LogToBC("Hellooooo"); - var propertyList = typeof(TransferDestination).GetProperties(); + var _type = Data.GetType(); + logToBrowserConsole.LogToBC("Hellooooo " + _type.AssemblyQualifiedName); + + var propertyList = _type.GetProperties(); //var propertyList = typeof(TestUserData).GetProperties(); formLayoutBuilder.OpenComponent(0); + formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) => { int i = 0; + int j = 0; foreach (var property in propertyList) { - //if(property.Name == "Id" || property.Name == "Latitude" || property.Name == "Longitude" || property.Name == "Created" || property.Name == "Modified") - if(property.Name == "Id" || property.Name == "Created" || property.Name == "Modified") + + //if (property.Name == "Id" || property.Name == "Latitude" || property.Name == "Longitude" || property.Name == "Created" || property.Name == "Modified") + if (property.Name == "Id" || property.Name == "Created" || property.Name == "Modified") { continue; } + Guid _stepID = Guid.Empty; + + if (!FormSteps.ContainsKey(j)) + { + _stepID = Guid.NewGuid(); + FormSteps.Add(j, _stepID); + } + else + { + _stepID = FormSteps[j]; + } + + var access = Expression.Property(Expression.Constant(Data), property.Name); + var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access); + + logToBrowserConsole.LogToBC(lambda.ToString()); + + layoutItemBuilder.OpenElement(i++, "div");//open div + layoutItemBuilder.AddAttribute(i++, "id", _stepID.ToString()); + layoutItemBuilder.AddAttribute(i++, "class", "disply-flex align-items-center"); + layoutItemBuilder.AddAttribute(i++, "style", "width: 100%;"); + if (j != CurrentStep) + layoutItemBuilder.AddAttribute(i++, "hidden", "true"); + DataTypeAttribute attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First(); DisplayAttribute displayLabel = (DisplayAttribute)property.GetCustomAttributes(typeof(DisplayAttribute), false).First(); - layoutItemBuilder.OpenComponent(i++); + layoutItemBuilder.OpenComponent(i++); //open dxformlayoutitem layoutItemBuilder.AddAttribute(i++, "Caption", displayLabel.Name); layoutItemBuilder.AddAttribute(i++, "ColSpanMd", 12); //layoutItemBuilder.AddAttribute(i++, "CssClass", "form-field"); - var access = Expression.Property(Expression.Constant(Data), property.Name); - var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access); - var lambda2 = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access); - + layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment)((context) => ((editor) => { var j = 0; @@ -115,23 +167,35 @@ namespace TIAMSharedUI.Pages.Components } case DataType.Custom: { - if(property.PropertyType == typeof(double)) + if (property.PropertyType == typeof(double)) { - - editor.OpenComponent(j); - object _value = property.GetValue(Data); - string _valueString = _value == null ? "" : _value.ToString(); - logToBrowserConsole.LogToBC($"Bleh: {_value.GetType()}, {_valueString}"); - editor.AddAttribute(j++, "Text", _valueString); - //editor.AddAttribute(j++, "Text", property.GetValue(Data)); - var lambda2 = Expression.Lambda>(Expression.Convert(access, typeof(string))); - editor.AddAttribute(j++, "TextExpression", lambda2); + + editor.OpenComponent>(j); + + editor.AddAttribute(j++, "Value", property.GetValue(Data)); + + editor.AddAttribute(j++, "Mask", "n6"); + editor.AddAttribute(j++, "ValueExpression", lambda); editor.AddAttribute(j++, "CssClass", "form-field"); - editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); + editor.AddAttribute(j++, "ValueChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); editor.CloseComponent(); break; } - else + else if (property.PropertyType == typeof(int)) + { + + editor.OpenComponent>(j); + + editor.AddAttribute(j++, "Value", property.GetValue(Data)); + + editor.AddAttribute(j++, "Mask", "n0"); + editor.AddAttribute(j++, "ValueExpression", lambda); + editor.AddAttribute(j++, "CssClass", "form-field"); + editor.AddAttribute(j++, "ValueChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); + editor.CloseComponent(); + break; + } + else if (property.PropertyType == typeof(string) && property.Name == "Occupation") { editor.OpenComponent>(j); @@ -142,6 +206,10 @@ namespace TIAMSharedUI.Pages.Components editor.CloseComponent(); break; } + else if (property.PropertyType == typeof(TransferDestination)) + { + + } } case DataType.MultilineText: @@ -160,140 +228,59 @@ namespace TIAMSharedUI.Pages.Components } }))); - layoutItemBuilder.CloseComponent(); + layoutItemBuilder.CloseComponent(); //close dxformlayoutitem + if (j < propertyList.Length - 1) + { + layoutItemBuilder.OpenComponent(i++); + layoutItemBuilder.AddAttribute(i++, "Click", EventCallback.Factory.Create(this, OnNext)); + layoutItemBuilder.AddAttribute(i++, "SubmitFormOnClick", false); + layoutItemBuilder.AddAttribute(i++, "CssClass", "btn btn-primary mt-3"); + layoutItemBuilder.AddAttribute(i++, "Text", "Next"); + layoutItemBuilder.CloseComponent(); + } + if (j > 0) + { + layoutItemBuilder.OpenComponent(i++); + layoutItemBuilder.AddAttribute(i++, "Click", EventCallback.Factory.Create(this, OnPrevious)); + layoutItemBuilder.AddAttribute(i++, "SubmitFormOnClick", false); + layoutItemBuilder.AddAttribute(i++, "CssClass", "btn btn-secondary mt-3"); + layoutItemBuilder.AddAttribute(i++, "Text", "Previous"); + layoutItemBuilder.CloseComponent(); + } + layoutItemBuilder.CloseElement(); //close div + + layoutItemBuilder.OpenElement(i++, "div"); layoutItemBuilder.AddAttribute(i++, "class", "text-danger"); layoutItemBuilder.OpenComponent(i++, typeof(ValidationMessage<>).MakeGenericType(property.PropertyType)); layoutItemBuilder.AddAttribute(i++, "For", lambda); layoutItemBuilder.CloseComponent(); layoutItemBuilder.CloseElement(); + + + logToBrowserConsole.LogToBC($"loop {j}, {propertyList.Length}"); + j++; + } layoutItemBuilder.OpenComponent(i++); layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment)((context) => ((editor) => { - + logToBrowserConsole.LogToBC($"Submit button {CurrentStep}, {propertyList.Length}"); editor.OpenComponent(i++); editor.AddAttribute(i++, "SubmitFormOnClick", true); - editor.AddAttribute(i++, "Text", "Bleh"); - editor.CloseComponent(); - }))); - - layoutItemBuilder.CloseComponent(); - })); - formLayoutBuilder.CloseComponent(); - }; - - public RenderFragment CreateDynamicTest() => formLayoutBuilder => - { - logToBrowserConsole.LogToBC("Hellooooo"); - - var propertyList = typeof(TransferDestination).GetProperties(); - //var propertyList = typeof(TestUserData).GetProperties(); - formLayoutBuilder.OpenComponent(0); - formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) => - { - int i = 0; - - /*DataTypeAttribute attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First(); - DisplayAttribute displayLabel = (DisplayAttribute)property.GetCustomAttributes(typeof(DisplayAttribute), false).First(); - layoutItemBuilder.OpenComponent(i++); - layoutItemBuilder.AddAttribute(i++, "Caption", displayLabel.Name); - layoutItemBuilder.AddAttribute(i++, "ColSpanMd", 12); - //layoutItemBuilder.AddAttribute(i++, "CssClass", "form-field"); - var access = Expression.Property(Expression.Constant(Data), property.Name); - var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access); - layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment)((context) => ((editor) => - { - var j = 0; - switch (attrList.DataType) + editor.AddAttribute(i++, "Text", "Submit"); + editor.AddAttribute(i++, "CssClass", "btn btn-primary mt-3"); + if (CurrentStep == propertyList.Length-1) { - - case DataType.Text: - { - editor.OpenComponent(j++); - logToBrowserConsole.LogToBC($"{property.Name}, {property.PropertyType}, {property.GetValue(Data).ToString()}"); - editor.AddAttribute(j++, "Text", property.GetValue(Data)); - editor.AddAttribute(j++, "TextExpression", lambda); - editor.AddAttribute(j++, "CssClass", "form-field"); - editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); - editor.CloseComponent(); - break; - } - case DataType.Password: - { - - editor.OpenComponent(j++); - editor.AddAttribute(j++, "Password", true); - editor.AddAttribute(j++, "NullText", "Password"); - editor.AddAttribute(j++, "Text", property.GetValue(Data)); - editor.AddAttribute(j++, "TextExpression", lambda); - editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); - editor.CloseComponent(); - break; - } - case DataType.PhoneNumber: - { - editor.OpenComponent>(j++); - editor.AddAttribute(j++, "Value", property.GetValue(Data)); - editor.AddAttribute(j++, "Mask", PhoneMask); - editor.AddAttribute(j++, "ValueExpression", lambda); - editor.AddAttribute(j++, "ValueChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); - editor.CloseComponent(); - break; - } - case DataType.Date: - { - editor.OpenComponent>(j); - editor.AddAttribute(j++, "Date", property.GetValue(Data)); - editor.AddAttribute(j++, "DateExpression", lambda); - editor.AddAttribute(j++, "DateChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); - editor.CloseComponent(); - break; - - } - case DataType.Custom: - { - editor.OpenComponent>(j); - editor.AddAttribute(j++, "Data", AdditionalData.Occupations); - editor.AddAttribute(j++, "Value", property.GetValue(Data)); - editor.AddAttribute(j++, "ValueExpression", lambda); - editor.AddAttribute(j++, "ValueChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); - editor.CloseComponent(); - break; - - } - case DataType.MultilineText: - { - editor.OpenComponent(j); - editor.AddAttribute(j++, "Text", property.GetValue(Data)); - editor.AddAttribute(j++, "TextExpression", lambda); - editor.AddAttribute(j++, "CssClass", "form-field"); - editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create(this, str => { property.SetValue(Data, str); })); - editor.CloseComponent(); - break; - - } - default: - break; + editor.AddAttribute(i++, "Visible", true); } - }))); - - layoutItemBuilder.CloseComponent(); - layoutItemBuilder.OpenElement(i++, "div"); - layoutItemBuilder.AddAttribute(i++, "class", "text-danger"); - layoutItemBuilder.OpenComponent(i++, typeof(ValidationMessage<>).MakeGenericType(property.PropertyType)); - layoutItemBuilder.AddAttribute(i++, "For", lambda); - layoutItemBuilder.CloseComponent(); - layoutItemBuilder.CloseElement();*/ - - - layoutItemBuilder.OpenComponent(i++); - layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment)((context) => ((editor) => - { - - editor.OpenComponent(i++); - editor.AddAttribute(i++, "SubmitFormOnClick", true); - editor.AddAttribute(i++, "Text", "Bleh"); + else + { + editor.AddAttribute(i++, "Visible", false); + } + editor.OpenElement(i++, "span"); + editor.AddAttribute(i++, "class", spinnerClass); + editor.CloseElement(); editor.CloseComponent(); }))); @@ -302,5 +289,7 @@ namespace TIAMSharedUI.Pages.Components formLayoutBuilder.CloseComponent(); }; + + } } diff --git a/TIAMSharedUI/Pages/Components/SettingsBasic.razor.cs b/TIAMSharedUI/Pages/Components/SettingsBasic.razor.cs index fa10e689..ec445077 100644 --- a/TIAMSharedUI/Pages/Components/SettingsBasic.razor.cs +++ b/TIAMSharedUI/Pages/Components/SettingsBasic.razor.cs @@ -36,7 +36,7 @@ namespace TIAMSharedUI.Pages.Components IEnumerable Data { get; set; } [Parameter] - public EventCallback LanguageChanged { get; set; } + public EventCallback LanguageChanged { get; set; } private Task? GetCurrentSettings() { diff --git a/TIAMSharedUI/Pages/Components/Step1.razor b/TIAMSharedUI/Pages/Components/Step1.razor index 063b22aa..e8eb5e62 100644 --- a/TIAMSharedUI/Pages/Components/Step1.razor +++ b/TIAMSharedUI/Pages/Components/Step1.razor @@ -1,4 +1,5 @@ @using TIAMWebApp.Shared.Application.Models.PageModels; +@using TIAMWebApp.Shared.Application.Utility; @@ -44,7 +45,8 @@ IEnumerable PredefinedPlaceholders { get; set; } = new List() { '_', '#' }; - string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}"; + //string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}"; + string EmailMask { get; set; } = TIAMRegularExpressions.EmailMask; MaskAutoCompleteMode AutoCompleteMode { get; set; } = MaskAutoCompleteMode.Strong; char Placeholder { get; set; } = '_'; bool PlaceholderVisible { get; set; } = false; diff --git a/TIAMSharedUI/Pages/Components/Step2.razor b/TIAMSharedUI/Pages/Components/Step2.razor index 61f75004..3c00aae9 100644 --- a/TIAMSharedUI/Pages/Components/Step2.razor +++ b/TIAMSharedUI/Pages/Components/Step2.razor @@ -1,4 +1,5 @@ @using TIAMWebApp.Shared.Application.Models.PageModels; +@using TIAMWebApp.Shared.Application.Utility;

Step 2: Phone Number

@@ -11,7 +12,7 @@ RegModelChanged { get; set; } + //public string PhoneNumberMask { get; set; } = "\+(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*\d\W*(\d{1,2})"; + public string PhoneNumberMask { get; set; } = TIAMRegularExpressions.PhoneNumberMask; + char Placeholder = '_'; private string spinnerClass = ""; diff --git a/TIAMSharedUI/Pages/ServiceProvider.razor b/TIAMSharedUI/Pages/ServiceProvider.razor index 7960c87b..9faa0053 100644 --- a/TIAMSharedUI/Pages/ServiceProvider.razor +++ b/TIAMSharedUI/Pages/ServiceProvider.razor @@ -2,7 +2,7 @@ Service provider
-
+
diff --git a/TIAMSharedUI/Pages/TestPage.razor b/TIAMSharedUI/Pages/TestPage.razor index 5c74e925..63b065b3 100644 --- a/TIAMSharedUI/Pages/TestPage.razor +++ b/TIAMSharedUI/Pages/TestPage.razor @@ -1,14 +1,22 @@ @page "/dbtest" @using TIAMSharedUI.Pages.Components +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels +@using TIAMWebApp.Shared.Application.Utility +@inject LogToBrowserConsole logToBrowserConsole

TestPage

- +
+
- - + +
@code { - + public TransferDestinationWizardModel myModel = new TransferDestinationWizardModel(); + public void SubmitForm(object Result) + { + logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}"); + } } diff --git a/TIAMSharedUI/Pages/User/Admin.razor b/TIAMSharedUI/Pages/User/Admin.razor index 77b76f38..a5928003 100644 --- a/TIAMSharedUI/Pages/User/Admin.razor +++ b/TIAMSharedUI/Pages/User/Admin.razor @@ -17,566 +17,16 @@
- @{ - if(userType == 4) - { + -
-
-
-
-
-
- Transfers -

Summary

-
- -
-
-
- -
New
-

12

-
Scheduled
-

182

-
Finished
-

15665

- -
- - - - -
-
-
-
-
-
-
- Service providers -

Summary

-
- -
-
-
- -
Guides
-

32

-
Hotels
-

82

-
Restaurants
-

15

-
Transfer company
-

1

- -
- -
-
-
-
-
-
-
- Finances -

Summary

-
- -
-
-
- -
Income
-

$32 456

-
Comission to be paid
-

$5 345

-
Service fees to be paid
-

$23 871

-
Revenue
-

$3 240

- -
- -
-
-
-
-
-
-
- Affiliates -

Summary

-
- -
-
-
- -
Top affiliate
-

Hotel Bambara

-
Comission Earned
-

$1 315

-
-
Top referred item
-

Buda castle tour

-
-
Level 1 affiliates
-

132

- -
- -
-
-
-
-
-
-
- Hotel details - -
- -
-
-
-
- - - - - - - - - - - - - -
-
- -
-
-
-
-
-
-
- Population Data -

12,March 2020

-
- -
-
-
-
- - - - - - - - - -
-
@context.Point.Argument
-
Age Group: @context.Point.SeriesName
-
Population: @($"{context.Point.Value:N0}")
-
-
-
- - - -
- -
- -
- - - - - -
-
-
-
-
-
- Affiliates -

Details

-
- -
-
-
- - - - - - - - - - - - - - - -
- -
-
-
+ - - } - - else if(userType == 1) - { -
- -
-
-
-
-
- Hotel details - -
- -
-
-
-
-
-
Your QR code
-

Use this in printed material, to gain referrals

-
-
- -
- -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- My orders - -
- -
-
-
-
- - - - - - @context.Value - - - - - - - - - - - -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- Hotel details - -
- -
-
-
-
-
-
- -
-
- -
-
-
-
-
- Panel title -

Subtitle

-
- -
-
-
-
-
-
Some info
-

Budapest, Dózsa György út 35, 1146

-
-
- -
- -
-
    -
  • - PLACED -
  • -
  • WAITING FOR PICK UP
  • -
  • - FINISHED -
  • -
- -
-

Some conclusion

-
-
- -
-
-
-
-
-
-
- Affiliates -

Details

-
- -
-
-
- - - - - - - - - - - - - - - -
- -
-
- -
- - - } - } +
+ @@ -745,12 +195,8 @@ @code { - object? OrderData { get; set; } - object? AffiliateData { get; set; } - - IEnumerable? ChartsData; - - object? Data { get; set; } + + bool isUserLoggedIn; int userType = 0; @@ -762,72 +208,9 @@ { base.OnInitialized(); - OrderData = new object[] - { - new { - Date = DateTime.Now.AddDays(3), - Income = "$5", - TransactionId = "POX987532582", - Status = "Finished" - }, - new { - Date = DateTime.Today.AddDays(-2), - Income = "$5", - TransactionId = "POX645646382", - Status = "Finished" - }, - new { - Date = DateTime.Today.AddDays(-6), - Income = "$8", - TransactionId = "POX645766311", - Status = "Finished" - }, - }; - - AffiliateData = new object[] - { - new { - AffiliateId = 1, - IncomeThisMonth = "$5", - IncomeAlltime = "9425", - CompanyName = "Upgen Ltd.", - Status = "Active" - }, - new { - AffiliateId = 2, - IncomeThisMonth = "$538", - IncomeAlltime = "13425", - CompanyName = "Kovacs hotel Ltd.", - Status = "Active" - }, - new { - AffiliateId = 3, - IncomeThisMonth = "$0", - IncomeAlltime = "134200", - CompanyName = "Innosaurus Ltd.", - Status = "Passive" - }, - }; - - - ChartsData = await DataProvider.QueryData(); + - var suppliers = await SupplierService.GetSuppliersAsync(); - Data = suppliers.Select(s => - { - return new - { - CompanyName = s.CompanyName, - ContactName = s.ContactName, - ContactTitle = s.ContactTitle, - Country = s.Country, - City = s.City, - Address = s.Address, - Phone = s.Phone - }; - }); } - [Parameter] public bool ShowSeriesPointMarkers { get; set; } - [Parameter] public bool ShowSeriesLabels { get; set; } + } diff --git a/TIAMSharedUI/Pages/User/GuideComponent.razor b/TIAMSharedUI/Pages/User/GuideComponent.razor new file mode 100644 index 00000000..38803301 --- /dev/null +++ b/TIAMSharedUI/Pages/User/GuideComponent.razor @@ -0,0 +1,5 @@ +

GuideComponent

+ +@code { + +} diff --git a/TIAMSharedUI/Pages/User/HotelComponent.razor b/TIAMSharedUI/Pages/User/HotelComponent.razor new file mode 100644 index 00000000..6f1aa6a0 --- /dev/null +++ b/TIAMSharedUI/Pages/User/HotelComponent.razor @@ -0,0 +1,234 @@ +@using TIAMSharedUI.Shared +@using TIAMWebApp.Shared.Application.Models; +@using TIAMWebApp.Shared.Application.Interfaces; +@using TIAMSharedUI.Pages.User; + + + +
+ +
+
+
+
+
+ Hotel details + +
+ +
+
+
+
+
+
Your QR code
+

Use this in printed material, to gain referrals

+
+
+ +
+ +
+ +
+

Some conclusion

+
+
+ +
+
+
+
+
+
+
+ My orders + +
+ +
+
+
+
+ + + + + + @context.Value + + + + + + + + + + + +
+ +
+

Some conclusion

+
+
+ +
+
+
+
+
+
+
+ Hotel details + +
+ +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ Panel title +

Subtitle

+
+ +
+
+
+
+
+
Some info
+

Budapest, Dózsa György út 35, 1146

+
+
+ +
+ +
+
    +
  • + PLACED +
  • +
  • WAITING FOR PICK UP
  • +
  • + FINISHED +
  • +
+ +
+

Some conclusion

+
+
+ +
+
+
+
+
+
+
+ Affiliates +

Details

+
+ +
+
+
+ + + + + + + + + + + + + + + +
+ +
+
+ +
+ +@code { + +} diff --git a/TIAMSharedUI/Pages/User/HotelComponent.razor.cs b/TIAMSharedUI/Pages/User/HotelComponent.razor.cs new file mode 100644 index 00000000..e1152313 --- /dev/null +++ b/TIAMSharedUI/Pages/User/HotelComponent.razor.cs @@ -0,0 +1,102 @@ +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TIAMWebApp.Shared.Application.Interfaces; +using TIAMWebApp.Shared.Application.Models; + +namespace TIAMSharedUI.Pages.User +{ + public partial class HotelComponent: ComponentBase + { + + [Inject] + ISupplierService SupplierService { get; set; } + + [Inject] + IUserDataService UserDataService { get; set; } + + object? OrderData { get; set; } + object? AffiliateData { get; set; } + + object? Data { get; set; } + + bool isUserLoggedIn; + int userType = 0; + + + + + protected override async Task OnInitializedAsync() + { + base.OnInitialized(); + + OrderData = new object[] + { + new { + Date = DateTime.Now.AddDays(3), + Income = "$5", + TransactionId = "POX987532582", + Status = "Finished" + }, + new { + Date = DateTime.Today.AddDays(-2), + Income = "$5", + TransactionId = "POX645646382", + Status = "Finished" + }, + new { + Date = DateTime.Today.AddDays(-6), + Income = "$8", + TransactionId = "POX645766311", + Status = "Finished" + }, + }; + + AffiliateData = new object[] + { + new { + AffiliateId = 1, + IncomeThisMonth = "$5", + IncomeAlltime = "9425", + CompanyName = "Upgen Ltd.", + Status = "Active" + }, + new { + AffiliateId = 2, + IncomeThisMonth = "$538", + IncomeAlltime = "13425", + CompanyName = "Kovacs hotel Ltd.", + Status = "Active" + }, + new { + AffiliateId = 3, + IncomeThisMonth = "$0", + IncomeAlltime = "134200", + CompanyName = "Innosaurus Ltd.", + Status = "Passive" + }, + }; + + + var suppliers = await SupplierService.GetSuppliersAsync(); + Data = suppliers.Select(s => + { + return new + { + CompanyName = s.CompanyName, + ContactName = s.ContactName, + ContactTitle = s.ContactTitle, + Country = s.Country, + City = s.City, + Address = s.Address, + Phone = s.Phone + }; + }); + } + [Parameter] public bool ShowSeriesPointMarkers { get; set; } + [Parameter] public bool ShowSeriesLabels { get; set; } + } +} diff --git a/TIAMSharedUI/Pages/User/Properties.razor b/TIAMSharedUI/Pages/User/Properties.razor index bed59c28..110f7581 100644 --- a/TIAMSharedUI/Pages/User/Properties.razor +++ b/TIAMSharedUI/Pages/User/Properties.razor @@ -1,4 +1,7 @@ -

Properties

+@page "/user/properties" +@using TIAMSharedUI.Shared +@layout AdminLayout +

Properties

@code { diff --git a/TIAMSharedUI/Pages/User/SysAdminComponent.razor b/TIAMSharedUI/Pages/User/SysAdminComponent.razor new file mode 100644 index 00000000..d091ab58 --- /dev/null +++ b/TIAMSharedUI/Pages/User/SysAdminComponent.razor @@ -0,0 +1,280 @@ +@using TIAMSharedUI.Shared +@using TIAMWebApp.Shared.Application.Models; +@using TIAMWebApp.Shared.Application.Interfaces; + + + +
+
+
+
+
+
+ Transfers +

Summary

+
+ +
+
+
+ +
New
+

12

+
Scheduled
+

182

+
Finished
+

15665

+ +
+ + + + +
+
+
+
+
+
+
+ Service providers +

Summary

+
+ +
+
+
+ +
Guides
+

32

+
Hotels
+

82

+
Restaurants
+

15

+
Transfer company
+

1

+ +
+ +
+
+
+
+
+
+
+ Finances +

Summary

+
+ +
+
+
+ +
Income
+

$32 456

+
Comission to be paid
+

$5 345

+
Service fees to be paid
+

$23 871

+
Revenue
+

$3 240

+ +
+ +
+
+
+
+
+
+
+ Affiliates +

Summary

+
+ +
+
+
+ +
Top affiliate
+

Hotel Bambara

+
Comission Earned
+

$1 315

+
+
Top referred item
+

Buda castle tour

+
+
Level 1 affiliates
+

132

+ +
+ +
+
+
+
+
+
+
+ Hotel details + +
+ +
+
+
+
+ + + + + + + + + + + + + +
+
+ +
+
+
+
+
+
+
+ Population Data +

12,March 2020

+
+ +
+
+
+
+ + + + + + + + + +
+
@context.Point.Argument
+
Age Group: @context.Point.SeriesName
+
Population: @($"{context.Point.Value:N0}")
+
+
+
+ + + +
+ +
+ +
+ + + + + +
+ +
+ +@code { + +} diff --git a/TIAMSharedUI/Pages/User/SysAdminComponent.razor.cs b/TIAMSharedUI/Pages/User/SysAdminComponent.razor.cs new file mode 100644 index 00000000..9dfe0486 --- /dev/null +++ b/TIAMSharedUI/Pages/User/SysAdminComponent.razor.cs @@ -0,0 +1,62 @@ +using Microsoft.AspNetCore.Components; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using TIAMWebApp.Shared.Application.Interfaces; +using TIAMWebApp.Shared.Application.Models; + +namespace TIAMSharedUI.Pages.User +{ + public partial class SysAdminComponent : ComponentBase + { + [Inject] + IPopulationStructureDataProvider DataProvider { get; set; } + + object? AffiliateData { get; set; } + + IEnumerable? ChartsData; + + + protected override async Task OnInitializedAsync() + { + base.OnInitialized(); + + + + AffiliateData = new object[] + { + new { + AffiliateId = 1, + IncomeThisMonth = "$5", + IncomeAlltime = "9425", + CompanyName = "Upgen Ltd.", + Status = "Active" + }, + new { + AffiliateId = 2, + IncomeThisMonth = "$538", + IncomeAlltime = "13425", + CompanyName = "Kovacs hotel Ltd.", + Status = "Active" + }, + new { + AffiliateId = 3, + IncomeThisMonth = "$0", + IncomeAlltime = "134200", + CompanyName = "Innosaurus Ltd.", + Status = "Passive" + }, + }; + + + ChartsData = await DataProvider.QueryData(); + + + } + [Parameter] public bool ShowSeriesPointMarkers { get; set; } + [Parameter] public bool ShowSeriesLabels { get; set; } + + } +} diff --git a/TIAMSharedUI/Resources/MyResources.Designer.cs b/TIAMSharedUI/Resources/MyResources.Designer.cs index 2760776f..447e310b 100644 --- a/TIAMSharedUI/Resources/MyResources.Designer.cs +++ b/TIAMSharedUI/Resources/MyResources.Designer.cs @@ -168,6 +168,15 @@ namespace TIAMSharedUI.Resources { } } + /// + /// Looks up a localized string similar to Admin. + /// + public static string NavMenu_Admin { + get { + return ResourceManager.GetString("NavMenu.Admin", resourceCulture); + } + } + /// /// Looks up a localized string similar to Home. /// diff --git a/TIAMSharedUI/Resources/MyResources.hu.resx b/TIAMSharedUI/Resources/MyResources.hu.resx index d383b021..fb6fe0a7 100644 --- a/TIAMSharedUI/Resources/MyResources.hu.resx +++ b/TIAMSharedUI/Resources/MyResources.hu.resx @@ -153,6 +153,9 @@ Lépjünk csak be! + + Adminisztráció + Főoldal diff --git a/TIAMSharedUI/Resources/MyResources.resx b/TIAMSharedUI/Resources/MyResources.resx index ee387179..8cca7c97 100644 --- a/TIAMSharedUI/Resources/MyResources.resx +++ b/TIAMSharedUI/Resources/MyResources.resx @@ -153,6 +153,9 @@ Let's get you inside! + + Admin + Home diff --git a/TIAMSharedUI/Shared/Components/Navbar.razor b/TIAMSharedUI/Shared/Components/Navbar.razor index 03e2fe66..ebcb8996 100644 --- a/TIAMSharedUI/Shared/Components/Navbar.razor +++ b/TIAMSharedUI/Shared/Components/Navbar.razor @@ -2,15 +2,13 @@ @using TIAMWebApp.Shared.Application.Interfaces @using AyCode.Interfaces.StorageHandlers @using Microsoft.Extensions.Localization -@inject ISecureStorageHandler SecureStorageHandler -@inject ISessionService sessionService; -@inject IStringLocalizer localizer +