InputWizard

This commit is contained in:
Adam 2023-12-18 23:03:00 +01:00
parent 2f4bdd95f8
commit f9ea3f4001
47 changed files with 1546 additions and 903 deletions

View File

@ -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)); public UserProductMapping? GetUserProductMappingById(Guid userProductMappingId) => Session(x => x.GetUserProductMappingById(userProductMappingId));

View File

@ -8,6 +8,7 @@ using AyCode.Database.DbContexts.Users;
using AyCode.Entities.Users; using AyCode.Entities.Users;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using TIAM.Database.DbContexts.Users; using TIAM.Database.DbContexts.Users;
using TIAM.Database.DbSets.Users;
using TIAM.Database.ModelBuilders.Products; using TIAM.Database.ModelBuilders.Products;
using TIAM.Database.ModelBuilders.Users; using TIAM.Database.ModelBuilders.Users;
using TIAM.Entities.Permissions; using TIAM.Entities.Permissions;
@ -17,7 +18,7 @@ using TIAM.Entities.Users;
namespace TIAM.Database.DbContexts.ServiceProviders namespace TIAM.Database.DbContexts.ServiceProviders
{ {
public class ServiceProviderDbContext : DbContextBase, IServiceProviderDbContext public class ServiceProviderDbContext : DbContextBase, IServiceProviderDbContext, IUserProductMappingDbSet
{ {
public DbSet<User> Users { get; set; } public DbSet<User> Users { get; set; }
public DbSet<UserProductMapping> UserProductMappings { get; set; } public DbSet<UserProductMapping> UserProductMappings { get; set; }

View File

@ -7,16 +7,12 @@ using System.Text.RegularExpressions;
namespace TIAM.Entities.TransferDestinations namespace TIAM.Entities.TransferDestinations
{ {
[Table("TransferDestination")] [Table("TransferDestinations")]
public class TransferDestination : LocationBase, ITimeStampInfo public class TransferDestination : LocationBase, ITimeStampInfo
{ {
//[Required(ErrorMessage = "The Username value should be specified.")] //[Required(ErrorMessage = "The Username value should be specified.")]
[DataType(DataType.Text)]
[Display(Name = "Destination name")]
public string? Name { get; set; } public string? Name { get; set; }
[DataType(DataType.MultilineText)]
[Display(Name = "Destination info")]
public string? Description { get; set; } public string? Description { get; set; }
public DateTime Created { 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) { } 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}))$");
}
}
} }

7
TIAMResources/Class1.cs Normal file
View File

@ -0,0 +1,7 @@
namespace TIAM.Resources
{
public class Class1
{
}
}

View File

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Update="TIAMResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>TIAMResources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="TIAMResources.hu.resx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Update="TIAMResources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>TIAMResources.Designer.cs</LastGenOutput>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
</Project>

99
TIAMResources/TIAMResources.Designer.cs generated Normal file
View File

@ -0,0 +1,99 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TIAM.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// 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() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[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;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Address.
/// </summary>
public static string DestinationAddress {
get {
return ResourceManager.GetString("DestinationAddress", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Details about the destination.
/// </summary>
public static string DestinationInfo {
get {
return ResourceManager.GetString("DestinationInfo", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name of destination.
/// </summary>
public static string DestinationName {
get {
return ResourceManager.GetString("DestinationName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This works!.
/// </summary>
public static string Test {
get {
return ResourceManager.GetString("Test", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DestinationAddress" xml:space="preserve">
<value>Cím</value>
</data>
<data name="DestinationInfo" xml:space="preserve">
<value>Több információ az uticélról</value>
</data>
<data name="DestinationName" xml:space="preserve">
<value>Uticél neve</value>
</data>
<data name="Test" xml:space="preserve">
<value>Müxik!</value>
</data>
</root>

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DestinationAddress" xml:space="preserve">
<value>Address</value>
</data>
<data name="DestinationInfo" xml:space="preserve">
<value>Details about the destination</value>
</data>
<data name="DestinationName" xml:space="preserve">
<value>Name of destination</value>
</data>
<data name="Test" xml:space="preserve">
<value>This works!</value>
</data>
</root>

View File

@ -13,11 +13,14 @@ namespace TIAMSharedUI.Pages.Components
[Inject] [Inject]
public ISessionService sessionService { get; set; } public ISessionService sessionService { get; set; }
public bool IsLoggedIn = false; public bool IsLoggedIn = false;
[Inject]
public IComponentUpdateService componentUpdateService { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
IsLoggedIn = sessionService.IsAuthenticated; IsLoggedIn = sessionService.IsAuthenticated;
componentUpdateService.CallRequestRefresh();
StateHasChanged(); StateHasChanged();
} }

View File

@ -1,5 +1,6 @@
@using System.Linq.Expressions @using System.Linq.Expressions
@using System.ComponentModel.DataAnnotations @using System.ComponentModel.DataAnnotations
@inject IStringLocalizer<TIAM.Resources.TIAMResources> Localizer
<h2>Edit Form</h2> <h2>Edit Form</h2>
<div class="wrapper"> <div class="wrapper">
@ -20,21 +21,10 @@
</div> </div>
</EditForm> </EditForm>
</div> </div>
<div class="card cw-480">
<div class="card-header text-center py-3">
<h4>Register with DevExpress</h4>
<p class="tm-8 mb-0 fw-normal fs-825">
Create a new account to see it in action
</p>
</div>
<div class="card-body">
@CreateDynamicTest()
</div>
</div>
</div> </div>
<p class="tm-8 cw-480 mt-2"> <p class="tm-8 cw-480 mt-2">
<h3> @Localizer.GetString("DestinationName")</h3>
@FormSubmitResult @FormSubmitResult
</p> </p>

View File

@ -1,17 +1,14 @@
using AyCode.Entities.Users; using DevExpress.Blazor;
using DevExpress.Blazor;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Forms; using Microsoft.AspNetCore.Components.Forms;
using System; using Microsoft.AspNetCore.Components.Web;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using TIAM.Entities.TransferDestinations; using TIAM.Entities.TransferDestinations;
using TIAMWebApp.Shared.Application.Utility; 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 namespace TIAMSharedUI.Pages.Components
@ -21,48 +18,103 @@ namespace TIAMSharedUI.Pages.Components
[Inject] [Inject]
LogToBrowserConsole logToBrowserConsole { get; set; } LogToBrowserConsole logToBrowserConsole { get; set; }
string FormSubmitResult = ""; public Dictionary<int, Guid> FormSteps { get; set; } = new Dictionary<int, Guid>();
public int CurrentStep { get; set; } = 0;
//TestUserData Data { get; set; } = new TestUserData(); //TestUserData Data { get; set; } = new TestUserData();
TransferDestination Data { get; set; } = new TransferDestination();
[Parameter]
public object Data { get; set; } = new object();
[Parameter]
public EventCallback<object> onSubmit { get; set; }
string PhoneMask { get; set; } = "(999)000-0000"; 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."; FormSubmitResult = "You have been registred successully.";
spinnerClass = "";
await onSubmit.InvokeAsync(Data);
} }
void HandleInvalidSubmit() void HandleInvalidSubmit()
{ {
FormSubmitResult = "Please correct all errors"; 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 => 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(); //var propertyList = typeof(TestUserData).GetProperties();
formLayoutBuilder.OpenComponent<DxFormLayout>(0); formLayoutBuilder.OpenComponent<DxFormLayout>(0);
formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) => formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) =>
{ {
int i = 0; int i = 0;
int j = 0;
foreach (var property in propertyList) 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 == "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 == "Created" || property.Name == "Modified")
{ {
continue; 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(); DataTypeAttribute attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First();
DisplayAttribute displayLabel = (DisplayAttribute)property.GetCustomAttributes(typeof(DisplayAttribute), false).First(); DisplayAttribute displayLabel = (DisplayAttribute)property.GetCustomAttributes(typeof(DisplayAttribute), false).First();
layoutItemBuilder.OpenComponent<DxFormLayoutItem>(i++); layoutItemBuilder.OpenComponent<DxFormLayoutItem>(i++); //open dxformlayoutitem
layoutItemBuilder.AddAttribute(i++, "Caption", displayLabel.Name); layoutItemBuilder.AddAttribute(i++, "Caption", displayLabel.Name);
layoutItemBuilder.AddAttribute(i++, "ColSpanMd", 12); layoutItemBuilder.AddAttribute(i++, "ColSpanMd", 12);
//layoutItemBuilder.AddAttribute(i++, "CssClass", "form-field"); //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<Object>)((context) => ((editor) => layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<Object>)((context) => ((editor) =>
{ {
@ -118,20 +170,32 @@ namespace TIAMSharedUI.Pages.Components
if (property.PropertyType == typeof(double)) if (property.PropertyType == typeof(double))
{ {
editor.OpenComponent<DxTextBox>(j); editor.OpenComponent<DxMaskedInput<double>>(j);
object _value = property.GetValue(Data);
string _valueString = _value == null ? "" : _value.ToString(); editor.AddAttribute(j++, "Value", property.GetValue(Data));
logToBrowserConsole.LogToBC($"Bleh: {_value.GetType()}, {_valueString}");
editor.AddAttribute(j++, "Text", _valueString); editor.AddAttribute(j++, "Mask", "n6");
//editor.AddAttribute(j++, "Text", property.GetValue(Data)); editor.AddAttribute(j++, "ValueExpression", lambda);
var lambda2 = Expression.Lambda<Func<double>>(Expression.Convert(access, typeof(string)));
editor.AddAttribute(j++, "TextExpression", lambda2);
editor.AddAttribute(j++, "CssClass", "form-field"); editor.AddAttribute(j++, "CssClass", "form-field");
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<System.String>(this, str => { property.SetValue(Data, str); })); editor.AddAttribute(j++, "ValueChanged", EventCallback.Factory.Create<System.Double>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent(); editor.CloseComponent();
break; break;
} }
else else if (property.PropertyType == typeof(int))
{
editor.OpenComponent<DxMaskedInput<int>>(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<System.Int32>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
}
else if (property.PropertyType == typeof(string) && property.Name == "Occupation")
{ {
editor.OpenComponent<DxComboBox<String, String>>(j); editor.OpenComponent<DxComboBox<String, String>>(j);
@ -142,6 +206,10 @@ namespace TIAMSharedUI.Pages.Components
editor.CloseComponent(); editor.CloseComponent();
break; break;
} }
else if (property.PropertyType == typeof(TransferDestination))
{
}
} }
case DataType.MultilineText: case DataType.MultilineText:
@ -160,21 +228,59 @@ namespace TIAMSharedUI.Pages.Components
} }
}))); })));
layoutItemBuilder.CloseComponent(); //close dxformlayoutitem
if (j < propertyList.Length - 1)
{
layoutItemBuilder.OpenComponent<DxButton>(i++);
layoutItemBuilder.AddAttribute(i++, "Click", EventCallback.Factory.Create<MouseEventArgs>(this, OnNext));
layoutItemBuilder.AddAttribute(i++, "SubmitFormOnClick", false);
layoutItemBuilder.AddAttribute(i++, "CssClass", "btn btn-primary mt-3");
layoutItemBuilder.AddAttribute(i++, "Text", "Next");
layoutItemBuilder.CloseComponent(); layoutItemBuilder.CloseComponent();
}
if (j > 0)
{
layoutItemBuilder.OpenComponent<DxButton>(i++);
layoutItemBuilder.AddAttribute(i++, "Click", EventCallback.Factory.Create<MouseEventArgs>(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.OpenElement(i++, "div");
layoutItemBuilder.AddAttribute(i++, "class", "text-danger"); layoutItemBuilder.AddAttribute(i++, "class", "text-danger");
layoutItemBuilder.OpenComponent(i++, typeof(ValidationMessage<>).MakeGenericType(property.PropertyType)); layoutItemBuilder.OpenComponent(i++, typeof(ValidationMessage<>).MakeGenericType(property.PropertyType));
layoutItemBuilder.AddAttribute(i++, "For", lambda); layoutItemBuilder.AddAttribute(i++, "For", lambda);
layoutItemBuilder.CloseComponent(); layoutItemBuilder.CloseComponent();
layoutItemBuilder.CloseElement(); layoutItemBuilder.CloseElement();
logToBrowserConsole.LogToBC($"loop {j}, {propertyList.Length}");
j++;
} }
layoutItemBuilder.OpenComponent<DxFormLayoutItem>(i++); layoutItemBuilder.OpenComponent<DxFormLayoutItem>(i++);
layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<Object>)((context) => ((editor) => layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<Object>)((context) => ((editor) =>
{ {
logToBrowserConsole.LogToBC($"Submit button {CurrentStep}, {propertyList.Length}");
editor.OpenComponent<DxButton>(i++); editor.OpenComponent<DxButton>(i++);
editor.AddAttribute(i++, "SubmitFormOnClick", true); editor.AddAttribute(i++, "SubmitFormOnClick", true);
editor.AddAttribute(i++, "Text", "Bleh"); editor.AddAttribute(i++, "Text", "Submit");
editor.AddAttribute(i++, "CssClass", "btn btn-primary mt-3");
if (CurrentStep == propertyList.Length-1)
{
editor.AddAttribute(i++, "Visible", true);
}
else
{
editor.AddAttribute(i++, "Visible", false);
}
editor.OpenElement(i++, "span");
editor.AddAttribute(i++, "class", spinnerClass);
editor.CloseElement();
editor.CloseComponent(); editor.CloseComponent();
}))); })));
@ -183,124 +289,7 @@ namespace TIAMSharedUI.Pages.Components
formLayoutBuilder.CloseComponent(); formLayoutBuilder.CloseComponent();
}; };
public RenderFragment CreateDynamicTest() => formLayoutBuilder =>
{
logToBrowserConsole.LogToBC("Hellooooo");
var propertyList = typeof(TransferDestination).GetProperties();
//var propertyList = typeof(TestUserData).GetProperties();
formLayoutBuilder.OpenComponent<StepComponent>(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<DxFormLayoutItem>(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<Object>)((context) => ((editor) =>
{
var j = 0;
switch (attrList.DataType)
{
case DataType.Text:
{
editor.OpenComponent<DxTextBox>(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<System.String>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
}
case DataType.Password:
{
editor.OpenComponent<DxTextBox>(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<System.String>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
}
case DataType.PhoneNumber:
{
editor.OpenComponent<DxMaskedInput<String>>(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<System.String>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
}
case DataType.Date:
{
editor.OpenComponent<DxDateEdit<DateTime>>(j);
editor.AddAttribute(j++, "Date", property.GetValue(Data));
editor.AddAttribute(j++, "DateExpression", lambda);
editor.AddAttribute(j++, "DateChanged", EventCallback.Factory.Create<System.DateTime>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
}
case DataType.Custom:
{
editor.OpenComponent<DxComboBox<String, String>>(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<System.String>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
}
case DataType.MultilineText:
{
editor.OpenComponent<DxMemo>(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<System.String>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
break;
}
default:
break;
}
})));
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<DxFormLayoutItem>(i++);
layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<Object>)((context) => ((editor) =>
{
editor.OpenComponent<DxButton>(i++);
editor.AddAttribute(i++, "SubmitFormOnClick", true);
editor.AddAttribute(i++, "Text", "Bleh");
editor.CloseComponent();
})));
layoutItemBuilder.CloseComponent();
}));
formLayoutBuilder.CloseComponent();
};
} }
} }

