This commit is contained in:
jozsef.b@aycode.com 2024-03-28 19:24:54 +01:00
commit ce79369a12
24 changed files with 289 additions and 55 deletions

View File

@ -339,6 +339,24 @@ namespace TIAM.Resources {
} }
} }
/// <summary>
/// Looks up a localized string similar to Price 2.
/// </summary>
public static string Price2 {
get {
return ResourceManager.GetString("Price2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Price 3.
/// </summary>
public static string Price3 {
get {
return ResourceManager.GetString("Price3", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Receiver Id. /// Looks up a localized string similar to Receiver Id.
/// </summary> /// </summary>

View File

@ -210,6 +210,12 @@
<data name="Price" xml:space="preserve"> <data name="Price" xml:space="preserve">
<value>Price</value> <value>Price</value>
</data> </data>
<data name="Price2" xml:space="preserve">
<value>Price 2</value>
</data>
<data name="Price3" xml:space="preserve">
<value>Price 3</value>
</data>
<data name="ReceiverId" xml:space="preserve"> <data name="ReceiverId" xml:space="preserve">
<value>Receiver Id</value> <value>Receiver Id</value>
</data> </data>

View File

@ -14,13 +14,12 @@
@inject ISecureStorageHandler SecureStorageHandler @inject ISecureStorageHandler SecureStorageHandler
@inject ISessionService sessionService; @inject ISessionService sessionService;
@inject HttpClient http; @inject HttpClient http;
<h3>AppLaunch</h3>
@{ @{
if (string.IsNullOrWhiteSpace(TrackingId)) if (string.IsNullOrWhiteSpace(TrackingId))
{ {
TrackingId = ""; TrackingId = "";
<p>Loading...</p> // <p>Loading...</p>
} }
else else
{ {
@ -28,7 +27,6 @@
} }
} }
Loading....
@code { @code {
@ -57,7 +55,7 @@ Loading....
logToBrowserConsole = new LogToBrowserConsole(JSRuntime); logToBrowserConsole = new LogToBrowserConsole(JSRuntime);
//wait for 5 seconds //wait for 5 seconds
await Task.Delay(1000); //await Task.Delay(1000);
if (!string.IsNullOrWhiteSpace(userDetailsStr)) if (!string.IsNullOrWhiteSpace(userDetailsStr))
{ {

View File

@ -20,13 +20,13 @@ namespace TIAMSharedUI.Pages.Components
[CascadingParameter] [CascadingParameter]
private PopupMessageBox PopupMessageBox { get; set; } = default!; private PopupMessageBox PopupMessageBox { get; set; } = default!;
public bool IsVisible = true; public bool IsVisible = false;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
IsLoggedIn = sessionService.IsAuthenticated; IsLoggedIn = sessionService.IsAuthenticated;
await PopupMessageBox.ShowAsync("AuthComponent", "Initialized", null, null, null, PopupMessageBox.ButtonOk); //await PopupMessageBox.ShowAsync("AuthComponent", "Initialized", null, null, null, PopupMessageBox.ButtonOk);
//if (await PopupMessageBox.Show("Cancel", "Cancel this stuff", //if (await PopupMessageBox.Show("Cancel", "Cancel this stuff",
//PopupMessageBox.ButtonNo, PopupMessageBox.ButtonYes) == PopupMessageBox.ButtonNo) //PopupMessageBox.ButtonNo, PopupMessageBox.ButtonYes) == PopupMessageBox.ButtonNo)

View File

@ -117,6 +117,8 @@
public async Task SubmitForm(object Result) public async Task SubmitForm(object Result)
{ {
var transfer = await WizardProcessor.ProcessWizardAsync<TransferWizardModel>(Result.GetType(), Result); var transfer = await WizardProcessor.ProcessWizardAsync<TransferWizardModel>(Result.GetType(), Result);
logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}"); logToBrowserConsole.LogToBC($"Submitted nested form: {Result.GetType().FullName}");
navManager.NavigateTo("/transfer2/" + transfer.Id); navManager.NavigateTo("/transfer2/" + transfer.Id);

View File

@ -0,0 +1,45 @@
@page "/user/createAndManageTransfer"
@using TIAMSharedUI.Shared
@using TIAMWebApp.Shared.Application.Models;
@using TIAMWebApp.Shared.Application.Interfaces;
@layout AdminLayout
@inject IPopulationStructureDataProvider DataProvider
@inject ISupplierService SupplierService
@inject IUserDataService UserDataService
<PageTitle>Transfer</PageTitle>
<!--We need to check if the user is owner of a swerviceprovider-->
<div class="container">
<!-- Stats admin-->
<hr />
<div class="row py-3">
<div class=" col-12 col-xl-3">
</div>
</div>
</div>
@code {
string Id = "2312-32132121-32123";
bool isUserLoggedIn;
int userType = 0;
protected override void OnInitialized()
{
base.OnInitialized();
}
}

View File

@ -60,7 +60,9 @@
<DxGridDataColumn FieldName="Description" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%" /> <DxGridDataColumn FieldName="Description" FixedPosition="GridColumnFixedPosition.Left" MinWidth="80" Width="20%" />
<DxGridDataColumn FieldName="AddressString" MinWidth="80" Width="20%" /> <DxGridDataColumn FieldName="AddressString" MinWidth="80" Width="20%" />
<DxGridDataColumn FieldName="PriceType" MinWidth="80" Width="20%" /> <DxGridDataColumn FieldName="PriceType" MinWidth="80" Width="20%" />
<DxGridDataColumn FieldName="Price" MinWidth="80" Width="20%" /> <DxGridDataColumn FieldName="Price" MinWidth="80" />
<DxGridDataColumn FieldName="Price2" MinWidth="80" />
<DxGridDataColumn FieldName="Price3" MinWidth="80" />
</Columns> </Columns>

View File

@ -176,7 +176,7 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
{ {
//add new transferwizardmodel to transferData array //add new transferwizardmodel to transferData array
TransferDataFromDb = ((TransferDestinationWizardModel[])TransferDataFromDb).Append( TransferDataFromDb = ((TransferDestinationWizardModel[])TransferDataFromDb).Append(
new TransferDestinationWizardModel(item.Id, item.Name, item.Description, item.AddressString, item.Price, item.Address)).ToArray(); new TransferDestinationWizardModel(item.Id, item.Name, item.Description, item.AddressString, item.Price, item.Price2, item.Price3, item.Address)).ToArray();
logToBrowserConsole.LogToBC($"TransferDataFromDb: {item.Name}"); logToBrowserConsole.LogToBC($"TransferDataFromDb: {item.Name}");
} }

View File

@ -174,6 +174,12 @@
<data name="NavMenu.Transfer" xml:space="preserve"> <data name="NavMenu.Transfer" xml:space="preserve">
<value>Transzfer</value> <value>Transzfer</value>
</data> </data>
<data name="Price2" xml:space="preserve">
<value>Ár 2</value>
</data>
<data name="Price3" xml:space="preserve">
<value>Ár 3</value>
</data>
<data name="RegisterRegister" xml:space="preserve"> <data name="RegisterRegister" xml:space="preserve">
<value>Regisztráció</value> <value>Regisztráció</value>
</data> </data>

View File

@ -56,7 +56,24 @@
</div> </div>
</div> </div>
<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;"> @{
for (int i = 0; i < Destinations.Count; i++)
{
var destination = Destinations[i];
var j = i + 1;
<div class="item" id="@j" style="background-image: url('_content/TIAMSharedUI/images/mapbg.jpg'); background-position: center;">
<div class="item-desc text-center pt-3">
<h3>@destination.Name</h3>
<p>@destination.AddressString</p>
</div>
</div>
}
}
@* <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"> <div class="item-desc text-center pt-3">
<h3>Liszt Ferenc Airport</h3> <h3>Liszt Ferenc Airport</h3>
@ -73,7 +90,7 @@
<h3>Chain Bridge</h3> <h3>Chain Bridge</h3>
</div> </div>
</div> </div> *@
</div> </div>
<p>Please type an address or swipe to select from preset destinations!</p> <p>Please type an address or swipe to select from preset destinations!</p>
@ -222,10 +239,10 @@
{ {
if(firstRender) if(firstRender)
{ {
var dotNetObjRef = DotNetObjectReference.Create(this); // var dotNetObjRef = DotNetObjectReference.Create(this);
JSRuntime.InvokeVoidAsync("setOwlId", OwlId); // JSRuntime.InvokeVoidAsync("setOwlId", OwlId);
JSRuntime.InvokeVoidAsync("InitOwl", OwlId); // JSRuntime.InvokeVoidAsync("InitOwl", OwlId);
JSRuntime.InvokeVoidAsync("CStoJSCall", dotNetObjRef); // JSRuntime.InvokeVoidAsync("CStoJSCall", dotNetObjRef);
} }
@ -277,7 +294,15 @@
{ {
Destinations = await TransferDataService.GetDestinationsAsync(); Destinations = await TransferDataService.GetDestinationsAsync();
Content = TextValue; Content = TextValue;
InitOwl();
} }
private void InitOwl()
{
var dotNetObjRef = DotNetObjectReference.Create(this);
JSRuntime.InvokeVoidAsync("setOwlId", OwlId);
JSRuntime.InvokeVoidAsync("InitOwl", OwlId);
JSRuntime.InvokeVoidAsync("CStoJSCall", dotNetObjRef);
}
} }

View File

@ -48,12 +48,6 @@
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="user/cards">
Cards
</NavLink>
</div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" @onclick="()=>expandSysAdminNav = !expandSysAdminNav"> <NavLink class="nav-link" @onclick="()=>expandSysAdminNav = !expandSysAdminNav">
<span class="oi oi-list-rich" aria-hidden="true"></span> System Admin <span class="oi oi-list-rich" aria-hidden="true"></span> System Admin
@ -94,6 +88,11 @@
Hotel Dashboard Hotel Dashboard
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="user/createAndManageTransfer">
Transfer
</NavLink>
</div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="user/serviceprovider/5453-a87f77787d-khj899"> <NavLink class="nav-link" href="user/serviceprovider/5453-a87f77787d-khj899">
Manage Manage

View File

@ -16,7 +16,7 @@ namespace TIAMWebApp.Client.Services
Task<Supplier[]?> ISupplierService.GetSuppliersAsync() Task<Supplier[]?> ISupplierService.GetSuppliersAsync()
{ {
return http.GetFromJsonAsync<Supplier[]>("SupplierAPI"); return http.GetFromJsonAsync<Supplier[]>("api/v1/SupplierAPI");
} }
} }
} }

View File

@ -51,7 +51,7 @@ namespace TIAMWebApp.Client.Services
logToBrowserConsole.LogToBC($"{hasProperties.Count} properties found"); logToBrowserConsole.LogToBC($"{hasProperties.Count} properties found");
//create user session model //create user session model
var user = new UserSessionModel(userModelDto.Id, UserType.User, userModelDto.Profile?.Name, hasProperties, 1); var user = new UserSessionModel(userModelDto.Id, UserType.User, userModelDto, hasProperties, 1);
return user; return user;
} }
else else
@ -64,7 +64,7 @@ namespace TIAMWebApp.Client.Services
public async Task<string> TestUserApi(int Param) public async Task<string> TestUserApi(int Param)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.UserTest}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.UserTest}";
var response = await http.PostAsJsonAsync(url, Param); var response = await http.PostAsJsonAsync(url, Param);
@ -75,7 +75,7 @@ namespace TIAMWebApp.Client.Services
public async Task<string> AuthenticateUser(LoginModel loginModel) public async Task<string> AuthenticateUser(LoginModel loginModel)
{ {
string result = string.Empty; string result = string.Empty;
var url = $"{Setting.BaseUrl}/{APIUrls.AuthenticateUser}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.AuthenticateUser}";
var response = await http.PostAsJsonAsync(url, loginModel); var response = await http.PostAsJsonAsync(url, loginModel);
@ -107,7 +107,7 @@ namespace TIAMWebApp.Client.Services
bool isSuccess = true; bool isSuccess = true;
string result = string.Empty; string result = string.Empty;
var url = $"{Setting.BaseUrl}/{APIUrls.CreateUser}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateUser}";
logToBrowserConsole.LogToBC("CreateUser url: " + url); logToBrowserConsole.LogToBC("CreateUser url: " + url);
var response = await http.PostAsJsonAsync(url, regModel); var response = await http.PostAsJsonAsync(url, regModel);
result = await response.Content.ReadAsStringAsync(); result = await response.Content.ReadAsStringAsync();
@ -133,13 +133,13 @@ namespace TIAMWebApp.Client.Services
public async Task<UserModelDto?> GetUserByEmailAsync(string email) public async Task<UserModelDto?> GetUserByEmailAsync(string email)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.GetUserByEmail}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetUserByEmail}";
return await http.GetFromJsonAsync<UserModelDto?>(url); return await http.GetFromJsonAsync<UserModelDto?>(url);
} }
public async Task<UserModelDto?> GetUserByIdAsync(Guid id) public async Task<UserModelDto?> GetUserByIdAsync(Guid id)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.GetUserById}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetUserById}";
logToBrowserConsole.LogToBC("GetUserByIdAsync url: " + url + ", " + id.ToString()); logToBrowserConsole.LogToBC("GetUserByIdAsync url: " + url + ", " + id.ToString());
var response = await http.PostAsJsonAsync(url, id); var response = await http.PostAsJsonAsync(url, id);
@ -154,7 +154,7 @@ namespace TIAMWebApp.Client.Services
logToBrowserConsole.LogToBC("RefreshToken() called"); logToBrowserConsole.LogToBC("RefreshToken() called");
bool isTokenRefreshed = false; bool isTokenRefreshed = false;
var url = $"{Setting.BaseUrl}/{APIUrls.RefreshToken}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.RefreshToken}";
//var url = APIUrls.RefreshToken; //var url = APIUrls.RefreshToken;
var serializedStr = JsonConvert.SerializeObject(new AuthenticateRequestAndResponse var serializedStr = JsonConvert.SerializeObject(new AuthenticateRequestAndResponse

View File

@ -1,10 +1,12 @@
using AyCode.Interfaces.Enums; using AyCode.Interfaces.Enums;
using AyCode.Interfaces.Messages; using AyCode.Interfaces.Messages;
using AyCode.Models.Messages; using AyCode.Models.Messages;
using System.Diagnostics;
using TIAM.Entities.Transfers; using TIAM.Entities.Transfers;
//using TIAM.Entities.TransferDestinations; //using TIAM.Entities.TransferDestinations;
using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Interfaces;
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels; using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
using TIAMWebApp.Shared.Application.Utility;
using static AyCode.Interfaces.Enums.IMessageTypes; using static AyCode.Interfaces.Enums.IMessageTypes;
namespace TIAMWebApp.Client.Services namespace TIAMWebApp.Client.Services
@ -33,6 +35,7 @@ namespace TIAMWebApp.Client.Services
return result as TModelType; return result as TModelType;
case "TransferWizardModel": case "TransferWizardModel":
Console.WriteLine("TransferWizardModel");
var transferResult = await TransferDataService.CreateTransfer((TransferWizardModel)data); var transferResult = await TransferDataService.CreateTransfer((TransferWizardModel)data);
return transferResult as TModelType; return transferResult as TModelType;

View File

@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.3",
"commands": [
"dotnet-ef"
]
}
}
}

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
--> -->
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles> <DeleteExistingFiles>true</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data> <ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish> <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration> <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
@ -13,5 +13,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PublishUrl>C:\REPOS\AYCODE\Publish\Server</PublishUrl> <PublishUrl>C:\REPOS\AYCODE\Publish\Server</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod> <WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId> <_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net8.0</TargetFramework>
<ProjectGuid>9d0f60cb-0462-4bdb-91bd-cadb574ab5a5</ProjectGuid>
<SelfContained>false</SelfContained>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -0,0 +1,64 @@
using TIAM.Core.Enums;
using TIAM.Database.DataLayers.Admins;
using TIAM.Database.DataLayers.Users;
using TIAM.Entities.Products;
using TIAM.Entities.Transfers;
namespace TIAMWebApp.Server.Services
{
public class TransferBackendService
{
private readonly IConfiguration _configuration;
public AdminDal _adminDal;
public TransferBackendService(IConfiguration configuration, AdminDal adminDal)
{
_configuration = configuration;
_adminDal = adminDal;
}
public double GetTransferPrice(Guid productId, Guid fromTransferDestinationId, Guid toTranferDestinationId)
{
throw new NotImplementedException();
}
public double GetTransferPrice(Guid productId, TransferDestination fromTransferDestination, TransferDestination toTransferDestination, in byte seatNumber)
{
var product = _adminDal.GetProductById(productId);
if (product == null) return -1;
return GetTransferPrice(product, fromTransferDestination, toTransferDestination, in seatNumber);
}
public double GetTransferPrice(Product product, TransferDestination fromTransferDestination, TransferDestination toTransferDestination, in byte seatNumber)
{
var baseDestination = product.Profile.AddressId == fromTransferDestination.AddressId ? toTransferDestination : fromTransferDestination;
var transferDestinationToProduct = _adminDal.GetTransferDestinationToProduct(product.Id, baseDestination.Id);
var tranferDestinationPrice = transferDestinationToProduct ?? baseDestination as ITransfeDestinationPrices;
var price = GetSeatNumberPrice(in tranferDestinationPrice, seatNumber);
//TODO: ExtraPrice - J.
return price;
}
public double GetSeatNumberPrice(in ITransfeDestinationPrices transfeDestinationPrices, in byte seatNumber)
=> GetSeatNumberPrice(transfeDestinationPrices.Price, transfeDestinationPrices.Price2, transfeDestinationPrices.Price3, seatNumber);
public double GetSeatNumberPrice(in double price, in double? price2, in double? price3, in byte seatNumber)
{
if (seatNumber >= (byte)SeatNumberPriceType.Price3SeatNum)
return price3 ?? price; //TODO: *seatnum percent - J.
if (seatNumber >= (byte)SeatNumberPriceType.Price2SeatNum)
return price2 ?? price; //TODO: *seatnum percent - J.
return price;
}
}
}

