CreateWizards

This commit is contained in:
Adam 2024-01-08 19:21:36 +01:00
parent c29cc3fcc1
commit f5301076f8
21 changed files with 495 additions and 237 deletions

View File

@ -123,6 +123,15 @@ namespace TIAM.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Send.
/// </summary>
public static string ButtonSend {
get {
return ResourceManager.GetString("ButtonSend", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Confirm Email.
/// </summary>
@ -240,6 +249,15 @@ namespace TIAM.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Html content.
/// </summary>
public static string HtmlContent {
get {
return ResourceManager.GetString("HtmlContent", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Login.
/// </summary>
@ -249,6 +267,24 @@ namespace TIAM.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to New message.
/// </summary>
public static string NewMessage {
get {
return ResourceManager.GetString("NewMessage", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Let&apos;s send them a message!.
/// </summary>
public static string NewMessageSubtitle {
get {
return ResourceManager.GetString("NewMessageSubtitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Passengers.
/// </summary>
@ -303,6 +339,15 @@ namespace TIAM.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Receiver Id.
/// </summary>
public static string ReceiverId {
get {
return ResourceManager.GetString("ReceiverId", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Register.
/// </summary>
@ -357,6 +402,15 @@ namespace TIAM.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Subject.
/// </summary>
public static string Subject {
get {
return ResourceManager.GetString("Subject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to This works!.
/// </summary>
@ -375,6 +429,15 @@ namespace TIAM.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Let&apos;s book a transfer!.
/// </summary>
public static string TransferSubtitle {
get {
return ResourceManager.GetString("TransferSubtitle", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New Transfer.
/// </summary>
@ -384,6 +447,15 @@ namespace TIAM.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Trip date.
/// </summary>
public static string TripDate {
get {
return ResourceManager.GetString("TripDate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Wizard.
/// </summary>

View File

@ -138,6 +138,9 @@
<data name="ButtonSave" xml:space="preserve">
<value>Mentés</value>
</data>
<data name="ButtonSend" xml:space="preserve">
<value>Küldés</value>
</data>
<data name="ConfirmEmail" xml:space="preserve">
<value>E-mail cím megerősítése</value>
</data>
@ -177,9 +180,18 @@
<data name="FullName" xml:space="preserve">
<value>Teljes név</value>
</data>
<data name="HtmlContent" xml:space="preserve">
<value>Html tartalom</value>
</data>
<data name="Login" xml:space="preserve">
<value>Belépés</value>
</data>
<data name="NewMessage" xml:space="preserve">
<value>Új üzenet</value>
</data>
<data name="NewMessageSubtitle" xml:space="preserve">
<value>Küldjünk neki egy üzenetet!</value>
</data>
<data name="NumberOfPassengers" xml:space="preserve">
<value>Utasok száma</value>
</data>
@ -198,6 +210,9 @@
<data name="Price" xml:space="preserve">
<value>Ár</value>
</data>
<data name="ReceiverId" xml:space="preserve">
<value>Címzett azonosítója</value>
</data>
<data name="Register" xml:space="preserve">
<value>Regisztráció</value>
</data>
@ -216,15 +231,24 @@
<data name="ServiceProviderTitle" xml:space="preserve">
<value>Új szolgáltató</value>
</data>
<data name="Subject" xml:space="preserve">
<value>Tárgy</value>
</data>
<data name="Test" xml:space="preserve">
<value>Müxik!</value>
</data>
<data name="TransferDestinationTitle" xml:space="preserve">
<value>Új uticél</value>
</data>
<data name="TransferSubtitle" xml:space="preserve">
<value>Rendeljünk egy transzfert!</value>
</data>
<data name="TransferTitle" xml:space="preserve">
<value>Új transzfer</value>
</data>
<data name="TripDate" xml:space="preserve">
<value>Utazás napja</value>
</data>
<data name="Wizard" xml:space="preserve">
<value>Varázsló</value>
</data>

View File

@ -138,6 +138,9 @@
<data name="ButtonSave" xml:space="preserve">
<value>Save</value>
</data>
<data name="ButtonSend" xml:space="preserve">
<value>Send</value>
</data>
<data name="ConfirmEmail" xml:space="preserve">
<value>Confirm Email</value>
</data>
@ -177,9 +180,18 @@
<data name="FullName" xml:space="preserve">
<value>Full name</value>
</data>
<data name="HtmlContent" xml:space="preserve">
<value>Html content</value>
</data>
<data name="Login" xml:space="preserve">
<value>Login</value>
</data>
<data name="NewMessage" xml:space="preserve">
<value>New message</value>
</data>
<data name="NewMessageSubtitle" xml:space="preserve">
<value>Let's send them a message!</value>
</data>
<data name="NumberOfPassengers" xml:space="preserve">
<value>Passengers</value>
</data>
@ -198,6 +210,9 @@
<data name="Price" xml:space="preserve">
<value>Price</value>
</data>
<data name="ReceiverId" xml:space="preserve">
<value>Receiver Id</value>
</data>
<data name="Register" xml:space="preserve">
<value>Register</value>
</data>
@ -216,15 +231,24 @@
<data name="ServiceProviderTitle" xml:space="preserve">
<value>New Service provider</value>
</data>
<data name="Subject" xml:space="preserve">
<value>Subject</value>
</data>
<data name="Test" xml:space="preserve">
<value>This works!</value>
</data>
<data name="TransferDestinationTitle" xml:space="preserve">
<value>New destination</value>
</data>
<data name="TransferSubtitle" xml:space="preserve">
<value>Let's book a transfer!</value>
</data>
<data name="TransferTitle" xml:space="preserve">
<value>New Transfer</value>
</data>
<data name="TripDate" xml:space="preserve">
<value>Trip date</value>
</data>
<data name="Wizard" xml:space="preserve">
<value>Wizard</value>
</data>

View File

@ -1,4 +1,5 @@
using AyCode.Blazor.Components;
using DevExpress.Blazor;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;

View File

@ -23,8 +23,7 @@
</div>
</div>
<p class="mt-2 cw-480">
<h3> @localizer.GetString("DestinationName")</h3>
<p class="mt-2 cw-480">
@_formSubmitResult
</p>

View File

@ -15,6 +15,8 @@ using TIAMWebApp.Shared.Application.Interfaces;
using System.Reflection;
using TIAMWebApp.Shared.Application.Models;
using DevExpress.XtraPrinting;
using TIAMSharedUI.Shared;
using DevExpress.Pdf.Native.BouncyCastle.Asn1.Cms;
namespace TIAMSharedUI.Pages.Components
@ -25,7 +27,7 @@ namespace TIAMSharedUI.Pages.Components
public required LogToBrowserConsole LogToBrowserConsole { get; set; }
[Inject]
IStringLocalizer<TIAMResources> localizer { get; set; }
IStringLocalizer<TIAMResources> localizer { get; set; }
public Dictionary<int, Guid> FormSteps { get; set; } = new Dictionary<int, Guid>();
public int CurrentStep { get; set; } = 0;
@ -34,6 +36,8 @@ namespace TIAMSharedUI.Pages.Components
[Parameter]
public string TitleResourceString { get; set; } = "Wizard";
[Parameter]
public string SubtitleResourceString { get; set; } = "Let's fill in this form";
[Parameter]
@ -45,8 +49,12 @@ namespace TIAMSharedUI.Pages.Components
[Parameter]
public string SubmitButtonText { get; set; } = "Submit";
[Required]
[Parameter]
public List<string> IgnoreReflection { get; set; }
string _formSubmitResult = "";
private string _spinnerClass = "";
@ -70,7 +78,7 @@ namespace TIAMSharedUI.Pages.Components
_formSubmitResult = debugString;
_spinnerClass = "";
await OnSubmit.InvokeAsync(Data);
}
@ -98,33 +106,35 @@ namespace TIAMSharedUI.Pages.Components
LogToBrowserConsole.LogToBC("Hellooooo " + _type.AssemblyQualifiedName);
var propertyList = _type.GetProperties();
var _length = propertyList.Length - IgnoreReflection.Count;
//var propertyList = typeof(TestUserData).GetProperties();
formLayoutBuilder.OpenComponent<DxFormLayout>(0);
formLayoutBuilder.AddAttribute(1, "ChildContent", (RenderFragment)((layoutItemBuilder) =>
{
int i = 0;
int j = 0;
int k = 0;
foreach (var property in propertyList)
{
bool isActive = j == CurrentStep;
bool isActive = k == CurrentStep;
//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 == "Price" || property.Name == "Created" || property.Name == "Modified")
if (IgnoreReflection.Contains(property.Name))
{
continue;
}
Guid _stepID = Guid.Empty;
if (!FormSteps.ContainsKey(j))
if (!FormSteps.ContainsKey(k))
{
_stepID = Guid.NewGuid();
FormSteps.Add(j, _stepID);
LogToBrowserConsole.LogToBC($"Adding step {k}, {_stepID}, for {property.Name}");
FormSteps.Add(k, _stepID);
}
else
{
_stepID = FormSteps[j];
_stepID = FormSteps[k];
}
//the following line creates an expression that accesses the property value by name
@ -138,7 +148,7 @@ namespace TIAMSharedUI.Pages.Components
layoutItemBuilder.AddAttribute(i++, "id", _stepID.ToString());
layoutItemBuilder.AddAttribute(i++, "class", "disply-flex align-items-center ");
layoutItemBuilder.AddAttribute(i++, "style", "width: 100%;");
if (j != CurrentStep)
if (k != CurrentStep)
{
layoutItemBuilder.AddAttribute(i++, "hidden", "true");
}
@ -146,7 +156,7 @@ namespace TIAMSharedUI.Pages.Components
{
//this input should be focused, so we set a flag
LogToBrowserConsole.LogToBC($"Setting focus to {property.Name}");
}
DataTypeAttribute attrList = (DataTypeAttribute)property.GetCustomAttributes(typeof(DataTypeAttribute), false).First();
@ -159,7 +169,7 @@ namespace TIAMSharedUI.Pages.Components
layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<object>)((context) => ((editor) =>
{
j = 0;
var j = 0;
switch (attrList.DataType)
{
@ -170,8 +180,8 @@ namespace TIAMSharedUI.Pages.Components
editor.AddAttribute(j++, "Text", property.GetValue(Data));
editor.AddAttribute(j++, "TextExpression", lambda);
editor.AddAttribute(j++, "CssClass", "form-field");
if(isActive)
if (isActive)
{
editor.AddAttribute(j++, "Id", "ActiveInput");
}
@ -196,18 +206,24 @@ namespace TIAMSharedUI.Pages.Components
{
editor.OpenComponent<DxMaskedInput<string>>(j++);
editor.AddAttribute(j++, "Value", property.GetValue(Data));
editor.AddAttribute(j++, "Mask", TIAMRegularExpressions.PhoneNumberMask);
editor.AddAttribute(j++, "MaskMode", MaskMode.RegEx);
editor.AddAttribute(j++, "BindValueMode", BindValueMode.OnInput);
editor.AddAttribute(j++, "BindValueMode", BindValueMode.OnLostFocus);
editor.AddAttribute(j++, "ValueExpression", lambda);
editor.AddAttribute(j++, "NullText", "+11234567890");
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str => SetPhoneNumber(property, Data, str)));
editor.AddAttribute(j++, "MaskAutoCompleteMode", MaskAutoCompleteMode.None);
//editor.AddAttribute(j++, "Placeholder", "#");
//editor.AddAttribute(j++, "PlaceholdersVisible", false);
editor.AddAttribute(j++, "ValueChanged", EventCallback.Factory.Create<string>(this, str => SetPhoneNumber(property, Data, str)));
//editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str => { property.SetValue(Data, str); }));
editor.AddAttribute(i++, "Template", (RenderFragment<object>)((context) => ((editor2) =>
{
editor2.OpenComponent<DxRegExMaskProperties>(j++);
editor2.AddAttribute(j++, "PlaceholdersVisible", false);
editor2.CloseComponent();
editor.AddAttribute(i++, "Template", (RenderFragment<object>)((context) => ((regexProperties) =>
{
var l = 0;
regexProperties.OpenComponent<DxRegExMaskProperties>(l++);
regexProperties.AddAttribute(l++, "Placeholder", "#");
regexProperties.AddAttribute(l++, "PlaceholdersVisible", false);
regexProperties.CloseComponent();
})));
editor.CloseComponent();
break;
@ -218,11 +234,25 @@ namespace TIAMSharedUI.Pages.Components
editor.AddAttribute(j++, "Value", property.GetValue(Data));
editor.AddAttribute(j++, "Mask", TIAMRegularExpressions.EmailMask);
editor.AddAttribute(j++, "MaskMode", MaskMode.RegEx);
editor.AddAttribute(j++, "BindValueMode", BindValueMode.OnInput);
editor.AddAttribute(j++, "BindValueMode", BindValueMode.OnLostFocus);
//MaskAutoCompleteMode="@((MaskAutoCompleteMode)AutoCompleteMode)"
editor.AddAttribute(j++, "MaskAutoCompleteMode", MaskAutoCompleteMode.Strong);
editor.AddAttribute(j++, "ValueExpression", lambda);
editor.AddAttribute(j++, "MaskAutoCompleteMode", MaskAutoCompleteMode.None);
editor.AddAttribute(j++, "NullText", "example@example.com");
editor.AddAttribute(j++, "ValueExpression", lambda);
editor.AddAttribute(j++, "Placeholder", "#");
editor.AddAttribute(j++, "PlaceholdersVisible", false);
editor.AddAttribute(j++, "ValueChanged", EventCallback.Factory.Create<string>(this, str => { property.SetValue(Data, str); }));
//editor.AddAttribute(j++, "Template", (RenderFragment<object>)((context) => ((editor2) =>
//{
// var l = 0;
// editor2.OpenComponent<DxRegExMaskProperties>(l++);
// editor2.AddAttribute(l++, "Placeholder", "#");
// editor2.AddAttribute(l++, "PlaceholdersVisible", "false");
// editor2.CloseComponent();
//})));
editor.CloseComponent();
break;
}
@ -281,14 +311,14 @@ namespace TIAMSharedUI.Pages.Components
else if (property.PropertyType == typeof(DriverModel) && property.Name == "Driver")
{
//load possible drivers for this serviceprovider
//DriverModel driver = (DriverModel)property.GetValue(Data);
IEnumerable<DriverModel> drivers = new DriverModel[] {
new DriverModel(Guid.NewGuid(), Guid.NewGuid(), "John Doe"),
new DriverModel(Guid.NewGuid(), Guid.NewGuid(), "Jane Doe"),
new DriverModel(Guid.NewGuid(), Guid.NewGuid(), "James Doe")
};
var defaultDriver = drivers.FirstOrDefault();
//editor.OpenElement(j++, "p");
@ -296,7 +326,7 @@ namespace TIAMSharedUI.Pages.Components
//editor.CloseElement();
editor.OpenComponent<DxComboBox<DriverModel, DriverModel>>(j);
editor.AddAttribute(j++, "Data", drivers);
editor.AddAttribute(j++, "TextFieldName", nameof (defaultDriver.Name));
editor.AddAttribute(j++, "TextFieldName", nameof(defaultDriver.Name));
editor.AddAttribute(j++, "Value", drivers.FirstOrDefault());
//editor.AddAttribute(j++, "Text", defaultDriver);
editor.AddAttribute(j++, "CssClass", "form-field");
@ -306,10 +336,30 @@ namespace TIAMSharedUI.Pages.Components
editor.CloseComponent();
break;
}
else if (property.PropertyType == typeof(TransferDestination))
//string.Compare(metadata.CustomDataType, "BoldRed", true) == 0
//else if (property.PropertyType == typeof(string) && property.Name == "Destination")
else if (property.PropertyType == typeof(string) && string.Compare(attrList.CustomDataType, "TransferDestination", true) == 0)
{
editor.OpenComponent<ChooseDestination>(j);
editor.OpenComponent<SliderItemSelector>(j);
editor.AddAttribute(j++, "OnSliderChanged", EventCallback.Factory.Create<string>(this, result =>
{
LogToBrowserConsole.LogToBC($"Slider changed to {result}");
property.SetValue(Data, result);
LogToBrowserConsole.LogToBC($"Data.Destination = {property.GetValue(Data)}");
StateHasChanged(); // Add this line to refresh the UI
}));
editor.CloseComponent();
editor.OpenComponent<DxTextBox>(j++);
editor.AddAttribute(j++, "CssClass", "form-field");
editor.AddAttribute(j++, "NullText", "Slide or type");
editor.AddAttribute(j++, "Text", property.GetValue(Data));
editor.AddAttribute(j++, "TextExpression", lambda);
editor.AddAttribute(j++, "TextChanged", EventCallback.Factory.Create<string>(this, str => { property.SetValue(Data, str); }));
editor.CloseComponent();
}
break;
@ -332,16 +382,18 @@ namespace TIAMSharedUI.Pages.Components
})));
layoutItemBuilder.CloseComponent(); //close dxformlayoutitem
if (j < propertyList.Length - 1)
if (k < _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++, "style", "margin-left: auto;");
layoutItemBuilder.AddAttribute(i++, "Text", localizer.GetString(ResourceKeys.ButtonNext));
layoutItemBuilder.CloseComponent();
}
if (j > 0)
if (k > 0)
{
layoutItemBuilder.OpenComponent<DxButton>(i++);
layoutItemBuilder.AddAttribute(i++, "Click", EventCallback.Factory.Create<MouseEventArgs>(this, OnPrevious));
@ -361,8 +413,8 @@ namespace TIAMSharedUI.Pages.Components
layoutItemBuilder.CloseElement();
LogToBrowserConsole.LogToBC($"loop {j}, {propertyList.Length}");
j++;
LogToBrowserConsole.LogToBC($"loop {k}, length: {_length}, formSteps: {FormSteps.Count} ");
k++;
}
layoutItemBuilder.OpenComponent<DxFormLayoutItem>(i++);
@ -370,21 +422,21 @@ namespace TIAMSharedUI.Pages.Components
layoutItemBuilder.AddAttribute(i++, "CssClass", "full-width");
layoutItemBuilder.AddAttribute(i++, "Template", (RenderFragment<object>)((context) => ((editor) =>
{
LogToBrowserConsole.LogToBC($"Submit button {CurrentStep}, {propertyList.Length}");
LogToBrowserConsole.LogToBC($"Submit button {CurrentStep}, {FormSteps.Count}");
editor.OpenElement(i++, "button");
editor.AddAttribute(i++, "type", "submit");
editor.AddAttribute(i++, "class", "btn btn-primary mt-3");
if (CurrentStep < propertyList.Length - 1)
if (CurrentStep < _length - 1)
{
editor.AddAttribute(i++, "disabled", "true");
}
//editor.AddAttribute(i++, "disabled", "true");
editor.OpenElement(i++, "span");
editor.AddAttribute(i++, "class", _spinnerClass);
editor.CloseElement();
editor.AddContent(i++, localizer.GetString(SubmitButtonText));
editor.CloseElement();
@ -413,7 +465,7 @@ namespace TIAMSharedUI.Pages.Components
private void SetPhoneNumber(PropertyInfo property, object Data, string str)
{
LogToBrowserConsole.LogToBC($"SetPhoneNumber called with {str}");
property.SetValue(Data, str);
property.SetValue(Data, str);
}
}
}

View File

@ -41,9 +41,7 @@
public EventCallback<string> onNext { get; set; }
[Parameter]
public EventCallback<RegistrationModel> RegModelChanged { get; set; }
IEnumerable<char> PredefinedPlaceholders { get; set; } = new List<char>() { '_', '#' };
public EventCallback<RegistrationModel> RegModelChanged { get; set; }
//string EmailMask { get; set; } = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
string EmailMask { get; set; } = TIAMRegularExpressions.EmailMask;

View File

@ -11,20 +11,7 @@ namespace TIAMSharedUI.Pages.Components
base.OnInitialized();
this.CssClass = "dx-textbox tiam-textbox";
}
//need a textexpression that works with double? and string
[Parameter]
public new Expression<Func<string>> TextExpression {
get
{
return Model.TextExpression;
}
set
{
Model.TextExpression = value;
}
}
}
}
}

View File

@ -13,7 +13,11 @@
<DbTestComponent></DbTestComponent>
<div class="target-container" @onclick="@(() => EulaVisible = true)">
<button class="btn btn-primary">NEW TRANSFERDESTINATION</button>
</div>
<div class="target-container" @onclick="@(() => EulaVisible2 = true)">
<button class="btn btn-primary">NEW TRANSFER</button>
</div>
<DxPopup CssClass="popup-demo-events"
@bind-Visible="@EulaVisible"
@ -25,7 +29,7 @@
Closing="EulaPopupClosing"
Closed="EulaPopupClosed">
<BodyContentTemplate>
<InputWizard Data=@myModel OnSubmit="SubmitForm"></InputWizard>
<InputWizard Data=@myModel OnSubmit="SubmitForm" IgnoreReflection="@TransferDestinationIgnorList"></InputWizard>
</BodyContentTemplate>
<FooterContentTemplate Context="Context">
<div class="popup-demo-events-footer">
@ -36,17 +40,23 @@
</FooterContentTemplate>
</DxPopup>
<DxPopup CssClass="popup-demo-events"
@bind-Visible="@EulaVisible"
@bind-Visible="@EulaVisible2"
ShowFooter="true"
CloseOnEscape="false"
CloseOnOutsideClick="false"
ShowCloseButton="false"
HeaderText="DevExpress EULA"
HeaderText="New Transfer"
Closing="EulaPopupClosing"
Closed="EulaPopupClosed">
<BodyContentTemplate>
<InputWizard Data=@myModel2 OnSubmit="SubmitForm"></InputWizard>
<InputWizard Data=@myModel2
OnSubmit="SubmitForm"
IgnoreReflection="@TransferIgnorList"
SubmitButtonText="ButtonSend"
TitleResourceString="TransferTitle"
SubtitleResourceString="TransferSubtitle"></InputWizard>
</BodyContentTemplate>
<FooterContentTemplate Context="Context">
<div class="popup-demo-events-footer">
<!--DxCheckBox CssClass="popup-demo-events-checkbox" @bind-Checked="@EulaAccepted">I accept the terms of the EULA</!--DxCheckBox-->
@ -64,7 +74,7 @@
<DxButton CssClass="popup-button my-1 ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="CancelEulaClick" />
</FooterContentTemplate>
</DxPopup>
<TiamDXTextBox></TiamDXTextBox>
</div>
@code {
@ -74,8 +84,22 @@
bool EulaAccepted { get; set; }
bool EulaVisible { get; set; }
bool EulaVisible2 { get; set; }
bool MessageBoxVisible { get; set; }
bool SkipEulaCheck { get; set; }
public List<string> TransferIgnorList = new List<string>
{
"Id",
"Price"
};
public List<string> TransferDestinationIgnorList = new List<string>
{
"Id",
"Created",
"Modified"
};
void TryAgainClick()
{
MessageBoxVisible = false;
@ -86,6 +110,7 @@
SkipEulaCheck = true;
MessageBoxVisible = false;
EulaVisible = false;
EulaVisible2 = false;
}
void EulaPopupClosed()
{

View File

@ -9,7 +9,9 @@
</div>
<SliderItemSelector @ref="slider" OnSliderChanged=@DisplaySlideData TextChanged="@changeDest"></SliderItemSelector>
<SliderItemSelector @ref="slider" OwlId="owlSelector1" OnSliderChanged=@DisplaySlideData></SliderItemSelector>
<SliderItemSelector @ref="slider2" OwlId="owlSelector2" OnSliderChanged=@DisplaySlideData></SliderItemSelector>
<div class="wrapper">
@ -43,6 +45,7 @@
@code {
SliderItemSelector slider;
SliderItemSelector slider2;
public string message;
public string message2;
public List<string> destinations = new List<string>() {"Liszt Ferenc Airport", "Buda Castle", "Chain Bridge"};
@ -59,12 +62,7 @@
/*protected override void OnAfterRender(bool isFirst)
{
message = " Target destination is " + slider.SliderElementId.ToString();
}*/
void changeDest(string dest)
{
message2 = dest;
}
}*/
public void next() => navManager.NavigateTo("/transfer2");

View File

@ -16,14 +16,14 @@
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
<!--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>
<h4 class="bold">Your QR code</h4>
<p class="text-muted"> Use this in printed material, to gain referrals</p>
</div>
<div>
@ -33,8 +33,10 @@
</div>
<div class="d-flex flex-row mb-4 pb-2">
<h4> Some <span class="small text-muted"> conclusion </span></h4>
<div class="d-flex flex-column mb-4 pb-2">
<h4> Hotel name: <span class="small text-muted"> Example hotel </span></h4>
<h4> Address: <span class="small text-muted"> Budapest, Minta u. 46 </span></h4>
<h4> Phone number: <span class="small text-muted"> +36 1 123 4567</span></h4>
</div>
</div>
<div class="card-footer py-2 px-4">
@ -57,7 +59,7 @@
</div>
<div>
<h6 class="mb-0"> <a href="#">All settings</a> </h6>
<h6 class="mb-0"> <a href="/user/transfers">All transfers</a> </h6>
</div>
</div>
</div>

View File

@ -11,6 +11,9 @@ namespace TIAMSharedUI.Pages.User
{
public partial class HotelComponent: ComponentBase
{
[Parameter]
public string? Id { get; set; }
[Inject]
ISupplierService SupplierService { get; set; }

View File

@ -62,15 +62,16 @@
CustomizeEditModel="Grid_CustomizeEditModel"
EditModelSaving="Grid_EditModelSaving"
DataItemDeleting="Grid_DataItemDeleting"
EditMode="GridEditMode.PopupEditForm"
EditMode="GridEditMode.EditRow"
KeyboardNavigationEnabled="true">
<Columns>
<DxGridCommandColumn Width="160px" />
<DxGridDataColumn FieldName="Name" MinWidth="80">
<DxGridDataColumn FieldName="Id" MinWidth="80">
<CellDisplayTemplate>
<a class="d-block text-left" href="transferdetails">@context.Value</a>
<a class="d-block text-left" href="user/serviceprovider/@context.Value.ToString()">@context.Value</a>
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Name" MinWidth="80" />
<DxGridDataColumn FieldName="OwnerId" MinWidth="80" />
</Columns>

View File

@ -1,148 +1,158 @@
@page "/user/transfers"
@using AyCode.Models.Messages
@using TIAM.Entities.ServiceProviders
@using TIAM.Resources
@using TIAMSharedUI.Pages.Components
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
@using TIAMWebApp.Shared.Application.Models.ClientSide.Messages
@using TIAMWebApp.Shared.Application.Utility
@layout AdminLayout
@inject LogToBrowserConsole logToBrowserConsole
@inject IStringLocalizer<TIAMResources> localizer
<PageTitle>Transfers</PageTitle>
<h3>Properties</h3>
<div class="container">
<div class="row">
<div class=" col-12">
<div class="card card-admin" style="border-radius: 16px; height: 80vh !important">
<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 list</span>
</div>
<div>
<!--div class="target-container" @onclick="@(() => EulaVisible = true)">
<button class="btn btn-primary">Create</button>
</div-->
</div>
<h3>@localizer.GetString("Transfer")</h3>
<DxPopup CssClass="popup-demo-events"
@bind-Visible="@PopupVisible"
ShowFooter="true"
CloseOnEscape="true"
CloseOnOutsideClick="false"
ShowCloseButton="false"
HeaderText="MessageBox"
Closing="EulaPopupClosing"
Closed="EulaPopupClosed">
<BodyContentTemplate>
<InputWizard Data=@messageWizardModel
OnSubmit="SubmitForm"
IgnoreReflection=@ignoreList
TitleResourceString="NewMessage"
SubtitleResourceString="NewMessageSubtitle"
SubmitButtonText="ButtonSend"></InputWizard>
</BodyContentTemplate>
<FooterContentTemplate Context="Context">
<div class="popup-demo-events-footer">
<!--DxCheckBox CssClass="popup-demo-events-checkbox" @bind-Checked="@EulaAccepted">I accept the terms of the EULA</!--DxCheckBox-->
<!--DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="Context.CloseCallback" /-->
<DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text="Cancel" Click="CancelCreateClick" />
</div>
</FooterContentTemplate>
</DxPopup>
<div class="d-flex flex-column mb-4 pb-2">
<div class="align-self-end pl-2 pb-2">
<DxButton Text="Column Chooser"
RenderStyle="ButtonRenderStyle.Secondary"
IconCssClass="btn-column-chooser"
Click="ColumnChooserButton_Click" />
</div>
<DxGrid @ref="Grid"
Data="TransferData"
PageSize="8"
KeyFieldName="Id"
ValidationEnabled="false"
CustomizeEditModel="Grid_CustomizeEditModel"
EditModelSaving="Grid_EditModelSaving"
DataItemDeleting="Grid_DataItemDeleting"
EditMode="GridEditMode.EditForm"
ColumnResizeMode="GridColumnResizeMode.NextColumn"
KeyboardNavigationEnabled="true"
ShowFilterRow="true">
<Columns>
<DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
<div class="card-body card-admin-body py-2 px-4">
<div class="d-flex flex-column mb-4 pb-2">
<div class="align-self-end pl-2 pb-2">
<DxButton Text="Column Chooser"
RenderStyle="ButtonRenderStyle.Secondary"
IconCssClass="btn-column-chooser"
Click="ColumnChooserButton_Click" />
</div>
<DxGrid @ref="Grid"
Data="TransferData"
PageSize="8"
KeyFieldName="Id"
ValidationEnabled="false"
CustomizeEditModel="Grid_CustomizeEditModel"
EditModelSaving="Grid_EditModelSaving"
DataItemDeleting="Grid_DataItemDeleting"
EditMode="GridEditMode.EditForm"
ColumnResizeMode="GridColumnResizeMode.NextColumn"
KeyboardNavigationEnabled="true"
ShowFilterRow="true">
<Columns>
<DxGridCommandColumn Width="8%" FixedPosition="GridColumnFixedPosition.Left" />
<DxGridDataColumn FieldName="Id" MinWidth="80" Width="10%" Visible="false" />
<DxGridDataColumn FieldName="Destination" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="10%">
<CellDisplayTemplate>
@{
var keyField = context.Value;
<a class="d-block text-left" href="transferdetails">@context.Value</a>
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="PickupAddress" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="15%" />
<DxGridDataColumn FieldName="TripDate" MinWidth="80" Width="10%" />
<DxGridDataColumn FieldName="NumberOfPassengers" MinWidth="40" Width="3%" />
<DxGridDataColumn FieldName="FullName" MinWidth="80" />
<DxGridDataColumn FieldName="PhoneNumber" MinWidth="80" Width="10%" />
<DxGridDataColumn FieldName="EmailAddress" MinWidth="80" Width="10%">
<CellDisplayTemplate>
@{
var keyField = context.Value;
string buttonText = "Contact";
<DxButton Click="() => SendMail(keyField)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Driver" FixedPosition="GridColumnFixedPosition.Right" MinWidth="80" Width="15%">
<CellDisplayTemplate>
@{
DriverModel keyField = (DriverModel)context.Value;
string driverText = keyField.Name;
<p>@driverText</p>
}
</CellDisplayTemplate>
</DxGridDataColumn>
</Columns>
<EditFormTemplate Context="EditFormContext">
<DxGridDataColumn FieldName="Id" MinWidth="80" Width="10%" Visible="false" />
<DxGridDataColumn FieldName="Destination" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="10%">
<CellDisplayTemplate>
@{
var transfer = (TransferWizardModel)EditFormContext.EditModel;
var keyField = context.Value;
<a class="d-block text-left" href="transferdetails">@context.Value</a>
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
@EditFormContext.GetEditor("Destination")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PickupAddress) ColSpanMd="6">
@EditFormContext.GetEditor("PickupAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="6">
@EditFormContext.GetEditor("TripDate")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Passengers:" ColSpanMd="6">
@EditFormContext.GetEditor("NumberOfPassengers")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Full name:" ColSpanMd="6">
@EditFormContext.GetEditor("FullName")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Phone number:" ColSpanMd="6">
@EditFormContext.GetEditor("PhoneNumber")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Email:" ColSpanMd="6">
@EditFormContext.GetEditor("EmailAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Driver:" ColSpanMd="6">
<DxComboBox Data="@drivers"
NullText="Select driver..."
FilteringMode="DataGridFilteringMode.Contains"
TextFieldName="Name"
ValueFieldName="Name"
Value="@transfer.Driver.Name"
ValueChanged="(string newCellValue) => {
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="PickupAddress" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="15%" />
<DxGridDataColumn FieldName="TripDate" MinWidth="80" Width="10%" />
<DxGridDataColumn FieldName="NumberOfPassengers" MinWidth="40" Width="3%" />
<DxGridDataColumn FieldName="FullName" MinWidth="80" />
<DxGridDataColumn FieldName="PhoneNumber" MinWidth="80" Width="10%" />
<DxGridDataColumn FieldName="EmailAddress" MinWidth="80" Width="10%">
<CellDisplayTemplate>
@{
var keyField = context.Value;
string buttonText = "Contact";
<DxButton Click="() => SendMail(keyField)" Text="@buttonText" RenderStyle="ButtonRenderStyle.Primary" />
}
</CellDisplayTemplate>
</DxGridDataColumn>
<DxGridDataColumn FieldName="Driver" FixedPosition="GridColumnFixedPosition.Right" MinWidth="80" Width="15%">
<CellDisplayTemplate>
@{
DriverModel keyField = (DriverModel)context.Value;
string driverText = keyField.Name;
<p>@driverText</p>
}
</CellDisplayTemplate>
</DxGridDataColumn>
</Columns>
<EditFormTemplate Context="EditFormContext">
@{
var transfer = (TransferWizardModel)EditFormContext.EditModel;
}
<DxFormLayout CssClass="w-100">
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.DestinationAddress) ColSpanMd="6">
@EditFormContext.GetEditor("Destination")
</DxFormLayoutItem>
<DxFormLayoutItem Caption=@localizer.GetString(ResourceKeys.PickupAddress) ColSpanMd="6">
@EditFormContext.GetEditor("PickupAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Trip date:" ColSpanMd="6">
@EditFormContext.GetEditor("TripDate")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Passengers:" ColSpanMd="6">
@EditFormContext.GetEditor("NumberOfPassengers")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Full name:" ColSpanMd="6">
@EditFormContext.GetEditor("FullName")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Phone number:" ColSpanMd="6">
@EditFormContext.GetEditor("PhoneNumber")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Email:" ColSpanMd="6">
@EditFormContext.GetEditor("EmailAddress")
</DxFormLayoutItem>
<DxFormLayoutItem Caption="Driver:" ColSpanMd="6">
<DxComboBox Data="@drivers"
NullText="Select driver..."
FilteringMode="DataGridFilteringMode.Contains"
TextFieldName="Name"
ValueFieldName="Name"
Value="@transfer.Driver.Name"
ValueChanged="(string newCellValue) => {
transfer.Driver = drivers.FirstOrDefault(x => x.Name == newCellValue);
logToBrowserConsole.LogToBC(newCellValue);
}">
</DxComboBox>
</DxFormLayoutItem>
</DxFormLayout>
</EditFormTemplate>
</DxComboBox>
</DxFormLayoutItem>
</DxGrid>
</DxFormLayout>
</EditFormTemplate>
</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>
</div>
<div class=" col-12 col-xl-6">
@ -159,8 +169,14 @@
public TransferWizardModel myModel = new TransferWizardModel();
bool EulaAccepted { get; set; }
bool EulaVisible { get; set; }
bool PopupVisible { get; set; }
public List<string> ignoreList = new List<string>
{
"ReceiverId"
};
public MessageWizardModel messageWizardModel = new MessageWizardModel();
//IEnumerable<DriverModel> drivers { get; set; }
@ -185,22 +201,24 @@
void SendMail(object emailAddress)
{
logToBrowserConsole.LogToBC($"Sending mail to {emailAddress}");
PopupVisible = true;
}
void CancelCreateClick()
{
EulaVisible = false;
PopupVisible = false;
}
void EulaPopupClosed()
{
EulaAccepted = false;
//cancel clicked
}
void EulaPopupClosing(PopupClosingEventArgs args)
{
myModel = new TransferWizardModel();
//myModel = new TransferWizardModel();
messageWizardModel = new MessageWizardModel();
}
//-----------------------------------------------------------------------------------

View File

@ -0,0 +1,22 @@
@page "/user/serviceprovider/{id}"
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models;
@using TIAMWebApp.Shared.Application.Interfaces;
@layout AdminLayout
@inject NavigationManager navigationManager
<div class="container">
<HotelComponent Id="@Id"></HotelComponent>
</div>
@code {
[Parameter]
public string Id { get; set; }
protected override void OnInitialized()
{
base.OnInitialized();
if (string.IsNullOrEmpty(Id))
navigationManager.NavigateTo("/user/properties");
}
}

View File

@ -12,11 +12,8 @@
<main>
<article class="content">
<TopRow></TopRow>
@Body
</article>
</main>

View File

@ -1,4 +1,7 @@

@using System.Linq.Expressions
@using TIAMWebApp.Shared.Application.Utility
@inject LogToBrowserConsole logToBrowserConsole
<style>
.underlineInput{
padding-left: 10px;
@ -13,28 +16,11 @@
}
</style>
<div id="owl-selector" class="owl-carousel owl-theme" style="padding-left: 20px; padding-right:20px; border-radius: 15px;">
<div class="item" id="0" style="background-color: rgba(0,0,0,0.1)">
<div class="item-desc text-center pt-3">
<h3>Please type an address or swipe to select from preset destinations!</h3>
<div class="wrapper" style="max-width: 800px; margin:0 auto">
<input type="hidden" id="PassingToJavaScript1" value=@OwlId>
<DxTextBox
TextChanged="@((newValue) => OnTextChanged(newValue))"
BindValueMode="@BindValueMode"
InputDelay="@InputDelay"
NullText="Type text..."
CssClass="cw-320 form-field underlineInput" />
</div>
<p class="demo-text cw-320 mt-2">
Text: <b>@TextValue</b>
</p>
</div>
</div>
<div id=@OwlId class="owl-carousel owl-theme">
<div class="item" id="1" style="background-image: url(https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D); background-position: center;">
<div class="item-desc text-center pt-3">
@ -55,11 +41,19 @@
</div>
</div>
</div>
<h3>Please type an address or swipe to select from preset destinations!</h3>
@{
var jsOwlId = OwlId;
logToBrowserConsole.LogToBC(jsOwlId);
}
<script>
var owl = $('#owl-selector');
var owlId = p1;
console.log('OwlId is ' + owlId);
var owl = $('#' + owlId);
var i = 0;
@ -123,23 +117,28 @@
</script>
@code {
[Parameter]
public string OwlId { get; set; }
public string TextValue { get; set; } = null;
int? InputDelay { get; set; } = 3500;
BindValueMode BindValueMode { get; set; } = BindValueMode.OnInput;
bool BindDelayEnabled { get { return BindValueMode == BindValueMode.OnDelayedInput; } }
[Parameter]
public EventCallback<string> TextChanged { get; set; }
public int SliderElementId = 0;
string content = "";
[Parameter]
public EventCallback<int> OnSliderChanged { get; set; }
public EventCallback<string> OnSliderChanged { get; set; }
[Inject]
public IJSRuntime JSRuntime { get; set; }
protected override void OnParametersSet()
{
logToBrowserConsole.LogToBC($"SliderItemSelector is initialized with OwlId: {OwlId}");
base.OnParametersSet();
}
protected override void OnAfterRender(bool firstRender)
{
if(firstRender)
@ -155,18 +154,14 @@
[JSInvokable]
public void ShowCoordinates(string coordinates, string itemId)
{
logToBrowserConsole.LogToBC($"Slider is changing: {coordinates}, {itemId}");
//content = coordinates + "item = " + itemId;
SliderElementId = Convert.ToInt32(itemId);
OnSliderChanged.InvokeAsync(Convert.ToInt32(itemId));
OnSliderChanged.InvokeAsync(itemId);
/*StateHasChanged();*/
}
void OnTextChanged(string newValue)
{
TextValue = newValue;
TextChanged.InvokeAsync(newValue);
}
}
}

View File

@ -71,6 +71,10 @@ select {
/*my blazor overrides*/
.dxbl-col {
padding-left:0px;
padding-right:0px;
}
.dxbl-grid {
--dxbl-grid-font-family: inherit !important;

View File

@ -0,0 +1,35 @@
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 MessageWizardModel
{
[DataType(DataType.Text)]
[Display(Name = "ReceiverId", ResourceType = typeof(TIAMResources))]
public string ReceiverId { get; set; }
[Required(ErrorMessage = "The subject value should be specified.")]
[DataType(DataType.Text)]
[Display(Name = "Subject", ResourceType = typeof(TIAMResources))]
public string Subject { get; set; }
[Required(ErrorMessage = "The content value should be specified.")]
[DataType(DataType.MultilineText)]
[Display(Name = "HtmlContent", ResourceType = typeof(TIAMResources))]
public string Content { get; set; }
public MessageWizardModel() { }
public MessageWizardModel(string receiverId, string subject, string content)
{
ReceiverId = receiverId;
Subject = subject;
Content = content;
}
}
}

View File

@ -17,13 +17,13 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
//[Required(ErrorMessage = "The Username value should be specified.")]
[Required(ErrorMessage = "The destination address should be specified.")]
[DataType(DataType.Text)]
[DataType("TransferDestination")]
[Display(Name = ResourceKeys.Destination, ResourceType = typeof(TIAMResources))]
public string? Destination { get; set; }
//[Required(ErrorMessage = "The Username value should be specified.")]
[Required(ErrorMessage = "The pickup address should be specified.")]
[DataType(DataType.Text)]
[DataType("TransferDestination")]
[Display(Name = ResourceKeys.PickupAddress, ResourceType = typeof(TIAMResources))]
public string? PickupAddress { get; set; }

View File

@ -10,6 +10,7 @@ namespace TIAMWebApp.Shared.Application.Utility
{
public const string EmailMask = @"(\w|[.-])+@(\w|-)+\.(\w|-){2,4}";
//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})";
}