View File

@ -36,7 +36,7 @@ namespace TIAMSharedUI.Pages.Components
IEnumerable<CultureInfo> Data { get; set; } IEnumerable<CultureInfo> Data { get; set; }
[Parameter] [Parameter]
public EventCallback<AuctionBidModel> LanguageChanged { get; set; } public EventCallback<string> LanguageChanged { get; set; }
private Task<string>? GetCurrentSettings() private Task<string>? GetCurrentSettings()
{ {

View File

@ -1,4 +1,5 @@
@using TIAMWebApp.Shared.Application.Models.PageModels; @using TIAMWebApp.Shared.Application.Models.PageModels;
@using TIAMWebApp.Shared.Application.Utility;
<EditForm Model="@regModel" OnValidSubmit="GoToNextStep"> <EditForm Model="@regModel" OnValidSubmit="GoToNextStep">
<DataAnnotationsValidator /> <DataAnnotationsValidator />
@ -44,7 +45,8 @@
IEnumerable<char> PredefinedPlaceholders { get; set; } = new List<char>() { '_', '#' }; IEnumerable<char> PredefinedPlaceholders { get; set; } = new List<char>() { '_', '#' };
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; MaskAutoCompleteMode AutoCompleteMode { get; set; } = MaskAutoCompleteMode.Strong;
char Placeholder { get; set; } = '_'; char Placeholder { get; set; } = '_';
bool PlaceholderVisible { get; set; } = false; bool PlaceholderVisible { get; set; } = false;

View File

@ -1,4 +1,5 @@
@using TIAMWebApp.Shared.Application.Models.PageModels; @using TIAMWebApp.Shared.Application.Models.PageModels;
@using TIAMWebApp.Shared.Application.Utility;
<h3>Step 2: Phone Number</h3> <h3>Step 2: Phone Number</h3>
<EditForm Model="@regModel" OnValidSubmit="GoToNextStep"> <EditForm Model="@regModel" OnValidSubmit="GoToNextStep">
@ -46,6 +47,9 @@
[Parameter] [Parameter]
public EventCallback<RegistrationModel> RegModelChanged { get; set; } public EventCallback<RegistrationModel> 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 = '_'; char Placeholder = '_';
private string spinnerClass = ""; private string spinnerClass = "";

View File

@ -2,7 +2,7 @@
<PageTitle>Service provider</PageTitle> <PageTitle>Service provider</PageTitle>
<section class="h-100"> <section class="h-100">
<div class="container-fluid h-100 p-0"> <div class="container h-100 p-0">
<div class="row d-flex justify-content-center align-items-center h-100"> <div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12"> <div class="col-12">
<div> <div>

View File

@ -1,14 +1,22 @@
@page "/dbtest" @page "/dbtest"
@using TIAMSharedUI.Pages.Components @using TIAMSharedUI.Pages.Components
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
@using TIAMWebApp.Shared.Application.Utility
@inject LogToBrowserConsole logToBrowserConsole
<h3>TestPage</h3> <h3>TestPage</h3>
<div class="container mt-3">
<ChooseDestination></ChooseDestination> <ChooseDestination></ChooseDestination>
<hr/> <hr/>
<DbTestComponent></DbTestComponent> <DbTestComponent></DbTestComponent>
<InputWizard></InputWizard> <InputWizard Data=@myModel onSubmit="SubmitForm"></InputWizard>
</div>
@code { @code {
public TransferDestinationWizardModel myModel = new TransferDestinationWizardModel();
public void SubmitForm(object Result)
{
logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}");
}
} }

View File

@ -17,566 +17,16 @@
<div class="container-fluid"> <div class="container-fluid">
@{
if(userType == 4)
{
<!--App admin--> <!--App admin-->
<div class="row py-3">
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Transfers</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>New</h5>
<p>12</p>
<h5>Scheduled</h5>
<p>182</p>
<h5>Finished</h5>
<p>15665</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage transgfers</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Service providers</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>Guides</h5>
<p>32</p>
<h5>Hotels</h5>
<p>82</p>
<h5>Restaurants</h5>
<p>15</p>
<h5>Transfer company</h5>
<p>1</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage service providers</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Finances</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>Income</h5>
<p>$32 456</p>
<h5>Comission to be paid</h5>
<p>$5 345</p>
<h5>Service fees to be paid</h5>
<p>$23 871</p>
<h5>Revenue</h5>
<p>$3 240</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage service providers</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Affiliates</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>Top affiliate</h5>
<p>Hotel Bambara</p>
<h5>Comission Earned</h5>
<p>$1 315</p>
<hr />
<h5>Top referred item</h5>
<p>Buda castle tour</p>
<hr />
<h5>Level 1 affiliates</h5>
<p>132</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage affiliates</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class="col-12 col-xl-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Hotel details</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<DxGrid Data="@AffiliateData">
<Columns>
<DxGridDataColumn FieldName="AffiliateId" Width="5%" />
<DxGridDataColumn FieldName="IncomeThisMonth" Width="15%" />
<DxGridDataColumn FieldName="IncomeAlltime" Width="15%" />
<DxGridDataColumn FieldName="CompanyName" />
<DxGridDataColumn FieldName="Status" Width="10%" />
</Columns>
</DxGrid>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class="col-12 col-xl-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Population Data</span>
<p class="text-muted mb-0">12,March 2020 </p>
</div>
<div>
<h6 class="mb-0"> <a href="#">View source</a> </h6>
</div>
</div>
</div>
<div class="card-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<DxChart T="PopulationAgeStructureItem"
Data="@ChartsData"
Width="100%" Height="300px">
<DxChartTitle Text="Population: Age Structure">
<DxChartSubTitle Text="Data Estimate for 2020" />
</DxChartTitle>
<DxChartBarSeries Name="0-14 years"
T="PopulationAgeStructureItem"
TArgument="string"
TValue="int"
ArgumentField="pasi => pasi.Country"
ValueField="pasi => pasi.Population"
SummaryMethod="Enumerable.Sum"
Filter='pasi => pasi.AgeGroup == "0-14 years"' />
<DxChartBarSeries Name="15-64 years"
T="PopulationAgeStructureItem"
TArgument="string"
TValue="int"
ArgumentField="pasi => pasi.Country"
ValueField="pasi => pasi.Population"
SummaryMethod="Enumerable.Sum"
Filter='pasi => pasi.AgeGroup == "15-64 years"' />
<DxChartBarSeries Name="65 years and older"
T="PopulationAgeStructureItem"
TArgument="string"
TValue="int"
ArgumentField="pasi => pasi.Country"
ValueField="pasi => pasi.Population"
SummaryMethod="Enumerable.Sum"
Filter='pasi => pasi.AgeGroup == "65 years and older"' />
<DxChartLegend Position="RelativePosition.Outside"
HorizontalAlignment="HorizontalAlignment.Center"
VerticalAlignment="VerticalEdge.Bottom" />
<DxChartTooltip Enabled="true"
Position="RelativePosition.Outside">
<div style="margin: 0.75rem">
<div class="fw-bold">@context.Point.Argument</div>
<div>Age Group: @context.Point.SeriesName</div>
<div>Population: @($"{context.Point.Value:N0}")</div>
</div>
</DxChartTooltip>
</DxChart>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Affiliates</span>
<p class="text-muted mb-0">Details</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<style>
.dxbl-grid {
--dxbl-grid-font-family: inherit;
--dxbl-grid-font-size: 0.75rem;
--dxbl-grid-line-height: 1.4285;
--dxbl-grid-min-width: 240px;
--dxbl-grid-bg: #e7e6f7;
--dxbl-grid-color: #58457b;
}
</style>
<DxGrid Data="@Data">
<Columns>
<DxGridDataColumn FieldName="CompanyName" AllowSort="true" />
<DxGridDataColumn FieldName="ContactName" />
<DxGridDataColumn FieldName="ContactTitle" Width="3%" />
<DxGridDataColumn FieldName="Country" Width="10%" />
<DxGridDataColumn FieldName="City" Width="10%" />
<DxGridDataColumn FieldName="Address" />
<DxGridDataColumn FieldName="Phone" Width="10%" />
</Columns>
</DxGrid>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
</div>
<SysAdminComponent></SysAdminComponent>
<!-- App admin end--> <!-- App admin end-->
<!-- Hotel admin-->
}
else if(userType == 1)
{
<div class="row py-3">
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Hotel details</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<div class="flex-fill">
<h5 class="bold">Your QR code</h5>
<p class="text-muted"> Use this in printed material, to gain referrals</p>
</div>
<div>
<img class="align-self-center img-fluid"
src="_content/TIAMSharedUI/images/myqr.png" width="128">
</div>
</div>
<div class="d-flex flex-row mb-4 pb-2">
<h4> Some <span class="small text-muted"> conclusion </span></h4>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">My orders</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<DxGrid Data="@OrderData">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D" MinWidth="100">
<CellDisplayTemplate>
<a class="d-block text-left" href="transferdetails">@context.Value</a>
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Income" Width="15%" />
<DxGridDataColumn FieldName="TransactionId" Width="15%" />
<DxGridDataColumn FieldName="Status" Width="10%" />
</Columns>
</DxGrid>
</div>
<div class="d-flex flex-row mb-4 pb-2">
<h4> Some <span class="small text-muted"> conclusion </span></h4>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Hotel details</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Panel title</span>
<p class="text-muted mb-0">Subtitle</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<div class="flex-fill">
<h5 class="bold">Some info</h5>
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
</div>
<div>
<!--img class="align-self-center img-fluid"
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
</div>
</div>
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
<li class="step0 active" id="step1">
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
</li>
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
<li class="step0 text-muted text-end" id="step3">
<span style="margin-right: 22px;">FINISHED</span>
</li>
</ul>
<div class="d-flex flex-row mb-4 pb-2">
<h4> Some <span class="small text-muted"> conclusion </span></h4>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Affiliates</span>
<p class="text-muted mb-0">Details</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<style>
.dxbl-grid {
--dxbl-grid-font-family: inherit;
--dxbl-grid-font-size: 0.75rem;
--dxbl-grid-line-height: 1.4285;
--dxbl-grid-min-width: 240px;
--dxbl-grid-bg: #e7e6f7;
--dxbl-grid-color: #58457b;
}
</style>
<DxGrid Data="@Data">
<Columns>
<DxGridDataColumn FieldName="CompanyName" AllowSort="true" />
<DxGridDataColumn FieldName="ContactName" />
<DxGridDataColumn FieldName="ContactTitle" Width="3%" />
<DxGridDataColumn FieldName="Country" Width="10%" />
<DxGridDataColumn FieldName="City" Width="10%" />
<DxGridDataColumn FieldName="Address" />
<DxGridDataColumn FieldName="Phone" Width="10%" />
</Columns>
</DxGrid>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Hotel admin end-->
}
}
<hr/>
<HotelComponent></HotelComponent>
<!-- Stats admin--> <!-- Stats admin-->
@ -745,12 +195,8 @@
@code { @code {
object? OrderData { get; set; }
object? AffiliateData { get; set; }
IEnumerable<PopulationAgeStructureItem>? ChartsData;
object? Data { get; set; }
bool isUserLoggedIn; bool isUserLoggedIn;
int userType = 0; int userType = 0;
@ -762,72 +208,9 @@
{ {
base.OnInitialized(); 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; }
} }

View File

@ -0,0 +1,5 @@
<h3>GuideComponent</h3>
@code {
}

View File

@ -0,0 +1,234 @@
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models;
@using TIAMWebApp.Shared.Application.Interfaces;
@using TIAMSharedUI.Pages.User;
<div class="row py-3">
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Hotel details</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<div class="flex-fill">
<h5 class="bold">Your QR code</h5>
<p class="text-muted"> Use this in printed material, to gain referrals</p>
</div>
<div>
<img class="align-self-center img-fluid"
src="_content/TIAMSharedUI/images/myqr.png" width="128">
</div>
</div>
<div class="d-flex flex-row mb-4 pb-2">
<h4> Some <span class="small text-muted"> conclusion </span></h4>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">My orders</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<DxGrid Data="@OrderData">
<Columns>
<DxGridDataColumn FieldName="Date" DisplayFormat="D" MinWidth="100">
<CellDisplayTemplate>
<a class="d-block text-left" href="transferdetails">@context.Value</a>
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Income" Width="15%" />
<DxGridDataColumn FieldName="TransactionId" Width="15%" />
<DxGridDataColumn FieldName="Status" Width="10%" />
</Columns>
</DxGrid>
</div>
<div class="d-flex flex-row mb-4 pb-2">
<h4> Some <span class="small text-muted"> conclusion </span></h4>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Hotel details</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Panel title</span>
<p class="text-muted mb-0">Subtitle</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<div class="flex-fill">
<h5 class="bold">Some info</h5>
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
</div>
<div>
<!--img class="align-self-center img-fluid"
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
</div>
</div>
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
<li class="step0 active" id="step1">
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
</li>
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
<li class="step0 text-muted text-end" id="step3">
<span style="margin-right: 22px;">FINISHED</span>
</li>
</ul>
<div class="d-flex flex-row mb-4 pb-2">
<h4> Some <span class="small text-muted"> conclusion </span></h4>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Affiliates</span>
<p class="text-muted mb-0">Details</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<style>
.dxbl-grid {
--dxbl-grid-font-family: inherit;
--dxbl-grid-font-size: 0.75rem;
--dxbl-grid-line-height: 1.4285;
--dxbl-grid-min-width: 240px;
--dxbl-grid-bg: #e7e6f7;
--dxbl-grid-color: #58457b;
}
</style>
<DxGrid Data="@Data">
<Columns>
<DxGridDataColumn FieldName="CompanyName" AllowSort="true" />
<DxGridDataColumn FieldName="ContactName" />
<DxGridDataColumn FieldName="ContactTitle" Width="3%" />
<DxGridDataColumn FieldName="Country" Width="10%" />
<DxGridDataColumn FieldName="City" Width="10%" />
<DxGridDataColumn FieldName="Address" />
<DxGridDataColumn FieldName="Phone" Width="10%" />
</Columns>
</DxGrid>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
</div>
@code {
}

View File

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

View File

@ -1,4 +1,7 @@
<h3>Properties</h3> @page "/user/properties"
@using TIAMSharedUI.Shared
@layout AdminLayout
<h3>Properties</h3>
@code { @code {

View File

@ -0,0 +1,280 @@
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models;
@using TIAMWebApp.Shared.Application.Interfaces;
<div class="row py-3">
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Transfers</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>New</h5>
<p>12</p>
<h5>Scheduled</h5>
<p>182</p>
<h5>Finished</h5>
<p>15665</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage transgfers</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Service providers</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>Guides</h5>
<p>32</p>
<h5>Hotels</h5>
<p>82</p>
<h5>Restaurants</h5>
<p>15</p>
<h5>Transfer company</h5>
<p>1</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage service providers</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Finances</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>Income</h5>
<p>$32 456</p>
<h5>Comission to be paid</h5>
<p>$5 345</p>
<h5>Service fees to be paid</h5>
<p>$23 871</p>
<h5>Revenue</h5>
<p>$3 240</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage service providers</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class=" col-12 col-xl-3 col-lg-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Affiliates</span>
<p class="text-muted mb-0">Summary</p>
</div>
<div>
<h6 class="mb-0"> <a href="#">All details</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<h5>Top affiliate</h5>
<p>Hotel Bambara</p>
<h5>Comission Earned</h5>
<p>$1 315</p>
<hr />
<h5>Top referred item</h5>
<p>Buda castle tour</p>
<hr />
<h5>Level 1 affiliates</h5>
<p>132</p>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Manage affiliates</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class="col-12 col-xl-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Hotel details</span>
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
</div>
</div>
</div>
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<DxGrid Data="@AffiliateData">
<Columns>
<DxGridDataColumn FieldName="AffiliateId" Width="5%" />
<DxGridDataColumn FieldName="IncomeThisMonth" Width="15%" />
<DxGridDataColumn FieldName="IncomeAlltime" Width="15%" />
<DxGridDataColumn FieldName="CompanyName" />
<DxGridDataColumn FieldName="Status" Width="10%" />
</Columns>
</DxGrid>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
<div class="col-12 col-xl-6">
<div class="card card-admin" style="border-radius: 16px;">
<div class="card-header py-2 px-4">
<div class="d-flex justify-content-between align-items-center">
<div>
<span class="fw-bold text-body">Population Data</span>
<p class="text-muted mb-0">12,March 2020 </p>
</div>
<div>
<h6 class="mb-0"> <a href="#">View source</a> </h6>
</div>
</div>
</div>
<div class="card-body py-2 px-4">
<div class="d-flex flex-row mb-4 pb-2">
<DxChart T="PopulationAgeStructureItem"
Data="@ChartsData"
Width="100%" Height="300px">
<DxChartTitle Text="Population: Age Structure">
<DxChartSubTitle Text="Data Estimate for 2020" />
</DxChartTitle>
<DxChartBarSeries Name="0-14 years"
T="PopulationAgeStructureItem"
TArgument="string"
TValue="int"
ArgumentField="pasi => pasi.Country"
ValueField="pasi => pasi.Population"
SummaryMethod="Enumerable.Sum"
Filter='pasi => pasi.AgeGroup == "0-14 years"' />
<DxChartBarSeries Name="15-64 years"
T="PopulationAgeStructureItem"
TArgument="string"
TValue="int"
ArgumentField="pasi => pasi.Country"
ValueField="pasi => pasi.Population"
SummaryMethod="Enumerable.Sum"
Filter='pasi => pasi.AgeGroup == "15-64 years"' />
<DxChartBarSeries Name="65 years and older"
T="PopulationAgeStructureItem"
TArgument="string"
TValue="int"
ArgumentField="pasi => pasi.Country"
ValueField="pasi => pasi.Population"
SummaryMethod="Enumerable.Sum"
Filter='pasi => pasi.AgeGroup == "65 years and older"' />
<DxChartLegend Position="RelativePosition.Outside"
HorizontalAlignment="HorizontalAlignment.Center"
VerticalAlignment="VerticalEdge.Bottom" />
<DxChartTooltip Enabled="true"
Position="RelativePosition.Outside">
<div style="margin: 0.75rem">
<div class="fw-bold">@context.Point.Argument</div>
<div>Age Group: @context.Point.SeriesName</div>
<div>Population: @($"{context.Point.Value:N0}")</div>
</div>
</DxChartTooltip>
</DxChart>
</div>
</div>
<div class="card-footer py-2 px-4">
<div class="d-flex justify-content-between">
<a href="#!">Modify</a>
<div class="border-start h-100"></div>
</div>
</div>
</div>
</div>
</div>
@code {
}

View File

@ -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<PopulationAgeStructureItem>? 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; }
}
}

View File

@ -168,6 +168,15 @@ namespace TIAMSharedUI.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Admin.
/// </summary>
public static string NavMenu_Admin {
get {
return ResourceManager.GetString("NavMenu.Admin", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Home. /// Looks up a localized string similar to Home.
/// </summary> /// </summary>

View File

@ -153,6 +153,9 @@
<data name="LoginTitleText" xml:space="preserve"> <data name="LoginTitleText" xml:space="preserve">
<value>Lépjünk csak be!</value> <value>Lépjünk csak be!</value>
</data> </data>
<data name="NavMenu.Admin" xml:space="preserve">
<value>Adminisztráció</value>
</data>
<data name="NavMenu.Home" xml:space="preserve"> <data name="NavMenu.Home" xml:space="preserve">
<value>Főoldal</value> <value>Főoldal</value>
</data> </data>

View File

@ -153,6 +153,9 @@
<data name="LoginTitleText" xml:space="preserve"> <data name="LoginTitleText" xml:space="preserve">
<value>Let's get you inside!</value> <value>Let's get you inside!</value>
</data> </data>
<data name="NavMenu.Admin" xml:space="preserve">
<value>Admin</value>
</data>
<data name="NavMenu.Home" xml:space="preserve"> <data name="NavMenu.Home" xml:space="preserve">
<value>Home</value> <value>Home</value>
</data> </data>

View File

@ -2,15 +2,13 @@
@using TIAMWebApp.Shared.Application.Interfaces @using TIAMWebApp.Shared.Application.Interfaces
@using AyCode.Interfaces.StorageHandlers @using AyCode.Interfaces.StorageHandlers
@using Microsoft.Extensions.Localization @using Microsoft.Extensions.Localization
@inject ISecureStorageHandler SecureStorageHandler
@inject ISessionService sessionService;
@inject IStringLocalizer<MyResources> localizer
<nav class="navbar sticky-top navbar-expand-lg"> <nav class="navbar sticky-top navbar-expand-lg">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="#"><img height="25" src="_content/TIAMSharedUI/images/logo_wide.png" alt="TourIam Logo" title="TourIAm Logo" /></a> <a class="navbar-brand" href="#"><img height="25" src="_content/TIAMSharedUI/images/logo_wide.png" alt="TourIam Logo" title="TourIAm Logo" /></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <img src="_content/TIAMSharedUI/images/navbar-toggler.png" width="40" />
</button> </button>
<div class="collapse navbar-collapse" id="navbarSupportedContent"> <div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> <ul class="navbar-nav me-auto mb-2 mb-lg-0">
@ -55,6 +53,15 @@
</NavLink> </NavLink>
</li> </li>
} }
@if(hasProperty)
{
<li class="nav-item">
<NavLink class="nav-link" href="admin">
@localizer.GetString("NavMenu.Admin")
</NavLink>
</li>
}
<li class="nav-item"> <li class="nav-item">
<div class="btn-nav"> <div class="btn-nav">
<NavLink class="btn btn-primary btn-small navbar-btn" href="#" @onclick="SignOut"> <NavLink class="btn btn-primary btn-small navbar-btn" href="#" @onclick="SignOut">

View File

@ -1,15 +1,26 @@
using Microsoft.AspNetCore.Components; using AyCode.Interfaces.StorageHandlers;
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TIAMSharedUI.Resources;
using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Interfaces;
using TIAMWebApp.Shared.Application.Utility;
namespace TIAMSharedUI.Shared.Components namespace TIAMSharedUI.Shared.Components
{ {
public partial class Navbar : ComponentBase public partial class Navbar : ComponentBase
{ {
[Inject]
public ISecureStorageHandler SecureStorageHandler { get; set; }
[Inject]
public ISessionService sessionService { get; set; }
[Inject]
public IStringLocalizer<MyResources> localizer { get; set; }
[Inject] [Inject]
public NavigationManager navigationManager { get; set; } public NavigationManager navigationManager { get; set; }
@ -17,15 +28,20 @@ namespace TIAMSharedUI.Shared.Components
[Inject] [Inject]
public IComponentUpdateService componentUpdateService { get; set; } public IComponentUpdateService componentUpdateService { get; set; }
[Inject]
public LogToBrowserConsole logToBrowserConsole { get; set; }
private bool collapseNavMenu = true; private bool collapseNavMenu = true;
private bool myUser = false; private bool myUser = false;
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; private bool hasProperty = false;
//componentUpdateService.RefreshRequested += RefreshMe; //componentUpdateService.RefreshRequested += RefreshMe;
private void RefreshMe() private void RefreshMe()
{ {
logToBrowserConsole.LogToBC($"Navbar refresh called! {DateTime.Now} ");
OnInitialized();
StateHasChanged(); StateHasChanged();
} }
@ -49,15 +65,36 @@ namespace TIAMSharedUI.Shared.Components
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized(); base.OnInitialized();
componentUpdateService.RefreshRequested += RefreshMe;
logToBrowserConsole.LogToBC($"Navbar OnInit {DateTime.Now} ");
if (sessionService.User != null) if (sessionService.User != null)
{ {
myUser = true; myUser = true;
} }
else else
{ {
logToBrowserConsole.LogToBC($"Navbar myUser false! {DateTime.Now} ");
myUser = false; myUser = false;
} }
componentUpdateService.RefreshRequested += RefreshMe;
var _properties = sessionService.User?.HasProperties;
if (sessionService.User?.HasProperties != null)
{
if(_properties.Count > 0)
{
hasProperty = true;
}
else
{
hasProperty = false;
}
foreach (var property in _properties)
{
logToBrowserConsole.LogToBC($"First property: {property.Value} ");
}
}
} }
} }

View File

@ -1,4 +1,9 @@
.navbar-toggler { .navbar {
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}
.navbar-toggler {
background-color: rgba(255, 255, 255, 0.1); background-color: rgba(255, 255, 255, 0.1);
padding: 0px; padding: 0px;
} }

View File

@ -25,8 +25,13 @@
</div> </div>
<nav class="flex-column"> <nav class="flex-column">
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All"> <NavLink class="nav-link" href="index">
<!--span class="oi oi-home" aria-hidden="true"></span--> Home Home
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="user/properties">
Properties
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3"> <div class="nav-item px-3">
@ -50,7 +55,7 @@
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="fetchdata"> <NavLink class="nav-link" href="settings">
Settings Settings
</NavLink> </NavLink>
</div> </div>

View File

@ -20,6 +20,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Aycode.Blazor\AyCode.Blazor.Components\AyCode.Blazor.Components.csproj" /> <ProjectReference Include="..\..\Aycode.Blazor\AyCode.Blazor.Components\AyCode.Blazor.Components.csproj" />
<ProjectReference Include="..\..\Aycode.Blazor\AyCode.Blazor.Models\AyCode.Blazor.Models.csproj" /> <ProjectReference Include="..\..\Aycode.Blazor\AyCode.Blazor.Models\AyCode.Blazor.Models.csproj" />
<ProjectReference Include="..\TIAMResources\TIAM.Resources.csproj" />
<ProjectReference Include="..\TIAMWebApp\Shared\TIAMWebApp.Shared.Application.csproj" /> <ProjectReference Include="..\TIAMWebApp\Shared\TIAMWebApp.Shared.Application.csproj" />
</ItemGroup> </ItemGroup>

View File

@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop; using Microsoft.JSInterop;
using System.Net.Http.Json; using System.Net.Http.Json;
using TIAM.Database.DataLayers.Users; using TIAM.Database.DataLayers.Users;
using TIAM.Entities.Products;
using TIAM.Entities.ServiceProviders; using TIAM.Entities.ServiceProviders;
using TIAM.Entities.Users; using TIAM.Entities.Users;
using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Interfaces;
@ -72,6 +73,7 @@ namespace TIAMWebApp.Client.Services
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
var result = await response.Content.ReadFromJsonAsync<Dictionary<Guid, string>>(); var result = await response.Content.ReadFromJsonAsync<Dictionary<Guid, string>>();
logToBrowserConsole.LogToBC(result.FirstOrDefault().Value);
return result; return result;
} }
else else