View File

@ -10,6 +10,9 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide
{ {
public static UserBasicDetails UserBasicDetails { get; set; } public static UserBasicDetails UserBasicDetails { get; set; }
public const string BaseUrl = "https://localhost:7116"; public const string BaseUrl = "https://localhost:7116";
public const string ApiBaseUrl = "https://localhost:7116";
//public const string BaseUrl = "https://touriam.mangoweb.hu";
//public const string ApiBaseUrl = "https://touriam.mangoweb.hu";
public const bool DarkMode = false; public const bool DarkMode = false;
public static string Locale { get; set; } public static string Locale { get; set; }
} }

View File

@ -43,6 +43,15 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
[Display(Name = ResourceKeys.Price, ResourceType = typeof(TIAMResources))] [Display(Name = ResourceKeys.Price, ResourceType = typeof(TIAMResources))]
public double Price { get; set; } public double Price { get; set; }
[Required(ErrorMessage = "The price should be specified.")]
[DataType("Price")]
[Display(Name = ResourceKeys.Price, ResourceType = typeof(TIAMResources))]
public double? Price2 { get; set; }
[Required(ErrorMessage = "The price should be specified.")]
[DataType("Price")]
[Display(Name = ResourceKeys.Price, ResourceType = typeof(TIAMResources))]
public double? Price3 { get; set; }
public PriceType PriceType { get; set; } public PriceType PriceType { get; set; }
public Address Address { get; set; } public Address Address { get; set; }
@ -57,9 +66,9 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
public TransferDestinationWizardModel() { } public TransferDestinationWizardModel() { }
public TransferDestinationWizardModel(string name, string description, string addressString, double price, Address address) :this(Guid.NewGuid(), name, description, addressString, price, address) public TransferDestinationWizardModel(string name, string description, string addressString, double price, double? price2, double? price3, Address address) :this(Guid.NewGuid(), name, description, addressString, price, price2, price3, address)
{ } { }
public TransferDestinationWizardModel(Guid id, string name, string description, string addressString, double price, Address address) public TransferDestinationWizardModel(Guid id, string name, string description, string addressString, double price, double? price2, double? price3, Address address)
{ {
Id = id.ToString(); Id = id.ToString();
@ -67,10 +76,9 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
Description = description; Description = description;
AddressString = addressString; AddressString = addressString;
Price = price; Price = price;
//Price2 = price2; Price2 = price2;
//Price3 = price3; Price3 = price3;
//ExtraPrice = extraPrice; //PriceType = priceType;
//ExtraPriceType= extraPriceType;
Address = address; Address = address;
} }
@ -84,10 +92,9 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
destination.Description = model.Description; destination.Description = model.Description;
destination.AddressString = model.AddressString; destination.AddressString = model.AddressString;
destination.Price = model.Price; destination.Price = model.Price;
destination.Price2 = model.Price; destination.Price2 = model.Price2;
destination.Price3 = model.Price; destination.Price3 = model.Price3;
//destination.ExtraPrice = model.ExtraPrice; //destination.PriceType = model.PriceType;
//destination.ExtraPriceType= model.ExtraPriceType;
destination.Address = model.Address; destination.Address = model.Address;
if (destination.Address == null) if (destination.Address == null)

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using TIAM.Entities.Transfers;
using TIAM.Resources; using TIAM.Resources;
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
@ -15,15 +16,13 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
{ {
public Guid Id { get; set; } public Guid Id { get; set; }
//[Required(ErrorMessage = "The Username value should be specified.")]
//[Required(ErrorMessage = "The destination address should be specified.")]
[Destination(ErrorMessage = "The destination value is invalid.")] [Destination(ErrorMessage = "The destination value is invalid.")]
[DataType("TransferDestination")] [DataType("TransferDestination")]
[Display(Name = ResourceKeys.Destination, ResourceType = typeof(TIAMResources))] [Display(Name = ResourceKeys.Destination, ResourceType = typeof(TIAMResources))]
public string? Destination { get; set; } public string? Destination { get; set; }
//[Required(ErrorMessage = "The Username value should be specified.")]
//[Required(ErrorMessage = "The pickup address should be specified.")]
[DataType("TransferDestination")] [DataType("TransferDestination")]
[Display(Name = ResourceKeys.PickupAddress, ResourceType = typeof(TIAMResources))] [Display(Name = ResourceKeys.PickupAddress, ResourceType = typeof(TIAMResources))]
public string? PickupAddress { get; set; } public string? PickupAddress { get; set; }
@ -106,6 +105,29 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
Driver = driver; Driver = driver;
} }
public Transfer CopyToTransfer()
{
var transfer = new Transfer
{
Id = this.Id,
ToAddress = this.Destination,
FromAddress = this.PickupAddress,
Appointment = this.TripDate,
PassengerCount = Convert.ToByte(this.NumberOfPassengers),
//FullName = model.FullName,
//PhoneNumber = model.PhoneNumber,
//EmailAddress = model.EmailAddress,
Price = this.Price,
UserProductMappingId = Guid.NewGuid(),
TransferStatusType = TIAM.Core.Enums.TransferStatusType.OrderSubmitted,
Comment = "Transfer order",
};
return transfer;
}
} }
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)] [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false)]