View File

@ -35,21 +35,6 @@ namespace TIAMWebApp.Client.Services
} }
public List<RoleType> roleTypes = new List<RoleType>
{
new RoleType { Id = 1, RoleName = "Login" },
new RoleType { Id = 2, RoleName = "Member" },
new RoleType { Id = 4, RoleName = "Vip" },
new RoleType { Id = 8, RoleName = "Uvip" },
new RoleType { Id = 16, RoleName = "Volunteer" },
new RoleType { Id = 32, RoleName = "Guide" },
new RoleType { Id = 64, RoleName = "Protector" },
new RoleType { Id = 128, RoleName = "Admin" },
new RoleType { Id = 256, RoleName = "SuperAdmin" },
new RoleType { Id = 512, RoleName = "God" }
};
public async Task<UserSessionModel> IsLoggedInAsync(Guid id) public async Task<UserSessionModel> IsLoggedInAsync(Guid id)
{ {
UserSessionModel User = null; UserSessionModel User = null;
@ -58,8 +43,17 @@ namespace TIAMWebApp.Client.Services
if (dbUser != null) if (dbUser != null)
{ {
var a = dbUser.UserProductMappings.FirstOrDefault().Product;
if (a != null)
logToBrowserConsole.LogToBC($"{a.Name}");
//get user's properties //get user's properties
var hasProperties = await serviceProviderDataService.GetPropertiesByOwnerIdAsync(dbUser.Id); var hasProperties = await serviceProviderDataService.GetPropertiesByOwnerIdAsync(dbUser.Id);
if (hasProperties != null)
logToBrowserConsole.LogToBC($"{hasProperties.Count} properties found");
//create user session model //create user session model
User = new UserSessionModel(dbUser.Id, UserType.User, dbUser.EmailAddress, hasProperties, 1); User = new UserSessionModel(dbUser.Id, UserType.User, dbUser.EmailAddress, hasProperties, 1);
return User; return User;
@ -204,7 +198,7 @@ namespace TIAMWebApp.Client.Services
} }
public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel) /*public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel)
{ {
//TODO: finish this //TODO: finish this
//get the userModel's roles //get the userModel's roles
@ -222,7 +216,7 @@ namespace TIAMWebApp.Client.Services
} }
return Task.FromResult(userRoleTypes); return Task.FromResult(userRoleTypes);
} }*/
} }
} }