View File

@ -1,28 +1,33 @@
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using TIAM.Entities.Users; using TIAM.Entities.Users;
using TIAM.Models.Dtos.Users;
namespace TIAMWebApp.Shared.Application.Models namespace TIAMWebApp.Shared.Application.Models
{ {
public class UserSessionModel public class UserSessionModel
{ {
//TODO: add user class
public UserModelDto UserModelDto { get; set; }
public Guid UserId { get; set; } public Guid UserId { get; set; }
public UserType UserType { get; set; } public UserType UserType { get; set; }
public string? UserName { get; set; } public string? UserName => UserModelDto?.Profile?.Name;
public string DisplayName => string.IsNullOrWhiteSpace(UserName) ? UserId.ToString() : UserName; public string DisplayName => string.IsNullOrWhiteSpace(UserName) ? UserId.ToString() : UserName;
public Dictionary<Guid, string>? HasProperties { get; set; } public Dictionary<Guid, string>? HasProperties { get; set; }
public int UserRoles { get; set; } public int UserRoles { get; set; }
public Dictionary<int, string> UserRolesDictionary { get; set; } public Dictionary<int, string> UserRolesDictionary { get; set; }
public UserSessionModel(Guid userId, UserType userType, string? userName, Dictionary<Guid, string>? hasProperties, int userRoles) public UserSessionModel(Guid userId, UserType userType, UserModelDto userModelDto, Dictionary<Guid, string>? hasProperties, int userRoles)
{ {
UserId = userId; UserId = userId;
UserType = userType; UserType = userType;
UserName = userName; UserModelDto = userModelDto;
HasProperties = hasProperties; HasProperties = hasProperties;
//UserRoles = userRoles; //UserRoles = userRoles;
//UserRolesDictionary = new Dictionary<int, string>(); //UserRolesDictionary = new Dictionary<int, string>();
//UserModelDto.ServiceProviders[0].
} }
} }

View File

@ -56,7 +56,7 @@ namespace TIAMWebApp.Shared.Application.Services
public async Task<string> UploadImageAsync(MultipartContent image) public async Task<string> UploadImageAsync(MultipartContent image)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.UploadImage}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.UploadImage}";
var response = await _http.PostAsync(url, image); var response = await _http.PostAsync(url, image);
//var result = new WizardProcessorResult(); //var result = new WizardProcessorResult();

View File

@ -23,7 +23,8 @@ namespace TIAMWebApp.Shared.Application.Services
public async Task<List<TransferDestination>> GetDestinationsAsync() public async Task<List<TransferDestination>> GetDestinationsAsync()
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.GetTransferDestinations}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinations}";
//var url = $"{APIUrls.GetTransferDestinations}";
logToBrowserConsole.LogToBC(url); logToBrowserConsole.LogToBC(url);
List<TransferDestination>? response = await http.GetFromJsonAsync<List<TransferDestination>>(url); List<TransferDestination>? response = await http.GetFromJsonAsync<List<TransferDestination>>(url);
if(response == null) if(response == null)
@ -33,19 +34,19 @@ namespace TIAMWebApp.Shared.Application.Services
public async Task<TransferDestination?> GetTransferDestinationbyCoordinatesAsync(string destinationId) public async Task<TransferDestination?> GetTransferDestinationbyCoordinatesAsync(string destinationId)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.GetTransferDestinationByCoordinates}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinationByCoordinates}";
return await http.GetFromJsonAsync<TransferDestination>(url); return await http.GetFromJsonAsync<TransferDestination>(url);
} }
public async Task<TransferDestination?> GetTransferDestinationbyAddressAsync(string destinationId) public async Task<TransferDestination?> GetTransferDestinationbyAddressAsync(string destinationId)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.GetTransferDestinationByAddress}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.GetTransferDestinationByAddress}";
return await http.GetFromJsonAsync<TransferDestination>(url); return await http.GetFromJsonAsync<TransferDestination>(url);
} }
public async Task<TransferDestination?> CreateTransferDestination(TransferDestination model) public async Task<TransferDestination?> CreateTransferDestination(TransferDestination model)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.CreateTransferDestination}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransferDestination}";
var response = await http.PostAsJsonAsync(url, model); var response = await http.PostAsJsonAsync(url, model);
//var result = new WizardProcessorResult(); //var result = new WizardProcessorResult();
@ -66,9 +67,19 @@ namespace TIAMWebApp.Shared.Application.Services
public async Task<TransferWizardModel?> CreateTransfer(TransferWizardModel model) public async Task<TransferWizardModel?> CreateTransfer(TransferWizardModel model)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.CreateTransferDestination}"; logToBrowserConsole.LogToBC("CreateTransfer called");
logToBrowserConsole.LogToBC(model.PickupAddress);
logToBrowserConsole.LogToBC(model.Destination);
logToBrowserConsole.LogToBC(model.EmailAddress);
logToBrowserConsole.LogToBC(model.PhoneNumber);
logToBrowserConsole.LogToBC(model.TripDate.ToString());
logToBrowserConsole.LogToBC(model.NumberOfPassengers.ToString());
model.Id = Guid.NewGuid();
var url = $"{Setting.ApiBaseUrl}/{APIUrls.CreateTransfer}";
var response = await http.PostAsJsonAsync(url, model); var response = await http.PostAsJsonAsync(url, model);
//var result = new WizardProcessorResult(); //var result = new WizardProcessorResult();
//if (response.IsSuccessStatusCode) //if (response.IsSuccessStatusCode)
@ -87,7 +98,7 @@ namespace TIAMWebApp.Shared.Application.Services
public async Task<TransferDestination?> UpdateTransferDestination(TransferDestination model) public async Task<TransferDestination?> UpdateTransferDestination(TransferDestination model)
{ {
var url = $"{Setting.BaseUrl}/{APIUrls.UpdateTransferDestination}"; var url = $"{Setting.ApiBaseUrl}/{APIUrls.UpdateTransferDestination}";
var response = await http.PostAsJsonAsync(url, model); var response = await http.PostAsJsonAsync(url, model);
//var result = new WizardProcessorResult(); //var result = new WizardProcessorResult();

View File

@ -22,6 +22,8 @@
public const string ConfirmPasswordReset = "ConfirmPasswordReset"; public const string ConfirmPasswordReset = "ConfirmPasswordReset";
public const string ConfirmEmail = "ConfirmEmail"; public const string ConfirmEmail = "ConfirmEmail";
public const string Price = "Price"; public const string Price = "Price";
public const string Price2 = "Price 2";
public const string Price3 = "Price 3";
public const string Driver = "Driver"; public const string Driver = "Driver";
//wizard //wizard