View File

@ -107,8 +107,7 @@ namespace TIAMWebApp.Server.Controllers
[Route("GetServiceProvidersByOwnerId")] [Route("GetServiceProvidersByOwnerId")]
[Tags("Finished", "ServiceProvider")] [Tags("Finished", "ServiceProvider")]
public async Task<Dictionary<Guid, string>> GetServiceProvidersByOwnerId([FromBody] Guid ownerId)
public async Task<Dictionary<Guid, string>> GetServiceProvidersByOwnerId(Guid ownerId)
{ {
Console.WriteLine($"GetServiceProvidersByOwnerId called with ownerId: {ownerId}"); Console.WriteLine($"GetServiceProvidersByOwnerId called with ownerId: {ownerId}");

View File

@ -26,45 +26,45 @@ namespace TIAMWebApp.Server.Controllers
}; };
private Product[] GetMockProducts(int SupplierId) private ProductDTO[] GetMockProducts(int SupplierId)
{ {
return Products.Where(p => p.SupplierId == SupplierId).ToArray(); return Products.Where(p => p.SupplierId == SupplierId).ToArray();
} }
private static readonly Product[] Products = new Product[] private static readonly ProductDTO[] Products = new ProductDTO[]
{ {
new Product{ Id = 1, ProductName = "Product1", SupplierId = 1, CategoryId = 1}, new ProductDTO{ Id = 1, ProductName = "Product1", SupplierId = 1, CategoryId = 1},
new Product{ Id = 2, ProductName = "Product2", SupplierId = 1, CategoryId = 3}, new ProductDTO{ Id = 2, ProductName = "Product2", SupplierId = 1, CategoryId = 3},
new Product{ Id = 3, ProductName = "Product3", SupplierId = 1, CategoryId = 7}, new ProductDTO{ Id = 3, ProductName = "Product3", SupplierId = 1, CategoryId = 7},
new Product{ Id = 4, ProductName = "Product4", SupplierId = 2, CategoryId = 1}, new ProductDTO{ Id = 4, ProductName = "Product4", SupplierId = 2, CategoryId = 1},
new Product{ Id = 5, ProductName = "Product5", SupplierId = 2, CategoryId = 2}, new ProductDTO{ Id = 5, ProductName = "Product5", SupplierId = 2, CategoryId = 2},
new Product{ Id = 6, ProductName = "Product6", SupplierId = 2, CategoryId = 3}, new ProductDTO{ Id = 6, ProductName = "Product6", SupplierId = 2, CategoryId = 3},
new Product{ Id = 7, ProductName = "Product7", SupplierId = 3, CategoryId = 4}, new ProductDTO{ Id = 7, ProductName = "Product7", SupplierId = 3, CategoryId = 4},
new Product{ Id = 8, ProductName = "Product8", SupplierId = 3, CategoryId = 5}, new ProductDTO{ Id = 8, ProductName = "Product8", SupplierId = 3, CategoryId = 5},
new Product{ Id = 9, ProductName = "Product9", SupplierId = 3, CategoryId = 6}, new ProductDTO{ Id = 9, ProductName = "Product9", SupplierId = 3, CategoryId = 6},
new Product{ Id = 10, ProductName = "Product10", SupplierId = 4, CategoryId = 7}, new ProductDTO{ Id = 10, ProductName = "Product10", SupplierId = 4, CategoryId = 7},
new Product{ Id = 11, ProductName = "Product11", SupplierId = 4, CategoryId = 3}, new ProductDTO{ Id = 11, ProductName = "Product11", SupplierId = 4, CategoryId = 3},
new Product{ Id = 12, ProductName = "Product12", SupplierId = 4, CategoryId = 6}, new ProductDTO{ Id = 12, ProductName = "Product12", SupplierId = 4, CategoryId = 6},
new Product{ Id = 13, ProductName = "Product13", SupplierId = 5, CategoryId = 5}, new ProductDTO{ Id = 13, ProductName = "Product13", SupplierId = 5, CategoryId = 5},
new Product{ Id = 14, ProductName = "Product14", SupplierId = 5, CategoryId = 1}, new ProductDTO{ Id = 14, ProductName = "Product14", SupplierId = 5, CategoryId = 1},
new Product{ Id = 15, ProductName = "Product15", SupplierId = 5, CategoryId = 8}, new ProductDTO{ Id = 15, ProductName = "Product15", SupplierId = 5, CategoryId = 8},
new Product{ Id = 16, ProductName = "Product16", SupplierId = 6, CategoryId = 6}, new ProductDTO{ Id = 16, ProductName = "Product16", SupplierId = 6, CategoryId = 6},
new Product{ Id = 17, ProductName = "Product17", SupplierId = 6, CategoryId = 6}, new ProductDTO{ Id = 17, ProductName = "Product17", SupplierId = 6, CategoryId = 6},
new Product{ Id = 18, ProductName = "Product18", SupplierId = 6, CategoryId = 9}, new ProductDTO{ Id = 18, ProductName = "Product18", SupplierId = 6, CategoryId = 9},
new Product{ Id = 19, ProductName = "Product19", SupplierId = 7, CategoryId = 3}, new ProductDTO{ Id = 19, ProductName = "Product19", SupplierId = 7, CategoryId = 3},
new Product{ Id = 20, ProductName = "Product20", SupplierId = 7, CategoryId = 2}, new ProductDTO{ Id = 20, ProductName = "Product20", SupplierId = 7, CategoryId = 2},
new Product{ Id = 21, ProductName = "Product21", SupplierId = 7, CategoryId = 1}, new ProductDTO{ Id = 21, ProductName = "Product21", SupplierId = 7, CategoryId = 1},
new Product{ Id = 22, ProductName = "Product22", SupplierId = 8, CategoryId = 4}, new ProductDTO{ Id = 22, ProductName = "Product22", SupplierId = 8, CategoryId = 4},
new Product{ Id = 23, ProductName = "Product23", SupplierId = 8, CategoryId = 5}, new ProductDTO{ Id = 23, ProductName = "Product23", SupplierId = 8, CategoryId = 5},
new Product{ Id = 24, ProductName = "Product24", SupplierId = 8, CategoryId = 6}, new ProductDTO{ Id = 24, ProductName = "Product24", SupplierId = 8, CategoryId = 6},
new Product{ Id = 25, ProductName = "Product25", SupplierId = 9, CategoryId = 7}, new ProductDTO{ Id = 25, ProductName = "Product25", SupplierId = 9, CategoryId = 7},
new Product{ Id = 26, ProductName = "Product26", SupplierId = 9, CategoryId = 3}, new ProductDTO{ Id = 26, ProductName = "Product26", SupplierId = 9, CategoryId = 3},
new Product{ Id = 27, ProductName = "Product27", SupplierId = 9, CategoryId = 6}, new ProductDTO{ Id = 27, ProductName = "Product27", SupplierId = 9, CategoryId = 6},
new Product{ Id = 28, ProductName = "Product28", SupplierId = 10, CategoryId = 5}, new ProductDTO{ Id = 28, ProductName = "Product28", SupplierId = 10, CategoryId = 5},
new Product{ Id = 29, ProductName = "Product29", SupplierId = 10, CategoryId = 1}, new ProductDTO{ Id = 29, ProductName = "Product29", SupplierId = 10, CategoryId = 1},
new Product{ Id = 30, ProductName = "Product30", SupplierId = 10, CategoryId = 8}, new ProductDTO{ Id = 30, ProductName = "Product30", SupplierId = 10, CategoryId = 8},
new Product{ Id = 31, ProductName = "Product31", SupplierId = 11, CategoryId = 6}, new ProductDTO{ Id = 31, ProductName = "Product31", SupplierId = 11, CategoryId = 6},
new Product{ Id = 32, ProductName = "Product32", SupplierId = 11, CategoryId = 6}, new ProductDTO{ Id = 32, ProductName = "Product32", SupplierId = 11, CategoryId = 6},
}; };

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using TIAM.Entities.Products;
using TIAM.Entities.ServiceProviders; using TIAM.Entities.ServiceProviders;
using TIAM.Entities.Users; using TIAM.Entities.Users;
using TIAMWebApp.Shared.Application.Models; using TIAMWebApp.Shared.Application.Models;

View File

@ -19,7 +19,7 @@ namespace TIAMWebApp.Shared.Application.Interfaces
public Task<(bool isSuccess, string ErrorMessage)> CreateUser(RegistrationModel regModel); public Task<(bool isSuccess, string ErrorMessage)> CreateUser(RegistrationModel regModel);
public Task<string> TestUserApi(int Param); public Task<string> TestUserApi(int Param);
public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel); //public Task<Dictionary<int, string>> GetUserRolesAsync(UserModel userModel);
public Task<IEnumerable<User>?> GetUsersAsync(); public Task<IEnumerable<User>?> GetUsersAsync();
public Task<User?> GetUserByEmailAsync(string email); public Task<User?> GetUserByEmailAsync(string email);

View File

@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
{
public class RegisterWizardModel
{
[Required(ErrorMessage = "The Email value should be specified.")]
[DataType(DataType.EmailAddress)]
[Display(Name = "Email", ResourceType = typeof(TIAM.Resources.TIAMResources))]
public string Email { get; set; }
public string Password { get; set; }
public string PasswordConfirmation { get; set; }
public RegisterWizardModel() { }
public RegisterWizardModel(string email, string password, string passwordConfirmation)
{
Email = email;
Password = password;
PasswordConfirmation = passwordConfirmation;
}
}
[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}))$");
}
}
}

View File

@ -0,0 +1,45 @@
using AyCode.Entities.Locations;
using AyCode.Interfaces.TimeStampInfo;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using TIAM.Resources;
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
{
public class TransferDestinationWizardModel
{
//[Required(ErrorMessage = "The Username value should be specified.")]
[DataType(DataType.Text)]
[Display(Name = ResourceKeys.DestinationName, ResourceType = typeof(TIAMResources))]
public string? Name { get; set; }
[DataType(DataType.MultilineText)]
[Display(Name = ResourceKeys.DestinationInfo, ResourceType = typeof(TIAMResources))]
public string? Description { get; set; }
[DataType(DataType.Text)]
[Display(Name = ResourceKeys.DestinationAddress, ResourceType = typeof(TIAMResources))]
public string? Address { get; set; }
[DataType("Latitude")]
[Display(Name = "Destination latitude")]
public double Latitude { get; set; }
[DataType("Longitude")]
[Display(Name = "Destination longitude")]
public double Longitude { get; set; }
public TransferDestinationWizardModel() { }
public TransferDestinationWizardModel(double latitude, double longitude, string address) : this(Guid.NewGuid(), latitude, longitude, address) { }
public TransferDestinationWizardModel(Guid id, double latitude, double longitude, string address) { }
public TransferDestinationWizardModel(Guid id, string name, double latitude, double longitude, string address) { }
public TransferDestinationWizardModel(Guid id, string name, string description, double latitude, double longitude, string address)
{ }
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace TIAMWebApp.Shared.Application.Models namespace TIAMWebApp.Shared.Application.Models
{ {
public class Product public class ProductDTO
{ {
public int Id { get; set; } public int Id { get; set; }
public string ProductName { get; set; } public string ProductName { get; set; }

View File

@ -19,7 +19,7 @@ namespace TIAMWebApp.Shared.Application.Models
public string Phone { get; set; } public string Phone { get; set; }
public string Fax { get; set; } public string Fax { get; set; }
public string HomePage { get; set; } public string HomePage { get; set; }
public virtual ICollection<Product>? Products { get; set; } public virtual ICollection<ProductDTO>? Products { get; set; }
//constructor here //constructor here
public Supplier(int supplierId, string companyName, string contactName, string contactTitle, string address, string city, string region, string postalCode, string country, string phone, string fax, string homePage) public Supplier(int supplierId, string companyName, string contactName, string contactTitle, string address, string city, string region, string postalCode, string country, string phone, string fax, string homePage)

View File

@ -13,6 +13,7 @@
<ItemGroup> <ItemGroup>
<Folder Include="Models\DTO\" /> <Folder Include="Models\DTO\" />
<Folder Include="Models\ServerSide\Messages\" /> <Folder Include="Models\ServerSide\Messages\" />
<Folder Include="NewFolder\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -25,6 +26,7 @@
<ProjectReference Include="..\..\TIAM.Database\TIAM.Database.csproj" /> <ProjectReference Include="..\..\TIAM.Database\TIAM.Database.csproj" />
<ProjectReference Include="..\..\TIAM.Entities.Server\TIAM.Entities.Server.csproj" /> <ProjectReference Include="..\..\TIAM.Entities.Server\TIAM.Entities.Server.csproj" />
<ProjectReference Include="..\..\TIAM.Entities\TIAM.Entities.csproj" /> <ProjectReference Include="..\..\TIAM.Entities\TIAM.Entities.csproj" />
<ProjectReference Include="..\..\TIAMResources\TIAM.Resources.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TIAMWebApp.Shared.Application.Utility
{
public class RenderWizard
{
}
}

View File

@ -0,0 +1,8 @@
public static class ResourceKeys
{
public const string DestinationName = "DestinationName";
public const string DestinationInfo = "DestinationInfo";
public const string DestinationAddress = "DestinationAddress";
public const string Test = "Test";
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TIAMWebApp.Shared.Application.Utility
{
public static class TIAMRegularExpressions
{
public const string EmailMask = "(\\w|[.-])+@(\\w|-)+\\.(\\w|-){2,4}";
public const string PhoneNumberMask = "\\+(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})";
}
}

View File

@ -33,6 +33,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AyCode.Blazor.Models", "..\
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AyCode.Blazor.Models.Server", "..\Aycode.Blazor\AyCode.Blazor.Models.Server\AyCode.Blazor.Models.Server.csproj", "{A36322E8-F485-455E-84AA-B911948B6702}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AyCode.Blazor.Models.Server", "..\Aycode.Blazor\AyCode.Blazor.Models.Server\AyCode.Blazor.Models.Server.csproj", "{A36322E8-F485-455E-84AA-B911948B6702}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TIAM.Resources", "TIAMResources\TIAM.Resources.csproj", "{2A300982-AA2E-4E62-97F2-6EF4C97939B2}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -101,6 +103,10 @@ Global
{A36322E8-F485-455E-84AA-B911948B6702}.Debug|Any CPU.Build.0 = Debug|Any CPU {A36322E8-F485-455E-84AA-B911948B6702}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A36322E8-F485-455E-84AA-B911948B6702}.Release|Any CPU.ActiveCfg = Release|Any CPU {A36322E8-F485-455E-84AA-B911948B6702}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A36322E8-F485-455E-84AA-B911948B6702}.Release|Any CPU.Build.0 = Release|Any CPU {A36322E8-F485-455E-84AA-B911948B6702}.Release|Any CPU.Build.0 = Release|Any CPU
{2A300982-AA2E-4E62-97F2-6EF4C97939B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2A300982-AA2E-4E62-97F2-6EF4C97939B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A300982-AA2E-4E62-97F2-6EF4C97939B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A300982-AA2E-4E62-97F2-6EF4C97939B2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE