diff --git a/TIAM.Core/Consts/TiamConst.cs b/TIAM.Core/Consts/TiamConst.cs index 7c0868b7..2206e6e1 100644 --- a/TIAM.Core/Consts/TiamConst.cs +++ b/TIAM.Core/Consts/TiamConst.cs @@ -67,10 +67,10 @@ public static class TiamConstClient }; #if RELEASE -public static string SystemEmailAddress = "system@touriam.com"; +public static string SystemEmailAddress = "test@touriam.com"; public static LogLevel DefaultLogLevelClient = LogLevel.Debug; #else - public static string SystemEmailAddress = "system@anataworld.com"; + public static string SystemEmailAddress = "test@touriam.com"; public static LogLevel DefaultLogLevelClient = LogLevel.Detail; #endif } diff --git a/TIAM.Core/Enums/SeatNumberPriceType.cs b/TIAM.Core/Enums/SeatNumberPriceType.cs index bd9673e4..ea26d1d0 100644 --- a/TIAM.Core/Enums/SeatNumberPriceType.cs +++ b/TIAM.Core/Enums/SeatNumberPriceType.cs @@ -3,6 +3,6 @@ public enum SeatNumberPriceType : byte { Price1SeatNum = 0, - Price2SeatNum = 4, - Price3SeatNum = 8, + Price2SeatNum = 5, + Price3SeatNum = 7, } \ No newline at end of file diff --git a/TIAM.Database.Test/AdminDalTest.cs b/TIAM.Database.Test/AdminDalTest.cs index 7e4aa2bf..19318e2b 100644 --- a/TIAM.Database.Test/AdminDalTest.cs +++ b/TIAM.Database.Test/AdminDalTest.cs @@ -14,7 +14,7 @@ using AyCode.Core.Extensions; using Microsoft.Extensions.DependencyInjection; using TIAM.Entities.ServiceProviders; using TIAM.Entities.Addresses; -using DevExpress.Pdf.Native.BouncyCastle.Asn1.Ocsp; +//using DevExpress.Pdf.Native.BouncyCastle.Asn1.Ocsp; namespace TIAM.Database.Test { diff --git a/TIAM.Database.Test/TIAM.Database.Test.csproj b/TIAM.Database.Test/TIAM.Database.Test.csproj index 23c47fb9..fe454c77 100644 --- a/TIAM.Database.Test/TIAM.Database.Test.csproj +++ b/TIAM.Database.Test/TIAM.Database.Test.csproj @@ -23,10 +23,10 @@ - - - - + + + + diff --git a/TIAM.Database/DataLayers/Admins/AdminDal.cs b/TIAM.Database/DataLayers/Admins/AdminDal.cs index 25e2ab7d..83d49ecd 100644 --- a/TIAM.Database/DataLayers/Admins/AdminDal.cs +++ b/TIAM.Database/DataLayers/Admins/AdminDal.cs @@ -34,6 +34,7 @@ using AyCode.Interfaces.Entities; using TIAM.Models; using TIAM.Models.Dtos.Users; using TIAM.Models.PageViewModels; +using EmailMessage = TIAM.Entities.Emails.EmailMessage; namespace TIAM.Database.DataLayers.Admins { diff --git a/TIAM.Database/DataLayers/Users/UserDal.cs b/TIAM.Database/DataLayers/Users/UserDal.cs index 63c3373a..2b425e6a 100644 --- a/TIAM.Database/DataLayers/Users/UserDal.cs +++ b/TIAM.Database/DataLayers/Users/UserDal.cs @@ -10,6 +10,7 @@ using TIAM.Entities.ServiceProviders; using TIAM.Entities.Users; using TIAM.Models; using TIAM.Models.Dtos.Users; +using EmailMessage = TIAM.Entities.Emails.EmailMessage; namespace TIAM.Database.DataLayers.Users { diff --git a/TIAM.Database/DbSets/Transfers/TransferToDriverDbSetExtensions.cs b/TIAM.Database/DbSets/Transfers/TransferToDriverDbSetExtensions.cs index b924a75c..1251a877 100644 --- a/TIAM.Database/DbSets/Transfers/TransferToDriverDbSetExtensions.cs +++ b/TIAM.Database/DbSets/Transfers/TransferToDriverDbSetExtensions.cs @@ -10,11 +10,32 @@ namespace TIAM.Database.DbSets.Transfers; public static class TransferToDriverDbSetExtensions { #region TransferToDriver + public static TransferToDriver? GetTransferToDriverById(this ITransferToDriverDbSet ctx, Guid transferToDriverId, bool autoInclude = true) - => ctx.TransferToDrivers.FirstOrDefault(x => x.Id == transferToDriverId); + => ctx.TransferToDrivers + .Where(x => x.Id == transferToDriverId) + .Include(x => x.UserProductMapping.User.Products).ThenInclude(x => x.UserProductMappings) + .Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products) + .Include(x => x.UserProductMapping.User.Profile.Address) + .Include(x => x.Transfer) + .FirstOrDefault(x => x.Id == transferToDriverId); public static IQueryable GetTransferToDriversByTransferId(this ITransferToDriverDbSet ctx, Guid transferId, bool autoInclude = true) - => ctx.TransferToDrivers.Where(x => x.TransferId == transferId); + => ctx.TransferToDrivers + .Where(x => x.TransferId == transferId) + .Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products) + .Include(x => x.UserProductMapping.User.Profile.Address) + .Include(x => x.Transfer); + + //.Include(x => x.UserProductMapping.User.Products).ThenInclude(x => x.UserProductMappings) + //.Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products) + //.Include(x => x.UserProductMapping.User.Profile.Address) + //.Include(x => x.Transfer); + + //.Include(x => x.UserProductMapping.User.Products).ThenInclude(x => x.UserProductMappings).ThenInclude(x => x.User.Profile.Address) + //.Include(x => x.Car.UserProductMapping.Product.ServiceProvider).ThenInclude(x => x.Products) + //.Include(x => x.UserProductMapping.User.Profile.Address) + //.Include(x => x.Transfer); public static IQueryable GetTransferToDriversByUpmId(this ITransferToDriverDbSet ctx, Guid upmId, bool autoInclude = true) => ctx.TransferToDrivers.Where(x => x.UserProductMappingId == upmId); diff --git a/TIAM.Database/TIAM.Database.csproj b/TIAM.Database/TIAM.Database.csproj index 4f3680c7..aa503f88 100644 --- a/TIAM.Database/TIAM.Database.csproj +++ b/TIAM.Database/TIAM.Database.csproj @@ -7,11 +7,11 @@ - + - - - + + + diff --git a/TIAM.Database/TIAM.Database.csproj.bak b/TIAM.Database/TIAM.Database.csproj.bak new file mode 100644 index 00000000..1a5f2b4e --- /dev/null +++ b/TIAM.Database/TIAM.Database.csproj.bak @@ -0,0 +1,68 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Core.Server.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Database.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Entities.Server.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Interfaces.Server.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Models.Server.dll + + + ..\..\AyCode.Core\AyCode.Services.Server\bin\Debug\net8.0\AyCode.Utils.dll + + + + diff --git a/TIAM.Models.Server/TIAM.Models.Server.csproj b/TIAM.Models.Server/TIAM.Models.Server.csproj index ac3f432d..da7fe4cd 100644 --- a/TIAM.Models.Server/TIAM.Models.Server.csproj +++ b/TIAM.Models.Server/TIAM.Models.Server.csproj @@ -6,6 +6,10 @@ enable + + + + diff --git a/TIAM.Models/SiteViewModel.cs b/TIAM.Models/SiteViewModel.cs index 7d4edb52..7f1c6de8 100644 --- a/TIAM.Models/SiteViewModel.cs +++ b/TIAM.Models/SiteViewModel.cs @@ -1,6 +1,7 @@ using AyCode.Blazor.Models.ViewModels; using TIAM.Entities.Emails; using TIAM.Models.PageViewModels; +using EmailMessage = TIAM.Entities.Emails.EmailMessage; namespace TIAM.Models; diff --git a/TIAM.Models/TIAM.Models.csproj b/TIAM.Models/TIAM.Models.csproj index 140b006b..b610560d 100644 --- a/TIAM.Models/TIAM.Models.csproj +++ b/TIAM.Models/TIAM.Models.csproj @@ -12,6 +12,10 @@ + + + + diff --git a/TIAM.Services.Server.Tests/appsettings.json b/TIAM.Services.Server.Tests/appsettings.json index e3c21245..a465b2e3 100644 --- a/TIAM.Services.Server.Tests/appsettings.json +++ b/TIAM.Services.Server.Tests/appsettings.json @@ -1,7 +1,6 @@ { "ConnectionStrings": { - "DeveloperDbConnection": - "Data Source=185.51.190.197;Initial Catalog=TIAM_DEV;Trusted_Connection=false;Encrypt=false;TrustServerCertificate=True;Connect Timeout=200;User ID=Anata_Development_Team;Password=v6f_?xNfg9N1;MultipleActiveResultSets=true" + "DeveloperDbConnection": "Data Source=195.26.231.218;Initial Catalog=TIAM_DEV;Trusted_Connection=false;Encrypt=false;TrustServerCertificate=True;Connect Timeout=200;User ID=sa;Password=v6f_?xNfg9N1;MultipleActiveResultSets=true" }, "Logging": { "LogLevel": { diff --git a/TIAM.Services.Server/MessageSenderService.cs b/TIAM.Services.Server/MessageSenderService.cs index 72e24852..91fb47f5 100644 --- a/TIAM.Services.Server/MessageSenderService.cs +++ b/TIAM.Services.Server/MessageSenderService.cs @@ -1,4 +1,5 @@ using System.Net; +using System.Net.Mail; using AyCode.Core.Helpers; using AyCode.Models.Enums; using Microsoft.Extensions.Configuration; @@ -13,6 +14,11 @@ namespace TIAM.Services.Server { public class MessageSenderService(IConfiguration configuration, AdminDal adminDal) : IMessageSenderService { + private readonly string smtpHost = "smtp.rackhost.hu"; + private readonly int smtpPort = 587; // Change if needed + private readonly string smtpUser = "system@touriam.com"; + private readonly string smtpPass = "Villany1"; + public async Task SendMessageAsync(EmailMessage message, int messageType) { var result = ""; @@ -24,7 +30,8 @@ namespace TIAM.Services.Server //var subject = emailMessage.Subject; //adminDal.AddEmailMessageAsync(message).Forget(); - result = (await SendMailWithSendgrid(message)).ToString(); //?? HttpStatusCode.BadRequest.ToString(); + //result = (await SendMailWithSendgrid(message)).ToString(); //?? HttpStatusCode.BadRequest.ToString(); + result = (await SendMailWithSmtp(message)).ToString(); //?? HttpStatusCode.BadRequest.ToString(); break; case (int)MessageTypesEnum.sms: //await SendSmsWithTwilio(message.Message); @@ -159,6 +166,197 @@ namespace TIAM.Services.Server } + + //public async Task SendMailWithSmtp(EmailMessage message) + //{ + // Console.WriteLine($"Sender: {message.SenderId}"); + // Console.WriteLine($"Message: {message.Text}"); + + // if (message.Recipients == null || !message.Recipients.Any()) + // { + // return HttpStatusCode.BadRequest; + // } + + // using (var smtpClient = new SmtpClient(smtpHost, smtpPort)) + // { + // smtpClient.Credentials = new NetworkCredential(smtpUser, smtpPass); + // smtpClient.EnableSsl = true; + + // var fromAddress = new MailAddress(smtpUser, "Your Mail Service"); + + // List sendTasks = new List(); + + // foreach (var recipient in message.Recipients) + // { + // var toAddress = new MailAddress(recipient.EmailAddress); + // var mailMessage = new MailMessage(fromAddress, toAddress) + // { + // Subject = message.Subject, + // Body = message.Text, + // IsBodyHtml = true + // }; + + // //sendTasks.Add(Task.Run(() => smtpClient.SendMailAsync(mailMessage))); + // sendTasks.Add(smtpClient.SendMailAsync(mailMessage)); + // } + + // try + // { + // await Task.WhenAll(sendTasks); + // Console.WriteLine("All emails sent successfully"); + // return HttpStatusCode.OK; + // } + // catch (Exception ex) + // { + // Console.WriteLine($"Failed to send emails: {ex.Message}"); + // return HttpStatusCode.InternalServerError; + // } + // } + //} + + //public async Task SendMailWithSmtp(EmailMessage message) + //{ + // Console.WriteLine($"Sender: {message.SenderId}"); + // Console.WriteLine($"Message: {message.Text}"); + + // if (message.Recipients == null || !message.Recipients.Any()) + // { + // return HttpStatusCode.BadRequest; + // } + + // List sendTasks = new List(); + + // foreach (var recipient in message.Recipients) + // { + // var smtpClient = new SmtpClient(smtpHost, smtpPort) + // { + // Credentials = new NetworkCredential(smtpUser, smtpPass), + // EnableSsl = true, + // TargetName = $"SMTPS/{smtpHost}" + // }; + + // var fromAddress = new MailAddress(smtpUser, "Your Mail Service"); + // var toAddress = new MailAddress(recipient.EmailAddress); + // var mailMessage = new MailMessage(fromAddress, toAddress) + // { + // Subject = message.Subject, + // Body = message.Text, + // IsBodyHtml = true + // }; + + // sendTasks.Add(Task.Run(async () => + // { + // try + // { + // await smtpClient.SendMailAsync(mailMessage); + // } + // catch (Exception ex) + // { + // Console.WriteLine($"Failed to send email to {recipient.EmailAddress}: {ex.Message}"); + // throw; // Ensure exceptions bubble up + // } + // finally + // { + // smtpClient.Dispose(); + // } + // })); + // } + + // var timeoutTask = Task.Delay(TimeSpan.FromSeconds(30)); // Prevent indefinite waiting + // var allTasks = Task.WhenAll(sendTasks); + // var completedTask = await Task.WhenAny(allTasks, timeoutTask); + + // if (completedTask == timeoutTask) + // { + // Console.WriteLine("Email sending timed out."); + // return HttpStatusCode.RequestTimeout; + // } + + // try + // { + // await allTasks; // Rethrow if there were failures + // Console.WriteLine("All emails sent successfully"); + // return HttpStatusCode.OK; + // } + // catch (Exception) + // { + // Console.WriteLine("Some emails failed to send"); + // return HttpStatusCode.InternalServerError; + // } + //} + + public async Task SendMailWithSmtp(EmailMessage message) + { + Console.WriteLine($"Sender: {message.SenderId}"); + Console.WriteLine($"Message: {message.Text}"); + + if (message.Recipients == null || !message.Recipients.Any()) + { + return HttpStatusCode.BadRequest; + } + + List sendTasks = new List(); + + foreach (var recipient in message.Recipients) + { + sendTasks.Add(Task.Run(async () => + { + try + { + using (var smtpClient = new SmtpClient(smtpHost, smtpPort)) + { + smtpClient.Credentials = new NetworkCredential(smtpUser, smtpPass); + smtpClient.EnableSsl = true; // Try false for port 587 + smtpClient.TargetName = $"SMTPS/{smtpHost}"; + + var fromAddress = new MailAddress(smtpUser, "Your Mail Service"); + var toAddress = new MailAddress(recipient.EmailAddress); + var mailMessage = new MailMessage(fromAddress, toAddress) + { + Subject = message.Subject, + Body = message.Text, + IsBodyHtml = true + }; + + await smtpClient.SendMailAsync(mailMessage); + } + } + catch (Exception ex) + { + Console.WriteLine($"Failed to send email to {recipient.EmailAddress}: {ex.Message}"); + if (ex.InnerException != null) + { + Console.WriteLine($"Inner Exception: {ex.InnerException.Message}"); + } + throw; + } + })); + } + + var timeoutTask = Task.Delay(TimeSpan.FromSeconds(30)); // Prevent indefinite waiting + var allTasks = Task.WhenAll(sendTasks); + var completedTask = await Task.WhenAny(allTasks, timeoutTask); + + if (completedTask == timeoutTask) + { + Console.WriteLine("Email sending timed out."); + return HttpStatusCode.RequestTimeout; + } + + try + { + await allTasks; // Rethrow if there were failures + Console.WriteLine("All emails sent successfully"); + return HttpStatusCode.OK; + } + catch (Exception) + { + Console.WriteLine("Some emails failed to send"); + return HttpStatusCode.InternalServerError; + } + } + + public string GenerateWelcomeEmail(string userName, string activationCode) { string template = EmailTemplateHelper.GetTemplate(TiamConstClient.WelcomeEmailTemplateName); diff --git a/TIAM.Services.Server/Properties/PublishProfiles/FolderProfile.pubxml b/TIAM.Services.Server/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 00000000..5292d499 --- /dev/null +++ b/TIAM.Services.Server/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,11 @@ + + + + + Release + Any CPU + D:\REPOS\TOURIAM_PUBLISH + FileSystem + <_TargetId>Folder + + \ No newline at end of file diff --git a/TIAM.Services.Server/TIAM.Services.Server.csproj b/TIAM.Services.Server/TIAM.Services.Server.csproj index c4631780..6c4cb449 100644 --- a/TIAM.Services.Server/TIAM.Services.Server.csproj +++ b/TIAM.Services.Server/TIAM.Services.Server.csproj @@ -30,6 +30,7 @@ + diff --git a/TIAM.Services.Server/TransferBackendService.cs b/TIAM.Services.Server/TransferBackendService.cs index dc5133ce..f9a53bcb 100644 --- a/TIAM.Services.Server/TransferBackendService.cs +++ b/TIAM.Services.Server/TransferBackendService.cs @@ -62,7 +62,7 @@ namespace TIAM.Services.Server }; } - public double GetCommission(Guid productId, double Price, TransferDestination to) + public double GetCommission(Guid productId, double price, TransferDestination to) { //check if Destination has a custom commissionRate by productId double commissionRate = 0; @@ -92,7 +92,7 @@ namespace TIAM.Services.Server } } - commission = GetCommission(Price, commissionRate); + commission = GetCommission(price, commissionRate); return commission; } diff --git a/TIAM.Services/TIAM.Services.csproj b/TIAM.Services/TIAM.Services.csproj index 5c1bbbf6..a78390c0 100644 --- a/TIAM.Services/TIAM.Services.csproj +++ b/TIAM.Services/TIAM.Services.csproj @@ -6,6 +6,10 @@ enable + + + + diff --git a/TIAMMobileApp/TIAMMobileApp.csproj b/TIAMMobileApp/TIAMMobileApp.csproj index d629aee7..7d88e593 100644 --- a/TIAMMobileApp/TIAMMobileApp.csproj +++ b/TIAMMobileApp/TIAMMobileApp.csproj @@ -53,7 +53,7 @@ - + diff --git a/TIAMMobileApp/TIAMMobileApp.csproj.user b/TIAMMobileApp/TIAMMobileApp.csproj.user index 528bd322..47e18f32 100644 --- a/TIAMMobileApp/TIAMMobileApp.csproj.user +++ b/TIAMMobileApp/TIAMMobileApp.csproj.user @@ -2,8 +2,8 @@ False - net8.0-windows10.0.19041.0 - Windows Machine + net8.0-maccatalyst + Mac Catalyst PhysicalDevice pixel_5_-_api_31 diff --git a/TIAMResources/TIAMResources.Designer.cs b/TIAMResources/TIAMResources.Designer.cs index f6b295db..6bb0f44b 100644 --- a/TIAMResources/TIAMResources.Designer.cs +++ b/TIAMResources/TIAMResources.Designer.cs @@ -384,6 +384,15 @@ namespace TIAM.Resources { } } + /// + /// Looks up a localized string similar to Who we are. + /// + public static string Index_WhoWeAre { + get { + return ResourceManager.GetString("Index.WhoWeAre", resourceCulture); + } + } + /// /// Looks up a localized string similar to Login. /// @@ -456,6 +465,24 @@ namespace TIAM.Resources { } } + /// + /// Looks up a localized string similar to Book now!. + /// + public static string NavMenu_BookNow { + get { + return ResourceManager.GetString("NavMenu.BookNow", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Contact. + /// + public static string NavMenu_Contact { + get { + return ResourceManager.GetString("NavMenu.Contact", resourceCulture); + } + } + /// /// Looks up a localized string similar to Events. /// @@ -465,6 +492,15 @@ namespace TIAM.Resources { } } + /// + /// Looks up a localized string similar to Explore the region. + /// + public static string NavMenu_ExploreTheRegion { + get { + return ResourceManager.GetString("NavMenu.ExploreTheRegion", resourceCulture); + } + } + /// /// Looks up a localized string similar to FormulaOne. /// @@ -483,6 +519,15 @@ namespace TIAM.Resources { } } + /// + /// Looks up a localized string similar to How it works. + /// + public static string NavMenu_HowItWorks { + get { + return ResourceManager.GetString("NavMenu.HowItWorks", resourceCulture); + } + } + /// /// Looks up a localized string similar to Login. /// @@ -510,6 +555,15 @@ namespace TIAM.Resources { } } + /// + /// Looks up a localized string similar to Signature ride packages. + /// + public static string NavMenu_SignatureRidePackages { + get { + return ResourceManager.GetString("NavMenu.SignatureRidePackages", resourceCulture); + } + } + /// /// Looks up a localized string similar to Sign out. /// diff --git a/TIAMResources/TIAMResources.hu.resx b/TIAMResources/TIAMResources.hu.resx index 3954816d..1e07d28f 100644 --- a/TIAMResources/TIAMResources.hu.resx +++ b/TIAMResources/TIAMResources.hu.resx @@ -249,15 +249,27 @@ Adminisztráció + + Foglalj most! + + + Kapcsolat + Események + + Fedezd fel a térséget + Forma1 Főoldal + + Miben más a TourIam + Belépés @@ -267,6 +279,9 @@ Beállítások + + Túrák + Kijelentkezés diff --git a/TIAMResources/TIAMResources.resx b/TIAMResources/TIAMResources.resx index 786eb3e8..33c7abbe 100644 --- a/TIAMResources/TIAMResources.resx +++ b/TIAMResources/TIAMResources.resx @@ -225,6 +225,9 @@ Do you need a lift? Book a transfer now! + + Who we are + Login @@ -249,15 +252,27 @@ Admin + + Book now! + + + Contact + Events + + Explore the region + FormulaOne Home + + How it works + Login @@ -267,6 +282,9 @@ Settings + + Signature ride packages + Sign out diff --git a/TIAMSharedUI/Pages/AboutPage.razor b/TIAMSharedUI/Pages/AboutPage.razor index 768871a9..ec1eb036 100644 --- a/TIAMSharedUI/Pages/AboutPage.razor +++ b/TIAMSharedUI/Pages/AboutPage.razor @@ -19,10 +19,6 @@ At Tour I Am, we understand the importance of a seamless and comfortable journey for our valued customers. Whether you're arriving in Budapest for business or leisure, our dedicated team ensures that your transfer experience is hassle-free and enjoyable. - - - -

diff --git a/TIAMSharedUI/Pages/Blog/BlogListing.razor b/TIAMSharedUI/Pages/Blog/BlogListing.razor new file mode 100644 index 00000000..e071afef --- /dev/null +++ b/TIAMSharedUI/Pages/Blog/BlogListing.razor @@ -0,0 +1,111 @@ +@page "/explore-the-region" +@using TIAMSharedUI.Pages.Components +@using TIAMSharedUI.Shared +@using TIAMWebApp.Shared.Application.Models +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI +@using TIAMWebApp.Shared.Application.Services +@inject BlogService BlogService + + + +

+

Blog Posts

+

+ Discover the hidden gems and breathtaking landscapes of Hungary! Our blog features inspiring destinations, scenic routes, and must-see spots that invite you to explore the natural beauty of this enchanting country. Whether you're planning your next adventure or simply dreaming of a getaway, let these stories guide your journey. +

+ + @if (posts == null) + { +

Loading blog posts...

+ } + else if (posts.Count == 0) + { +

No blog posts found.

+ } + else + { + @*
*@ +
+ @foreach (var post in posts) + { +
+
+ @if (!string.IsNullOrEmpty(post.CoverImage)) + { + @post.Title + } +
+
@post.Title
+ @if (!string.IsNullOrEmpty(post.Lead)) + { + +

@post.Lead

+ } + @if (post.Tags?.Count > 0) + { +

+ @string.Join(", ", post.Tags) +

+ } + Read More +
+
+
+ @* +
+
+

@post.Title

+

@post.Tags

+

@post.Lead

+

@post.Id

+
+ by + +
+
+
+
*@ + } + @*
*@ +
+ } + + + + +@code { + private List? posts; + + protected override async Task OnInitializedAsync() + { + posts = await BlogService.GetAllPostsAsync(); + } + + public List sliders = new() + { + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Explore Our Programs", + ButtonUrl= "/signature-ride-packages" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1549877452-9c387954fbc2?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Book now", + ButtonUrl= "/transfer" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "", + ImageUrl = "https://images.unsplash.com/photo-1507622560124-621e26755fb8?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "", + ButtonUrl= "" + } + }; +} diff --git a/TIAMSharedUI/Pages/Blog/BlogPost.razor b/TIAMSharedUI/Pages/Blog/BlogPost.razor new file mode 100644 index 00000000..f80ba31c --- /dev/null +++ b/TIAMSharedUI/Pages/Blog/BlogPost.razor @@ -0,0 +1,133 @@ +@page "/blogpost/{PostId}" +@using TIAMSharedUI.Pages.Components +@using TIAMSharedUI.Shared +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI +@using TIAMWebApp.Shared.Application.Services +@inject HttpClient Http +@inject BlogService BlogService + + + +@if (Content == null) +{ +

Loading post...

+} +else +{ +
+ +
+ @((MarkupString)Content) +
+ + @if (Tags?.Count > 0) + { +

+ Tags: @string.Join(", ", Tags) +

+ } +
+} + + + +@code { + [Parameter] + public string PostId { get; set; } + + private string? Content; + private string? Title; + private string? CoverImage; + private List? Tags; + + + + + protected override async Task OnParametersSetAsync() + { + try + { + var post = await BlogService.GetPostByIdAsync(PostId); + if (post != null) + { + Title = post.Title; + CoverImage = post.CoverImage; + Tags = post.Tags; + + // ✅ Extract fileId from DriveLink: + var fileId = ExtractGoogleDriveFileId(post.DriveLink); + if (!string.IsNullOrEmpty(fileId)) + { + // string apiKey = "AIzaSyBLKx4XFpgX97sULTbtpyKA2Ca_ANrjxxs"; // your existing key + // // string downloadUrl = $"https://www.googleapis.com/drive/v3/files/{fileId}?alt=media&key={apiKey}"; + // string downloadUrl = $"https://drive.google.com/uc?export=download&id={fileId}"; + // Content = await Http.GetStringAsync(downloadUrl); + + Content = null; // Optional: clear previous content while loading new + + try + { + Content = await Http.GetStringAsync($"/api/blog/postcontent/{PostId}"); + } + catch + { + Content = "

Failed to load blog post.

"; + } + + } + else + { + Content = "

Invalid Google Drive link in post metadata.

"; + } + } + } + catch (Exception e) + { + + Content = "

Failed to load blog post. " + e.ToString()+ "

"; + } + } + + private string? ExtractGoogleDriveFileId(string driveLink) + { + try + { + // Works with typical Google Drive URLs + var match = System.Text.RegularExpressions.Regex.Match(driveLink, @"\/d\/([^\/]+)"); + return match.Success ? match.Groups[1].Value : null; + } + catch + { + return null; + } + } + + + public List sliders = new() + { + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Explore Our Programs", + ButtonUrl= "/signature-ride-packages" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1549877452-9c387954fbc2?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Book now", + ButtonUrl= "/transfer" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "", + ImageUrl = "https://images.unsplash.com/photo-1507622560124-621e26755fb8?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "", + ButtonUrl= "" + } + }; +} diff --git a/TIAMSharedUI/Pages/Components/AuctionStep1.razor b/TIAMSharedUI/Pages/Components/AuctionStep1.razor index 599d028e..5dcf586d 100644 --- a/TIAMSharedUI/Pages/Components/AuctionStep1.razor +++ b/TIAMSharedUI/Pages/Components/AuctionStep1.razor @@ -1,4 +1,5 @@ -@using TIAMWebApp.Shared.Application.Models.PageModels; +@using DevExpress.Blazor +@using TIAMWebApp.Shared.Application.Models.PageModels; @using TIAMWebApp.Shared.Application.Models; @using TIAMWebApp.Shared.Application.Interfaces; @inject ISessionServiceClient sessionService; diff --git a/TIAMSharedUI/Pages/Components/CallToActionComponent.razor b/TIAMSharedUI/Pages/Components/CallToActionComponent.razor index 2a62e1ec..3fb36d09 100644 --- a/TIAMSharedUI/Pages/Components/CallToActionComponent.razor +++ b/TIAMSharedUI/Pages/Components/CallToActionComponent.razor @@ -1,10 +1,10 @@ -
-
+
+
-

JOIN OUR COMMUNITY

+

READY TO GO?

@@ -14,7 +14,7 @@
- +
diff --git a/TIAMSharedUI/Pages/Components/DriverDisplayNameComponent.razor b/TIAMSharedUI/Pages/Components/DriverDisplayNameComponent.razor new file mode 100644 index 00000000..8e36a893 --- /dev/null +++ b/TIAMSharedUI/Pages/Components/DriverDisplayNameComponent.razor @@ -0,0 +1,55 @@ +@using System.Text +@using AyCode.Core.Helpers +@using TIAM.Entities.Transfers +@using TIAM.Services +@using TIAMWebApp.Shared.Application.Services +@inject AdminSignalRClient _adminSignalRClient; + +

@DriverName

+ +@code { + [Parameter] public Guid TransferId { get; set; } + private string DriverName = ""; + + protected override void OnParametersSet() + { + _adminSignalRClient.GetByIdAsync>(SignalRTags.GetTransferDriversByTransferId, x => + { + //await Task.Delay(1); + var keyItemTransferToDriver = x.ResponseData; + + if (keyItemTransferToDriver != null && keyItemTransferToDriver.Count > 0) + { + foreach (var driver in keyItemTransferToDriver) + { + if (driver != null && driver.UserProductMapping != null) + { + if (driver.UserProductMapping.User != null) + { + + if (driver.UserProductMapping.User.Profile != null) + { + if (!string.IsNullOrEmpty(driver.UserProductMapping.User.Profile.Name)) + { + DriverName = driver.UserProductMapping.User.Profile.Name; + } + else + { + DriverName = driver.LicencePlate; + } + } + } + + } + } + + } + else + { + DriverName = "No driver assigned yet"; + } + + return Task.CompletedTask; + }, TransferId).Forget(); + } +} diff --git a/TIAMSharedUI/Pages/Components/TransferStep1.razor b/TIAMSharedUI/Pages/Components/TransferStep1.razor index 1978b025..709c2caa 100644 --- a/TIAMSharedUI/Pages/Components/TransferStep1.razor +++ b/TIAMSharedUI/Pages/Components/TransferStep1.razor @@ -1,4 +1,5 @@ -@using TIAMWebApp.Shared.Application.Models; +@using DevExpress.Blazor +@using TIAMWebApp.Shared.Application.Models; @using TIAMWebApp.Shared.Application.Interfaces; @inject ISessionServiceClient sessionService; diff --git a/TIAMSharedUI/Pages/EditTransfers.razor b/TIAMSharedUI/Pages/EditTransfers.razor index 01c5426d..c1fc7554 100644 --- a/TIAMSharedUI/Pages/EditTransfers.razor +++ b/TIAMSharedUI/Pages/EditTransfers.razor @@ -38,15 +38,15 @@
+@bind-Visible="@_popupVisible" +ShowFooter="true" +CloseOnEscape="true" +CloseOnOutsideClick="false" +ShowCloseButton="false" +HeaderText="MessageBox" +Closing="EmailPopupClosing" +Closed="EmailPopupClosed" +SizeMode="SizeMode.Large"> @{ if(showResultMessage) @@ -56,14 +56,14 @@ else { + OnSubmit="SubmitForm" + TitleString="New message" + ButtonTextString="Send message" + isEditing="true" + IgnoreReflection=@IgnoreList> } } - + @{ @@ -84,7 +84,7 @@
} } - + @@ -92,8 +92,8 @@ {
+ CssClass="m-auto" + AnimationType="WaitIndicatorAnimationType.Spin" />
} @@ -152,11 +152,11 @@ else } } - +

Status on: @DateTime.Now.ToString("hh:mm tt"), @DateTime.Today.ToString("MMMM dd, yyyy")

-
@TransferStatusModel.GetStatusModel(_transfer.TransferStatusType);
- +
@TransferStatusModel.GetStatusModel(_transfer.TransferStatusType).StatusName;
+
@@ -175,7 +175,7 @@ else
Cancel
} } - +
@{ if(_transfer.Price != null || _transfer.Price != 0) @@ -184,7 +184,7 @@ else
} } - + @*
Modify
*@
Modify
@@ -251,7 +251,7 @@ else - + @@ -267,7 +267,7 @@ else - +
@@ -276,6 +276,7 @@ else
@@ -292,7 +293,7 @@ else
- + @@ -523,8 +524,14 @@ else private async Task UpdateTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false) { var result = await UpdateTransfer(shouldRedirect); + _editMode = false; if (result != null && shouldRedirect) - navManager.NavigateTo("/mytransfers"); // Redirect to a list or another page after successful update + navManager.NavigateTo($"/mytransfers/{_transfer.Id}"); // Redirect to a list or another page after successful update + } + + private async Task CancelTransferEventHandler(MouseEventArgs e, bool shouldRedirect = false) + { + _editMode = false; } private async Task UpdateTransfer(bool shouldRedirect = false) diff --git a/TIAMSharedUI/Pages/Events.razor b/TIAMSharedUI/Pages/Events.razor index 1e1f1a78..2129e8a1 100644 --- a/TIAMSharedUI/Pages/Events.razor +++ b/TIAMSharedUI/Pages/Events.razor @@ -20,7 +20,7 @@
- +

@item.Name

@item.DateAndTime

@@ -37,14 +37,7 @@ } } - - - - - - - - +
@@ -102,4 +95,4 @@ }; - } \ No newline at end of file +} \ No newline at end of file diff --git a/TIAMSharedUI/Pages/ForgottenPassword.razor b/TIAMSharedUI/Pages/ForgottenPassword.razor index aa678f13..e63f4993 100644 --- a/TIAMSharedUI/Pages/ForgottenPassword.razor +++ b/TIAMSharedUI/Pages/ForgottenPassword.razor @@ -35,15 +35,15 @@ @_localizer["LoginTitleText"]
- - - + + +
Send
@@ -60,7 +60,7 @@

@msg; - +

@@ -88,6 +88,6 @@ private void SendMail(string email) { var sendResult = UserDataService.SendForgottenPasswordMail(emailAddress).Forget; - + msg = "We have sent you an email, with instructions on how to renew your password. "; } } diff --git a/TIAMSharedUI/Pages/Index.razor b/TIAMSharedUI/Pages/Index.razor index dedf634c..a8daeb72 100644 --- a/TIAMSharedUI/Pages/Index.razor +++ b/TIAMSharedUI/Pages/Index.razor @@ -1,8 +1,10 @@ @page "/" @using AyCode.Interfaces.StorageHandlers; @using BlazorAnimation +@using TIAMSharedUI.Shared.Components @using TIAMSharedUI.Shared.Components.BaseComponents @using TIAMWebApp.Shared.Application.Interfaces +@using TIAMWebApp.Shared.Application.Models @using TIAMWebApp.Shared.Application.Models.ClientSide.UI @using AyCode.Services.Loggers @using TIAMSharedUI.Pages.Components; @@ -24,8 +26,8 @@ - -@*
+ +@*
@@ -42,9 +44,7 @@
*@ -
- - +@*
@@ -52,49 +52,49 @@

@localizer.GetString("Index.Subtitle")

-
+
*@ - - -
- Card image -
-

@localizer.GetString("Index.Transfer")

- -

@localizer.GetString("Index.Transfer.Desc")

- -
-
-
-
- - -
- Card image -
-

@localizer.GetString("Index.Tours")

-

@localizer.GetString("Index.Tours.Desc")

- -
-
-
-
- - -
- Card image -
-

@localizer.GetString("Index.Clubcards")

-

@localizer.GetString("Index.Clubcards.Desc")

- -
-
-
-
+
+
+
+ +
+

@localizer.GetString("Index.WhoWeAre")

+

We’re not here to take over your trip. We’re here to help shape it — with smooth rides, flexible options, and curated experiences you can actually enjoy.

+

Think of us as your private ride — whether you’re heading to the airport, a spa town, a winery, or somewhere off the map.

+

You can follow one of our signature routes, or create your own. We adapt. You decide. We take care of the road.

+

Our role changes with every guest. Sometimes we’re your calm in the chaos. Sometimes we’re your quiet local expert. Sometimes we’re just there — when you need someone who knows the way.

+
+ +
+ Who we are +
+
+
-
+
+ +
+
+ +
+ + + + @code { @@ -102,18 +102,27 @@ { new HeroSliderItem { - Title = "Welcome to TIAM", - ImageUrl = "https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Explore Our Programs", + ButtonUrl= "/signature-ride-packages" }, new HeroSliderItem { - Title = "Welcome to TIAM", - ImageUrl = "https://images.unsplash.com/photo-1549877452-9c387954fbc2?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1549877452-9c387954fbc2?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Book now", + ButtonUrl= "/transfer" }, new HeroSliderItem { - Title = "Welcome to TIAM", - ImageUrl = "https://images.unsplash.com/photo-1507622560124-621e26755fb8?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" + Title = "Experience Hungary on Your Terms", + Subtitle = "", + ImageUrl = "https://images.unsplash.com/photo-1507622560124-621e26755fb8?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "", + ButtonUrl= "" } }; @@ -122,8 +131,8 @@ public List TransferIgnorList = new List { "Id", - "UserId", - "ProductId", + "UserId", + "ProductId", "PaymentId", "FirstName", "LastName", @@ -134,24 +143,37 @@ "Revenue" }; - /*protected override void OnAfterRender(bool isFirst) - { - message = " Target destination is " + slider.SliderElementId.ToString(); - }*/ + /*protected override void OnAfterRender(bool isFirst) + { + message = " Target destination is " + slider.SliderElementId.ToString(); + }*/ public async Task SubmitForm(object Result) - { - TransferWizardModel transferWizardModel = Result as TransferWizardModel; - if(sessionService.IsAuthenticated) { - transferWizardModel.UserId = sessionService.User.UserModelDto.Id; - transferWizardModel.ProductId = sessionService.User.UserModelDto.Products.FirstOrDefault().Id; - } - transferWizardModel.Price = null; - var transfer = await WizardProcessor.ProcessWizardAsync(transferWizardModel.GetType(), transferWizardModel); - BrowserConsoleLogWriter.Info($"Submitted nested form: {Result.GetType().FullName}"); - navManager.NavigateTo("/transfer2/" + transfer.Id); + TransferWizardModel transferWizardModel = Result as TransferWizardModel; + if (sessionService.IsAuthenticated) + { + transferWizardModel.UserId = sessionService.User.UserModelDto.Id; + transferWizardModel.ProductId = sessionService.User.UserModelDto.Products.FirstOrDefault().Id; } + transferWizardModel.Price = null; + var transfer = await WizardProcessor.ProcessWizardAsync(transferWizardModel.GetType(), transferWizardModel); + BrowserConsoleLogWriter.Info($"Submitted nested form: {Result.GetType().FullName}"); + navManager.NavigateTo("/transfer2/" + transfer.Id); + } + + public List MockEvents = new List + { + new Event("HONEYBEAST", "A Honeybeast egyedisége abban rejlik, hogy a popzenét rengeteg különféle irányból közelítik meg - hol vidám, hol szomorú, hol pörgős, hogy lassú, koncertjükön az érzelmek széles skáláját élhetjük át együtt.", "2024.05.03", "Budapest Park", "https://tixa.hu/kepek/0027/320/27870-1_20231214141702.jpg"), + new Event("VAD FRUTTIK", "A kék a tenger és az ég színe, a nyílt terekkel, valamint a képzelettel és tágassággal társul - végtelen kékség május 3-án a Budapest Parkban!", "2024.04.26", "Budapest Park", "https://tixa.hu/kepek/0027/768/27692-1_20231129185842.jpg"), + new Event("DEBORAH DE LUCA", "DEBORAH DE LUCA 2024-ben Magyarországon csak a Budapest Park színpadán", "2024.08.19", "Budapest Park", "https://tixa.hu/kepek/0028/768/28535-1_20240118172423.jpg"), + new Event("TOTAL DANCE CABRIO", "Ha nyár, akkor Total Dance Cabrio! Ülj be mellénk a cabrioba, és hagyd, hogy visszarepítsünk a 90-es és 2000-es évekbe! ", "2024.04.26", "Budapest Park", "https://tixa.hu/kepek/0027/768/27829-1_20231206193253.jpg"), + new Event("HONEYBEAST", "A Honeybeast egyedisége abban rejlik, hogy a popzenét rengeteg különféle irányból közelítik meg - hol vidám, hol szomorú, hol pörgős, hogy lassú, koncertjükön az érzelmek széles skáláját élhetjük át együtt.", "2024.05.03", "Budapest Park", "https://tixa.hu/kepek/0027/320/27870-1_20231214141702.jpg"), + new Event("VAD FRUTTIK", "A kék a tenger és az ég színe, a nyílt terekkel, valamint a képzelettel és tágassággal társul - végtelen kékség május 3-án a Budapest Parkban!", "2024.04.26", "Budapest Park", "https://tixa.hu/kepek/0027/768/27692-1_20231129185842.jpg"), + new Event("DEBORAH DE LUCA", "DEBORAH DE LUCA 2024-ben Magyarországon csak a Budapest Park színpadán", "2024.08.19", "Budapest Park", "https://tixa.hu/kepek/0028/768/28535-1_20240118172423.jpg"), + new Event("TOTAL DANCE CABRIO", "Ha nyár, akkor Total Dance Cabrio! Ülj be mellénk a cabrioba, és hagyd, hogy visszarepítsünk a 90-es és 2000-es évekbe! ", "2024.04.26", "Budapest Park", "https://tixa.hu/kepek/0027/768/27829-1_20231206193253.jpg"), + + }; } diff --git a/TIAMSharedUI/Pages/PublicCreateAndManageTransfer.razor b/TIAMSharedUI/Pages/PublicCreateAndManageTransfer.razor index 4afedf3a..b171da8f 100644 --- a/TIAMSharedUI/Pages/PublicCreateAndManageTransfer.razor +++ b/TIAMSharedUI/Pages/PublicCreateAndManageTransfer.razor @@ -39,14 +39,14 @@

Partner:

@SelectedHotel

- +
- +
- + Reload
@@ -91,9 +91,10 @@ protected override async Task OnParametersSetAsync() { - if(productId.IsNullOrEmpty()) + if(!productId.IsNullOrEmpty()) { - var result = await _adminSignalRClient.GetByIdAsync(SignalRTags.GetCompaniesById, productId); + var result = await _adminSignalRClient.GetByIdAsync(SignalRTags.GetProductById, productId); + _logger.Debug($"Current product: {result.Name}"); if (result != null) { SelectedHotel = result; @@ -103,7 +104,7 @@ SelectedHotel = null; } } - + _logger.Debug($"OnParameterSet, going forward"); if (!referralId.IsNullOrEmpty()) { //check if storage has some other referralId already TODO diff --git a/TIAMSharedUI/Pages/Tests/BackgroundTest.razor b/TIAMSharedUI/Pages/Tests/BackgroundTest.razor new file mode 100644 index 00000000..2d9185ba --- /dev/null +++ b/TIAMSharedUI/Pages/Tests/BackgroundTest.razor @@ -0,0 +1,71 @@ +@page "/backgroundtest" +@inject IStringLocalizer localizer; +@using TIAM.Resources +@using TIAMSharedUI.Shared +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI + +
+ +
+
+
+
+
+
+
+
+ +
+ + + +
+
+
+ +
+

@localizer.GetString("Index.WhoWeAre")

+

We’re not here to take over your trip. We’re here to help shape it — with smooth rides, flexible options, and curated experiences you can actually enjoy.

+

Think of us as your private ride — whether you’re heading to the airport, a spa town, a winery, or somewhere off the map.

+

You can follow one of our signature routes, or create your own. We adapt. You decide. We take care of the road.

+

Our role changes with every guest. Sometimes we’re your calm in the chaos. Sometimes we’re your quiet local expert. Sometimes we’re just there — when you need someone who knows the way.

+
+ +
+ Who we are +
+
+
+
+ +@code { + public List sliders = new List + { + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Explore Our Programs", + ButtonUrl= "/signature-ride-packages" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1549877452-9c387954fbc2?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Book now", + ButtonUrl= "/transfer" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "", + ImageUrl = "https://images.unsplash.com/photo-1507622560124-621e26755fb8?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "", + ButtonUrl= "" + } + }; +} diff --git a/TIAMSharedUI/Pages/Tests/BackgroundTest.razor.css b/TIAMSharedUI/Pages/Tests/BackgroundTest.razor.css new file mode 100644 index 00000000..c397eca6 --- /dev/null +++ b/TIAMSharedUI/Pages/Tests/BackgroundTest.razor.css @@ -0,0 +1,179 @@ +* { + box-sizing: border-box; +} + +body { + font-family: "Lato", sans-serif; +} + +.hero { + width: 100%; + min-height: 450px; + height: 100%; + position: absolute; + top: 0; + left: 0; + background-color: #d9edfd; + z-index: -1; +} + +.layer-1 { + -webkit-animation: parallax_fg linear 20s infinite both; + animation: parallax_fg linear 20s infinite both; + background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/24650/1.png) 0 100% repeat-x; + z-index: 1; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + background-size: auto 136px; +} + +.layer-2 { + -webkit-animation: parallax_fg linear 30s infinite both; + animation: parallax_fg linear 30s infinite both; + background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/24650/2.png) 0 100% repeat-x; + z-index: 1; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + background-size: auto 145px; +} + +.layer-3 { + -webkit-animation: parallax_fg linear 55s infinite both; + animation: parallax_fg linear 55s infinite both; + background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/24650/3.png) 0 100% repeat-x; + z-index: 1; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + background-size: auto 158px; +} + +.layer-4 { + -webkit-animation: parallax_fg linear 75s infinite both; + animation: parallax_fg linear 75s infinite both; + background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/24650/4.png) 0 100% repeat-x; + z-index: 1; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + background-size: auto 468px; +} + +.layer-5 { + -webkit-animation: parallax_fg linear 95s infinite both; + animation: parallax_fg linear 95s infinite both; + background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/24650/5.png) 0 100% repeat-x; + z-index: 1; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + background-size: auto 311px; +} + +.layer-6 { + -webkit-animation: parallax_fg linear 120s infinite both; + animation: parallax_fg linear 120s infinite both; + background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/24650/6.png) 0 100% repeat-x; + z-index: 1; + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 100%; + background-size: auto 222px; +} + +.bike-1, +.bike-2 { + background: url(images/car.png) 0 100% no-repeat; + z-index: 1; + position: fixed; + bottom: 100px; + left: 0; + width: 100%; + height: 100%; + background-size: auto 75px; +} + +.bike-1 { + -webkit-animation: parallax_bike linear 10s infinite both; + animation: parallax_bike linear 10s infinite both; +} + +.bike-2 { + -webkit-animation: parallax_bike linear 15s infinite both; + animation: parallax_bike linear 15s infinite both; +} + +@-webkit-keyframes parallax_fg { + 0% { + background-position: 2765px 100%; + } + + 100% { + background-position: 550px 100%; + } +} + +@keyframes parallax_fg { + 0% { + background-position: 2765px 100%; + } + + 100% { + background-position: 550px 100%; + } +} + +@-webkit-keyframes parallax_bike { + 0% { + background-position: -300px 100%; + } + + 100% { + background-position: 2000px 100%; + } +} + +@keyframes parallax_bike { + 0% { + background-position: -300px 100%; + } + + 100% { + background-position: 2000px 100%; + } +} + +.logo { + margin: 70px auto; + position: absolute; + z-index: 2; + width: 100%; +} + + .logo img { + display: block; + margin: 0 auto; + max-width: 100%; + } + +@media (max-width: 700px) { + .logo img { + max-width: 90%; + } +} + + diff --git a/TIAMSharedUI/Pages/Tours.razor b/TIAMSharedUI/Pages/Tours.razor deleted file mode 100644 index d2a2800c..00000000 --- a/TIAMSharedUI/Pages/Tours.razor +++ /dev/null @@ -1,72 +0,0 @@ -@page "/tours" -@using TIAMSharedUI.Shared - - - -
-
-
- -

Tours

-

Please select!

-
- -
- - - -
- - \ No newline at end of file diff --git a/TIAMSharedUI/Pages/Tours/TourEditor.razor b/TIAMSharedUI/Pages/Tours/TourEditor.razor new file mode 100644 index 00000000..5e4def0b --- /dev/null +++ b/TIAMSharedUI/Pages/Tours/TourEditor.razor @@ -0,0 +1,39 @@ +@using TIAM.Entities.Transfers +@using TIAMWebApp.Shared.Application.Models + + + + + + +
+ + +
+ +
+ + +
+ +
+ + +
+
+ +@code { + [Parameter] public TourInfo Tour { get; set; } = new(); + [Parameter] public EventCallback OnSave { get; set; } + [Parameter] public EventCallback OnCancel { get; set; } + + private async Task HandleValidSubmit() + { + await OnSave.InvokeAsync(Tour); + } + + private async Task HandleCancel() + { + await OnCancel.InvokeAsync(Tour); + } +} \ No newline at end of file diff --git a/TIAMSharedUI/Pages/Tours_public.razor b/TIAMSharedUI/Pages/Tours_public.razor new file mode 100644 index 00000000..1e33914b --- /dev/null +++ b/TIAMSharedUI/Pages/Tours_public.razor @@ -0,0 +1,49 @@ +@page "/signature-ride-packages" +@inject TourService TourService +@using TIAMSharedUI.Shared +@using TIAMSharedUI.Shared.Components +@using TIAMWebApp.Shared.Application.Models +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI +@using TIAMWebApp.Shared.Application.Services + +@using Microsoft.AspNetCore.Components.Web + + + + + + + @* *@ + + +@code { + public List sliders = new() + { + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Explore Our Programs", + ButtonUrl= "/signature-ride-packages" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1549877452-9c387954fbc2?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Book now", + ButtonUrl= "/transfer" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "", + ImageUrl = "https://images.unsplash.com/photo-1507622560124-621e26755fb8?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "", + ButtonUrl= "" + } + }; +} + + diff --git a/TIAMSharedUI/Pages/Tours.razor.css b/TIAMSharedUI/Pages/Tours_public.razor.css similarity index 100% rename from TIAMSharedUI/Pages/Tours.razor.css rename to TIAMSharedUI/Pages/Tours_public.razor.css diff --git a/TIAMSharedUI/Pages/TransferBookTourPage.razor b/TIAMSharedUI/Pages/TransferBookTourPage.razor new file mode 100644 index 00000000..aade1915 --- /dev/null +++ b/TIAMSharedUI/Pages/TransferBookTourPage.razor @@ -0,0 +1,419 @@ +@page "/book-a-tour/{TransferDestinationId}/{PriceCategory:int}" +@using AyCode.Core.Consts +@using AyCode.Core.Helpers +@using TIAM.Models.Dtos.Users +@using TIAM.Services +@using TIAMSharedUI.Pages.Components +@using TIAMSharedUI.Pages.Components.EditComponents +@using TIAMSharedUI.Shared +@using TIAMSharedUI.Shared.Components.BaseComponents +@using TIAMWebApp.Shared.Application.Interfaces +@using TIAMWebApp.Shared.Application.Models +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI +@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels +@using AyCode.Services.Loggers +@using TIAMSharedUI.Pages.User.Hotels +@using TIAMWebApp.Shared.Application.Models.PageModels +@using TIAMWebApp.Shared.Application.Services +@using TIAMWebApp.Shared.Application.Utility +@inherits BasePageComponent +@inject NavigationManager navManager +@inject IEnumerable LogWriters +@inject IWizardProcessor WizardProcessor +@inject IUserDataService UserDataService +@inject AdminSignalRClient _adminSignalRClient +@inject ITransferDataService TransferDataService +@inject TourService TourService + +Transfer + + +
+
+ + @{ + if (_displayHelp) + { +
+ +
+ +
+

+ Step 1: Choose Your Transfer Direction +

+

At the top of the form, select whether you need a transfer "To the Airport" or "From the Airport" by clicking on the corresponding tab.

+
+
+ + +
+ + +
+

+ + Step 2: Enter the Destination (or Pickup) Address + +

+

In the PickupAddress section, select your address:

+
    +
  • Preset addresses: Click on the dropdown menu under “Preset addresses” and choose an address from the list. For example, you may see options like "Széchenyi fürdő."
  • +
  • Custom address: If your address is not listed, click on the "Custom address" tab to manually enter your address.
  • +
+
+
+ + +
+ + +
+

+ Step 3: Confirm the Destination +

+

Once you select or enter the address, the form will display it as the "Selected address." Make sure this is correct before proceeding.

+
+
+ + +
+ + +
+

+ Step 4: Enter Flight Information (Optional) +

+

If applicable, fill in your FlightNumber. This is optional, so you can leave it blank if you don't have or don’t want to provide it.

+
+
+ + +
+ + +
+

+ Step 5: Specify the Number of Passengers +

+

In the NumberOfPassengers field, enter the number of people who will be traveling. The default is set to 1, but you can change it as needed.

+
+
+ + +
+ + +
+

+ Step 6: Indicate the Amount of Luggage +

+

In the NumberOfLuggage field, enter the total number of luggage items you will be bringing.

+
+
+ + +
+ + +
+

+ Step 7: Fill in Your Personal Information +

+

Under FullName, enter your first and last name in the respective fields. Provide your PhoneNumber in the designated field. The phone number appears to be pre-filled with a sample number ("+11234567890"), so be sure to update it with your actual contact number. Enter your EmailAddress to receive confirmation and any further communication regarding your transfer.

+
+
+ + +
+ + +
+

+ Step 8: Add Additional Comments (Optional) +

+

If you have any special requests or additional information you’d like to provide, use the Comment section to do so.

+
+
+ + +
+ + +
+

+ Step 9: Submit Your Request +

+

Once all fields are filled in correctly, click the Submit button at the bottom of the form to place your transfer order.

+
+
+ + +
+ + +
+

+ Step 10: Confirmation +

+ +

After submitting, you should receive a confirmation email or message. Ensure all the details are correct, and you’re all set!

+
+
+
+ } + } + +
+ + + + + +
+ @tourInfo.Title +
+ + + + + +
+ + +
+ + + +
+ +
+
+
+

Book an Airport Transfer

+

Welcome to Tour I Am! Book your airport transfer with us for a smooth and stress-free experience. Our professional drivers are ready to take you to and from the airport in comfort and style. We offer competitive rates and reliable service, ensuring you get to your destination on time.

+ +

Why Choose Tour I Am?

+
    +
  • Reliable Service: Punctual pickups and drop-offs.
  • +
  • Professional Drivers: Experienced and courteous drivers.
  • +
  • Affordable Rates: Competitive pricing with no hidden fees.
  • +
  • Comfortable Vehicles: Clean, modern, and well-maintained cars.
  • +
+ + +
+
+ +
+
+ +
+
+ +

How to Book

+

Booking your airport transfer is easy! Simply visit our booking page, enter your details, and confirm your reservation. You can also contact us at info@touriam.com or call us at (123) 456-7890 for assistance.

+ +

Experience the convenience and reliability of Tour I Am. Book your airport transfer today and travel with peace of mind!

+
+
+ +
+ + + + + +@code { + [Parameter] public string TransferDestinationId { get; set; } + [Parameter] public int PriceCategory { get; set; } = 1; + private LoggerClient _logger; + + private readonly TransferWizardModel _myModel = new TransferWizardModel(); + private TourInfo? tourInfo = new(); + + private bool _displayHelp = false; + + public List sliders = new List + { + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1551867633-194f125bddfa?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Explore Our Programs", + ButtonUrl= "/signature-ride-packages" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "Discover the freedom of personalized travel with expert private transfers and curated inspiration.", + ImageUrl = "https://images.unsplash.com/photo-1549877452-9c387954fbc2?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "Book now", + ButtonUrl= "/transfer" + }, + new HeroSliderItem + { + Title = "Experience Hungary on Your Terms", + Subtitle = "", + ImageUrl = "https://images.unsplash.com/photo-1507622560124-621e26755fb8?auto=format&fit=crop&q=80&w=2070&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", + ButtonText = "", + ButtonUrl= "" + } + }; + + private readonly List _transferIgnorList1 = + [ + "Id", + "Destination", + "UserId", + "ProductId", + "PaymentId", + "FirstName", + "LastName", + "UserProductMappingId", + "UserProductToCarId", + "ReferralId", + "Price" + ]; + + + public async Task SubmitForm(object result) + { + var resModel = (TransferWizardModel)result; + + //let's check if user exists with this email + var user = await UserDataService.GetUserByEmailAsync(resModel.EmailAddress!); + if (user != null && user.Id != Guid.Empty) + { + resModel.UserId = user.Id; + //user exists already + + if (_sessionService.User != null) + { + if (_sessionService.User.UserId == user.Id) + { + + //I have ordered for myself + resModel.ReferralId = null; + } + else + { + //if I am logged in and different user I become referrer (if no referrer already) + var transferUserDetail = await UserDataService.GetUserDetailByIdAsync(user.Id); + var userDetail = await UserDataService.GetUserDetailByIdAsync(_sessionService.User.UserId); + + if (transferUserDetail.UserDto.RefferalId != null) + { + //user has aready a referrer so we use that + resModel.ReferralId = transferUserDetail.UserDto.RefferalId; + } + else + { + //user has no referrer so I am the referrer + resModel.ReferralId = userDetail.UserDto.RefferalId; + + } + } + } + } + else + { + //create a guest user and set referralId + var registration = new RegistrationModel(); + + var password = AcCharsGenerator.NewPassword(AcConst.MinPasswordLength, 16); + + registration.Email = resModel.EmailAddress; + registration.PhoneNumber = resModel.PhoneNumber; + registration.Password = password; + //get list with one member! + + var createResult = await UserDataService.CreateGuestUser(registration); + if (createResult.isSuccess) + { + if (createResult.user != null) + { + if (_sessionService.User != null) + { + //if I am logged in user I become referrer + var userDetail = await UserDataService.GetUserDetailByIdAsync(_sessionService.User.UserId); + var createdUserDetail = await UserDataService.GetUserDetailByIdAsync(createResult.user.Id); + if (createdUserDetail != null) + { + createdUserDetail.UserDto.RefferalId = userDetail.UserDto.RefferalId; + + var updatedNewUser = await _adminSignalRClient.UpdateUserModelDtoDetail(userDetail); + if (updatedNewUser != null) + { + //referral set + } + else + { + //something wrong + } + } + + resModel.ReferralId = userDetail.UserDto.RefferalId; + } + + resModel.UserId = createResult.user.Id; + + } + else + { + //some error handling + } + } + } + + var transfer = await WizardProcessor.ProcessWizardAsync(result.GetType(), result); + _logger.Info($"Submitted nested form: {result.GetType().FullName}"); + navManager.NavigateTo($"/mytransfers/{resModel.Id}"); + } + + protected override Task OnInitializedAsync() + { + _logger = new LoggerClient(LogWriters.ToArray()); + + + return base.OnInitializedAsync(); + } + + protected override async Task OnParametersSetAsync() + { + //get transferDestination + var destination = await TransferDataService.GetTransferDestinationbyIdAsync(Guid.Parse(TransferDestinationId)); + _myModel.Destination = destination.AddressString; + switch (PriceCategory) + { + case 1: + _myModel.Price = destination.Price; + break; + case 2: + _myModel.Price = destination.Price2; + break; + case 3: + _myModel.Price = destination.Price3; + break; + } + + tourInfo = await TourService.GetAsync(destination.Id); + + + + await base.OnParametersSetAsync(); + } + + private void ShowHelp_Click() + { + _displayHelp = !_displayHelp; + } + +} + diff --git a/TIAMSharedUI/Pages/TransferBookTourPage.razor.css b/TIAMSharedUI/Pages/TransferBookTourPage.razor.css new file mode 100644 index 00000000..83c30f41 --- /dev/null +++ b/TIAMSharedUI/Pages/TransferBookTourPage.razor.css @@ -0,0 +1,202 @@ +.container { + padding-right: 15px; + padding-left: 15px; + margin-right: auto; + margin-left: auto; +} + +@media (min-width: 768px) { + .container { + width: 750px; + } +} + +@media (min-width: 992px) { + .container { + width: 970px; + } +} + +@media (min-width: 1200px) { + .container { + width: 1170px; + } +} + +@media (max-width: 767px) { + #featureContainer .carousel-inner .carousel-item > div { + display: none; + } + + #featureContainer .carousel-inner .carousel-item > div:first-child { + display: block; + } +} + +#featureContainer .carousel-inner .carousel-item.active, +#featureContainer .carousel-inner .carousel-item-next, +#featureContainer .carousel-inner .carousel-item-prev { + display: flex; +} + +@media (min-width: 768px) { + + #featureContainer .carousel-inner .carousel-item-end.active, + #featureContainer .carousel-inner .carousel-item-next { + transform: translateX(25%); + } + + #featureContainer .carousel-inner .carousel-item-start.active, + #featureContainer .carousel-inner .carousel-item-prev { + transform: translateX(-25%); + } + + #featureContainer .card img { + width: 90%; + height: 40vh; + } + + #featureContainer .carousel-item { + justify-content: space-between; + } +} + +@media (max-width: 767px) { + #featureContainer .card img { + width: 100%; + height: 75vh; + } +} + +#featureContainer .carousel-inner .carousel-item-end, +#featureContainer .carousel-inner .carousel-item-start { + transform: translateX(0); +} + +#featureContainer .card { + border: 0; +} + +#featureContainer .card { + position: relative; +} + + #featureContainer .card .card-img-overlays { + position: absolute; + bottom: 15%; + left: 10%; + } + +#featureContainer a { + text-decoration: none; +} + +#featureContainer .indicator { + border: 1px solid rgb(202, 202, 202); + padding: 3px 6px 3px 6px; +} + + #featureContainer .indicator:hover { + background-color: blue; + border: 1px solid blue; + transition: 200ms; + } + + #featureContainer .indicator:hover { + color: white; + transition: 200ms; + } + +#featureContainer .indicator { + color: lightgray; +} + +#featureContainer .float-end { + padding-top: 10px; +} + + + + +/* Reseting */ +* { + margin: 0; + padding: 0; + box-sizing: border-box; + font-family: 'Poppins', sans-serif; +} + +.wrapper { + max-width: 800px; + min-height: 500px; + margin: 10px auto; + padding: 30px 30px 30px 30px; + /*background-color: #ecf0f3;*/ + border-radius: 15px; + /*box-shadow: 13px 13px 20px #cbced1, -13px -13px 20px #fff;*/ +} + + + .wrapper .name { + font-weight: 600; + font-size: 1.4rem; + letter-spacing: 1.3px; + padding-left: 10px; + /*color: #555*/; + } + + .wrapper .form-field input { + width: 100%; + display: block; + border: none; + outline: none; + background: none; + font-size: 1.2rem; + color: #666; + padding: 10px 15px 10px 10px; + /* border: 1px solid red; */ + } + + .wrapper .form-field { + padding-left: 10px; + margin-bottom: 20px; + border-bottom: 1px solid; + /*border-radius: 20px;*/ + //*ox-shadow: inset 3px 3px 3px #cbced1, inset -3px -3px 3px #fff;*/ + } + + .wrapper .form-field .fas { + color: #555; + } + + .wrapper .btn { + box-shadow: none; + width: 100%; + height: 40px; + /*background-color: #03A9F4;*/ + color: #fff; + border-radius: 15px; + /*box-shadow: 3px 3px 3px #b1b1b1, -3px -3px 3px #fff;*/ + letter-spacing: 1.3px; + } + + .wrapper .btn:hover { + background-color: #039BE5; + } + + .wrapper a { + text-decoration: none; + font-size: 0.8rem; + color: #03A9F4; + } + + .wrapper a:hover { + color: #039BE5; + } + +@media(max-width: 380px) { + .wrapper { + margin: 30px 20px; + padding: 40px 15px 15px 15px; + } +} diff --git a/TIAMSharedUI/Pages/TransferPage.razor b/TIAMSharedUI/Pages/TransferPage.razor index c652b4a5..5ebbfddd 100644 --- a/TIAMSharedUI/Pages/TransferPage.razor +++ b/TIAMSharedUI/Pages/TransferPage.razor @@ -267,8 +267,7 @@ "Destination", "UserId", "ProductId", - "PaymentId", - "TripDate", + "PaymentId", "FirstName", "LastName", "UserProductMappingId", @@ -283,8 +282,7 @@ "PickupAddress", "UserId", "ProductId", - "PaymentId", - "TripDate", + "PaymentId", "FirstName", "LastName", "UserProductMappingId", @@ -405,7 +403,7 @@ var transfer = await WizardProcessor.ProcessWizardAsync(result.GetType(), result); _logger.Info($"Submitted nested form: {result.GetType().FullName}"); - navManager.NavigateTo($"/transfer2/{resModel.Id}"); + navManager.NavigateTo($"/mytransfers/{resModel.Id}"); } protected override Task OnInitializedAsync() diff --git a/TIAMSharedUI/Pages/User/CardComponents/UserCardComponent.razor b/TIAMSharedUI/Pages/User/CardComponents/UserCardComponent.razor index c0f3af3b..8504b1b1 100644 --- a/TIAMSharedUI/Pages/User/CardComponents/UserCardComponent.razor +++ b/TIAMSharedUI/Pages/User/CardComponents/UserCardComponent.razor @@ -116,7 +116,7 @@ void OnPasswordSet(string password) { - msg = $"Password to set: {NewPassword}"; + msg = $"Please type in again"; PasswordNotSet = false; StateHasChanged(); diff --git a/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor b/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor index 597c7362..5f821491 100644 --- a/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor +++ b/TIAMSharedUI/Pages/User/Hotels/HotelComponent.razor @@ -103,6 +103,7 @@ } + diff --git a/TIAMSharedUI/Pages/User/SysAdmins/Blog.razor b/TIAMSharedUI/Pages/User/SysAdmins/Blog.razor new file mode 100644 index 00000000..2b5646b0 --- /dev/null +++ b/TIAMSharedUI/Pages/User/SysAdmins/Blog.razor @@ -0,0 +1,183 @@ +@page "/sysadmin/blogs" +@using TIAMWebApp.Shared.Application.Models +@using TIAMWebApp.Shared.Application.Services +@using TIAMSharedUI.Shared +@layout AdminLayout +@inject BlogService BlogService + +
+

Manage Blog Posts

+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + @if (IsEditMode) + { + + } +
+ + @if (SaveSuccess) + { +
Post saved successfully!
+ } + +

Existing Posts

+ + @if (Posts.Count == 0) + { +

No blog posts found.

+ } + else + { + + + + + + + + + + @foreach (var item in Posts) + { + + + + + + + } + +
TitleTagsActions
@item.Title@string.Join(", ", item.Tags) + + +
+ } + +
+ +@code { + private BlogPostMetadata Post = new(); + private List Posts = new(); + private IBrowserFile? CoverImage; + private string TagsCsv = ""; + private bool IsSaving = false; + private bool SaveSuccess = false; + private bool IsEditMode = false; + + protected override async Task OnInitializedAsync() + { + await LoadPosts(); + } + + private async Task LoadPosts() + { + Posts = await BlogService.GetAllPostsAsync(); + } + + private async Task HandleFileSelected(InputFileChangeEventArgs e) + { + CoverImage = e.File; + } + + private async Task SavePost() + { + IsSaving = true; + SaveSuccess = false; + + Post.Tags = TagsCsv.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries).ToList(); + + if (IsEditMode) + { + await BlogService.UpdatePostAsync(Post, CoverImage); + } + else + { + await BlogService.CreatePostAsync(Post, CoverImage); + } + + IsSaving = false; + SaveSuccess = true; + + await LoadPosts(); + ResetForm(); + } + + private void EditPost(BlogPostMetadata post) + { + Post = new BlogPostMetadata + { + Id = post.Id, + Title = post.Title, + Lead = post.Lead, + DriveLink = post.DriveLink, + Tags = new List(post.Tags), + CoverImage = post.CoverImage + }; + TagsCsv = string.Join(", ", post.Tags); + IsEditMode = true; + SaveSuccess = false; + } + + private async Task DeletePost(string id) + { + if (await ConfirmDeleteAsync()) + { + await BlogService.DeletePostAsync(id); + await LoadPosts(); + } + } + + private async Task ConfirmDeleteAsync() + { + return await Task.FromResult(true); // Replace with real confirmation popup later + } + + private void CancelEdit() + { + ResetForm(); + } + + private void ResetForm() + { + Post = new BlogPostMetadata(); + TagsCsv = ""; + CoverImage = null; + IsEditMode = false; + } +} diff --git a/TIAMSharedUI/Pages/User/SysAdmins/LogViewerGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/LogViewerGridComponent.razor index 7746ba15..2b068542 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/LogViewerGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/LogViewerGridComponent.razor @@ -129,7 +129,7 @@ private static DateTime _toDate = DateTime.Today; private static int _takeCount = 250; - private object[] _contextParams = new object[3] { _takeCount, _fromDate, _toDate }; + private object[] _contextParams = [_takeCount, _fromDate, _toDate]; private LoggerClient _logger; private static List _selectedLogLevels = [LogLevel.Error, LogLevel.Warning, LogLevel.Suggest]; @@ -154,12 +154,12 @@ if (_selectedLogLevels.Count > 0) { - filterCriteria = new InOperator(nameof(LogLevel), _selectedLogLevels); + filterCriteria = new InOperator(nameof(LogItemViewerModel.LogLevel), _selectedLogLevels); filterText = GetFilterText(_selectedLogLevels); } _filterText = filterText; - _logViewerGrid.SetFieldFilterCriteria(nameof(LogLevel), filterCriteria); + _logViewerGrid.SetFieldFilterCriteria(nameof(LogItemViewerModel.LogLevel), filterCriteria); } private async Task OnValueChangedTakeCount(int value) @@ -199,7 +199,7 @@ { if (e.ElementType != GridElementType.DataRow) return; - var logLevelObject = e.Grid?.GetRowValue(e.VisibleIndex, nameof(LogLevel)); + var logLevelObject = e.Grid?.GetRowValue(e.VisibleIndex, nameof(LogItemViewerModel.LogLevel)); if (logLevelObject == null) return; var levelObject = (LogLevel)logLevelObject; diff --git a/TIAMSharedUI/Pages/User/SysAdmins/ManageTransfers.razor b/TIAMSharedUI/Pages/User/SysAdmins/ManageTransfers.razor index 37cf6796..bdc110b5 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/ManageTransfers.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/ManageTransfers.razor @@ -4,6 +4,7 @@ @using TIAM.Core.Enums @using TIAM.Entities.Emails @using TIAM.Entities.Transfers +@using TIAM.Entities.Users @using TIAM.Resources @using TIAMSharedUI.Pages.Components @using TIAMSharedUI.Shared @@ -20,8 +21,10 @@ @using AyCode.Core @using AyCode.Core.Helpers @using DevExpress.Data.Filtering +@using TIAM.Entities.Drivers @using TIAM.Entities.Emails @using TIAMSharedUI.Shared.Components.BaseComponents +@using TIAM.Services @inherits UserBasePageComponent @layout AdminLayout @inject IWizardProcessor wizardProcessor @@ -30,465 +33,543 @@ Transfers
-

Transfer management

-

Manage transfers here!

+

Transfer management

+

Manage transfers here!

- - - - - - + @bind-Visible="@_popupVisible" + ShowFooter="true" + CloseOnEscape="true" + CloseOnOutsideClick="false" + ShowCloseButton="false" + HeaderText="MessageBox" + Closing="EulaPopupClosing" + Closed="EulaPopupClosed"> + + + + + +
-
-
- -
+
+
+ +
- + - -
-
- -
+ +
+
+ +
- + - - - - - - @{ - var idKeyField = ((Transfer)context.DataItem).Id.ToString("N"); - var editUri = $"mytransfers/{idKeyField}"; - - @context.Value - - } - - - - - - - - - - - - - - - @{ - var keyField = context.Value; - var keyItem = (Transfer)context.DataItem; - string buttonText = "Contact"; - - } - - - - - - - @{ + + + + + + @{ + var idKeyField = ((Transfer)context.DataItem).Id.ToString("N"); + var editUri = $"mytransfers/{idKeyField}"; + + @context.Value + + } + + + + + + + + + + + + + + @{ + var keyItem = (Transfer)context.DataItem; + @(string.Join(", ", keyItem.TransferToDrivers.Select(x => x.UserProductMapping?.User?.Profile?.GetFullName()))) + } + - TransferStatusModel keyField = TransferStatusModel.GetStatusModel((TransferStatusType)context.Value); - string transferStatusText = keyField.StatusName; - @transferStatusText - } - - - - - - - - - - - - - - - - - - @{ - var transfer2 = (Transfer)editFormContext.EditModel; - } - - - @editFormContext.GetEditor("FirstName") - - - @editFormContext.GetEditor("LastName") - - - @editFormContext.GetEditor("ToAddress") - - - @editFormContext.GetEditor("FromAddress") - - + + + - - + + + @{ + var keyItem = (Transfer)context.DataItem; + var buttonText = "Contact"; + + } + + + + + + + @{ - - - @editFormContext.GetEditor("PassengerCount") - + var keyField = TransferStatusModel.GetStatusModel((TransferStatusType)context.Value); + var transferStatusText = keyField.StatusName; + @transferStatusText + } + + + + + + + + + + + + + + + + + + @{ + var transfer2 = (Transfer)editFormContext.EditModel; + } + + + @editFormContext.GetEditor("FirstName") + + + @editFormContext.GetEditor("LastName") + + + @editFormContext.GetEditor("ContactEmail") + + + @editFormContext.GetEditor("ToAddress") + + + @editFormContext.GetEditor("FromAddress") + + + + + + + + + @editFormContext.GetEditor("PassengerCount") + - - @editFormContext.GetEditor("Payed") - + + @editFormContext.GetEditor("Payed") + - - @editFormContext.GetEditor("TransferStatusType") - - - @editFormContext.GetEditor("Price") - + + @editFormContext.GetEditor("TransferStatusType") + + + @editFormContext.GetEditor("Price") + + + @editFormContext.GetEditor("Revenue") + - - + + - -
- -
-
-
-
-
+ +
+ - -
- - - - - - - - - - -
-
- -
- -
+ @*//NE TÖRÖLD KI! - J. + *@ +
+ + +
+ -
-
+ +
+ + + + + + + + + + +
+
+ +
+ +
-
+
+
+ +
@code { - private LoggerClient _logger; + private LoggerClient _logger; - private bool _popupVisible; - private TransferGrid _gridTransfer; + private bool _popupVisible; + private TransferGrid _gridTransfer; - private DxTagBox _filterTag; + private DxTagBox _filterTag; - public List IgnoreList = - [ - "ReceiverEmailAddress", - "ReceiverFullName", - "ReceiverId", - "SenderEmailAddress", - "SenderFullName", - "SenderId", - "ContextId", - "ContextType" - ]; + public List IgnoreList = + [ + "ReceiverEmailAddress", + "ReceiverFullName", + "ReceiverId", + "SenderEmailAddress", + "SenderFullName", + "SenderId", + "ContextId", + "ContextType" + ]; - private static List _selectedCategories = TransferStatusModel.AllStatuses.Values.Where(x => x.StatusValue != TransferStatusType.Finished && x.StatusValue != TransferStatusType.UserCanceled && x.StatusValue != TransferStatusType.AdminDenied).ToList(); - private string _filterText = GetFilterText(_selectedCategories.Select(x => x.StatusValue).ToList()); + private static List _selectedCategories = Enum.GetValues().Where(x => x != TransferStatusType.Finished && x != TransferStatusType.UserCanceled && x != TransferStatusType.AdminDenied).ToList(); + private string _filterText = GetFilterText(_selectedCategories); - private MessageWizardModel _messageWizardModel = new(); + // NE TÖRÖLD KI! - J. + // private static List _selectedCategories = TransferStatusModel.AllStatuses.Values.Where(x => x.StatusValue != TransferStatusType.Finished && x.StatusValue != TransferStatusType.UserCanceled && x.StatusValue != TransferStatusType.AdminDenied).ToList(); + // private string _filterText = GetFilterText(_selectedCategories.Select(x => x.StatusValue).ToList()); - public List AppointmentModels { get; set; } = null!; + private MessageWizardModel _messageWizardModel = new(); - DateTime StartDate { get; set; } = DateTime.Today; - DxSchedulerDataStorage _dataStorage = new(); + public List AppointmentModels { get; set; } = null!; + + DateTime StartDate { get; set; } = DateTime.Today; + DxSchedulerDataStorage _dataStorage = new(); + + void SendMail(Transfer item) + { + _logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}"); + _messageWizardModel.Subject = $"[#{item.OrderId}] New message regarding your transfer"; + _messageWizardModel.ReceiverId = item.UserId; + _messageWizardModel.ContextId = item.Id; + _messageWizardModel.ContextType = MessageContextType.Transfer; + _messageWizardModel.SenderId = TiamConstClient.SysAccounts["SystemEmailSender"]; + _messageWizardModel.SenderEmailAddress = TiamConstClient.SystemEmailAddress; + _messageWizardModel.ReceiverEmailAddress = item.ContactEmail; + _messageWizardModel.ReceiverFullName = item.FullName; + _popupVisible = true; + } + + void CancelCreateClick() + { + + _popupVisible = false; + } + + void EulaPopupClosed() + { + //cancel clicked + + } + + void EulaPopupClosing(PopupClosingEventArgs args) + { + //myModel = new TransferWizardModel(); + _messageWizardModel = new MessageWizardModel(); + } + + //----------------------------------------------------------------------------------- - void SendMail(Transfer item) - { - _logger.Info($"Preparing mail to {item.ContactEmail}, {item.Id}"); - _messageWizardModel.Subject = $"[#{item.OrderId}] New message regarding your transfer"; - _messageWizardModel.ReceiverId = item.UserId; - _messageWizardModel.ContextId = item.Id; - _messageWizardModel.ContextType = MessageContextType.Transfer; - _messageWizardModel.SenderId = TiamConstClient.SysAccounts["SystemEmailSender"]; - _messageWizardModel.SenderEmailAddress = TiamConstClient.SystemEmailAddress; - _messageWizardModel.ReceiverEmailAddress = item.ContactEmail; - _messageWizardModel.ReceiverFullName = item.FullName; - _popupVisible = true; - } + public async Task SubmitForm(object result) + { + var messageModel = (result as MessageWizardModel)!; + _logger.Info(messageModel.Content); + var email = await wizardProcessor.ProcessWizardAsync(result.GetType(), messageModel); + _logger.Info($"Submitted nested form: {result.GetType().FullName}"); + CancelCreateClick(); + } - void CancelCreateClick() - { + void Grid_CustomizeElement(GridCustomizeElementEventArgs e) + { + try + { + if (e.ElementType == GridElementType.HeaderCell) + { + e.Style = "background-color: rgba(0, 0, 0, 0.08)"; + e.CssClass = "header-bold"; + } - _popupVisible = false; - } + if (e.ElementType != GridElementType.DataRow) return; - void EulaPopupClosed() - { - //cancel clicked + var transferStatus = e.Grid?.GetRowValue(e.VisibleIndex, "TransferStatusType"); + if (transferStatus == null) return; - } + var transferStatusByte = (byte)transferStatus; - void EulaPopupClosing(PopupClosingEventArgs args) - { - //myModel = new TransferWizardModel(); - _messageWizardModel = new MessageWizardModel(); - } + switch (transferStatusByte) + { + case 5: + e.CssClass = "bg-important"; + break; + case > 5 and < 35: + e.CssClass = "bg-attention"; + break; + case 35: + e.CssClass = "bg-finished"; + break; + case > 35: + e.CssClass = "bg-cancel"; + break; + } + } + catch (Exception ex) + { + _logger.Error($"Grid_CustomizeElement; {ex.Message}", ex); + } + } - //----------------------------------------------------------------------------------- + void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e) + { + if (!e.IsNew) return; + + var transferEditModel = (Transfer)e.EditModel; //TODO not valid cast + transferEditModel.Id = Guid.NewGuid(); + transferEditModel.ToAddress = "Where to?"; + transferEditModel.FromAddress = "From where?"; + transferEditModel.Appointment = DateTime.UtcNow.AddDays(3); + transferEditModel.PassengerCount = 1; + transferEditModel.FirstName = "John"; + transferEditModel.LastName = "Doe"; + transferEditModel.ContactPhone = "+00000000000"; + transferEditModel.ContactEmail = "your@email.address"; + } + + private static string GetFilterText(ICollection selectedTransferStatuses) + => selectedTransferStatuses.Count == 0 ? string.Empty : CriteriaOperator.FromLambda(t => selectedTransferStatuses.Contains(t.TransferStatusType)).ToString(); + + void TagBox_ValuesChanged(IEnumerable newSelectedCategories) + { + var filterText = string.Empty; + InOperator? filterCriteria = null; + + _selectedCategories = newSelectedCategories.ToList(); + + if (_selectedCategories.Count > 0) + { + filterCriteria = new InOperator(nameof(Transfer.TransferStatusType), _selectedCategories); + filterText = GetFilterText(_selectedCategories); + } + + _filterText = filterText; + _gridTransfer.SetFieldFilterCriteria(nameof(Transfer.TransferStatusType), filterCriteria); + } + + // NE TÖRÖLD KI! - J. + // void TagBox_ValuesChanged(IEnumerable newSelectedCategories) + // { + // var filterText = string.Empty; + // InOperator? filterCriteria = null; + + // _selectedCategories = newSelectedCategories.ToList(); + // //_selectedCategories.Clear(); + // //_selectedCategories.AddRange(newSelectedCategories); + + // if (_selectedCategories.Count > 0) + // { + // filterCriteria = new InOperator(nameof(Transfer.TransferStatusType), _selectedCategories.Select(c => c.StatusValue)); + // filterText = GetFilterText(_selectedCategories.Select(x => (TransferStatusType)x.StatusValue).ToList()); + // } + + // _filterText = filterText; + // _gridTransfer.SetFieldFilterCriteria(nameof(Transfer.TransferStatusType), filterCriteria); + // } + + private void DataSourceChanged(IList transfers) + { + _logger.Info("DataSourceChanged called"); + + InitializeAppointments(transfers); + + if (_selectedCategories.Count > 0) + TagBox_ValuesChanged(_selectedCategories); + + // if(!SelectedCategories.Any()) + // SelectedCategories = [Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!]; + + // var filterTransferStatusType = Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!; + + // if (SelectedCategories.All(x => x.StatusValue != filterTransferStatusType.StatusValue)) + // SelectedCategories.Add(filterTransferStatusType); + } + + private void DataSourceItemChanging(GridDataItemChangingEventArgs args) + { + _logger.Info("DataSourceItemChanging called"); + } + + private void DataSourceItemChanged(GridDataItemChangedEventArgs args) + { + _logger.Info("DataSourceItemChanged called"); + + AppointmentModels.UpdateCollection(CreateAppointmentModel(args.DataItem), args.TrackingState == TrackingState.Remove); + } + + private void DataItemSaving(GridEditModelSavingEventArgs e) + { + _logger.Info("DataItemSaving called"); + } + + private void DataItemDeleting(GridDataItemDeletingEventArgs e) + { + _logger.Info($"DataItemDeleting OnItemDeleting"); + } + + protected override Task OnInitializedAsync() + { + _logger = new LoggerClient(_logWriters.ToArray()); + + //await AdminSignalRClient.GetAllCarsByProductIdAsync(TiamConstClient.TransferProductId, _cars, StateHasChanged); + + //await base.OnInitializedAsync(); + return base.OnInitializedAsync(); + } + + private void InitializeAppointments(ICollection transferDataList) + { + _logger.Info("InitializeAppointments called"); + + AppointmentModels = new List(transferDataList.Count); + + foreach (var transfer in transferDataList) + { + // var bnm = DataStorage.CreateAppointmentItem(); + // bnm.Start = transfer.Appointment; + // bnm.Description = $"{transfer.FullName}, {transfer.ToAddress}"; + // bnm.Location = transfer.FromAddress; + // bnm.Subject = "Simple transfer"; + + AppointmentModels.Add(CreateAppointmentModel(transfer)); + } + + _dataStorage = new DxSchedulerDataStorage + { + AppointmentMappings = new DxSchedulerAppointmentMappings() + { + Type = "AppointmentType", + Start = "StartDate", + End = "EndDate", + Subject = "Caption", + AllDay = "AllDay", + Location = "Location", + Description = "Description", + LabelId = "Label", + StatusId = "Status", + RecurrenceInfo = "Recurrence" + }, + + AppointmentsSource = AppointmentModels + }; + } + + public AppointmentModel CreateAppointmentModel(Transfer transfer) + { + return new AppointmentModel { Id = transfer.Id, StartDate = transfer.Appointment, EndDate = transfer.Appointment.AddMinutes(30), Description = $"{transfer.FullName}, {transfer.ToAddress}", Location = transfer.FromAddress, Caption = "Simple transfer" }; + } + + void ColumnChooserButton_Click() + { + _gridTransfer.ShowColumnChooser(); + } - public async Task SubmitForm(object result) - { - var messageModel = (result as MessageWizardModel)!; - _logger.Info(messageModel.Content); - var email = await wizardProcessor.ProcessWizardAsync(result.GetType(), messageModel); - _logger.Info($"Submitted nested form: {result.GetType().FullName}"); - CancelCreateClick(); - } + protected override void OnAfterRender(bool firstRender) + { + if (firstRender) + { + //_gridTransfer.ExpandDetailRow(0); + } + } - void Grid_CustomizeElement(GridCustomizeElementEventArgs e) - { - try - { - if (e.ElementType == GridElementType.HeaderCell) - { - e.Style = "background-color: rgba(0, 0, 0, 0.08)"; - e.CssClass = "header-bold"; - } + private void OnSelectedDataItemChanged(object selectedRow) + { + if (selectedRow is not Transfer selectedTransfer) return; - if (e.ElementType != GridElementType.DataRow) return; + RefreshTransferToDriversData(selectedTransfer, () => { _gridTransfer.Reload(); }); + } - var transferStatus = e.Grid?.GetRowValue(e.VisibleIndex, "TransferStatusType"); - if (transferStatus == null) return; + private void RefreshTransferToDriversData(Transfer? transfer, Action? callback = null) + { + try + { + if (transfer == null || transfer.TransferToDrivers.Count != 0 || transfer.TransferStatusType < TransferStatusType.AssignedToDriver) + return; - var transferStatusByte = (byte)transferStatus; + AdminSignalRClient.GetByIdAsync?>(SignalRTags.GetTransferDriversByTransferId, x => + { + if (x?.ResponseData == null) return Task.CompletedTask; - switch (transferStatusByte) - { - case 5: - e.CssClass = "bg-important"; - break; - case > 5 and < 35: - e.CssClass = "bg-attention"; - break; - case 35: - e.CssClass = "bg-finished"; - break; - case > 35: - e.CssClass = "bg-cancel"; - break; - } - } - catch (Exception ex) - { - _logger.Error($"Grid_CustomizeElement; {ex.Message}", ex); - } - } + transfer.TransferToDrivers.UpdateCollection(x.ResponseData, false); + callback?.Invoke(); - void Grid_CustomizeEditModel(GridCustomizeEditModelEventArgs e) - { - if (!e.IsNew) return; - - var transferEditModel = (Transfer)e.EditModel; //TODO not valid cast - transferEditModel.Id = Guid.NewGuid(); - transferEditModel.ToAddress = "Where to?"; - transferEditModel.FromAddress = "From where?"; - transferEditModel.Appointment = DateTime.UtcNow.AddDays(3); - transferEditModel.PassengerCount = 1; - transferEditModel.FirstName = "John"; - transferEditModel.LastName = "Doe"; - transferEditModel.ContactPhone = "+00000000000"; - transferEditModel.ContactEmail = "your@email.address"; - } - - private static string GetFilterText(ICollection selectedTransferStatuses) - => selectedTransferStatuses.Count == 0 ? string.Empty : CriteriaOperator.FromLambda(t => selectedTransferStatuses.Contains(t.TransferStatusType)).ToString(); - - void TagBox_ValuesChanged(IEnumerable newSelectedCategories) - { - var filterText = string.Empty; - InOperator? filterCriteria = null; - - _selectedCategories = newSelectedCategories.ToList(); - - if (_selectedCategories.Count > 0) - { - filterCriteria = new InOperator("TransferStatusType", _selectedCategories.Select(c => c.StatusValue)); - filterText = GetFilterText(_selectedCategories.Select(x => (TransferStatusType)x.StatusValue).ToList()); - } - - _filterText = filterText; - _gridTransfer.SetFieldFilterCriteria("TransferStatusType", filterCriteria); - } - - private void DataSourceChanged(IList transfers) - { - _logger.Info("DataSourceChanged called"); - - InitializeAppointments(transfers); - - if (_selectedCategories.Count > 0) - TagBox_ValuesChanged(_selectedCategories); - - // if(!SelectedCategories.Any()) - // SelectedCategories = [Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!]; - - // var filterTransferStatusType = Statuses.FirstOrDefault(x => x.StatusValue == (byte)TransferStatusType.Finished)!; - - // if (SelectedCategories.All(x => x.StatusValue != filterTransferStatusType.StatusValue)) - // SelectedCategories.Add(filterTransferStatusType); - } - - private void DataSourceItemChanging(GridDataItemChangingEventArgs args) - { - _logger.Info("DataSourceItemChanging called"); - } - - private void DataSourceItemChanged(GridDataItemChangedEventArgs args) - { - _logger.Info("DataSourceItemChanged called"); - - AppointmentModels.UpdateCollection(CreateAppointmentModel(args.DataItem), args.TrackingState == TrackingState.Remove); - } - - private void DataItemSaving(GridEditModelSavingEventArgs e) - { - _logger.Info("DataItemSaving called"); - } - - private void DataItemDeleting(GridDataItemDeletingEventArgs e) - { - _logger.Info($"DataItemDeleting OnItemDeleting"); - } - - protected override Task OnInitializedAsync() - { - _logger = new LoggerClient(_logWriters.ToArray()); - - return base.OnInitializedAsync(); - } - - private void InitializeAppointments(ICollection transferDataList) - { - _logger.Info("InitializeAppointments called"); - - AppointmentModels = new List(transferDataList.Count); - - foreach (var transfer in transferDataList) - { - // var bnm = DataStorage.CreateAppointmentItem(); - // bnm.Start = transfer.Appointment; - // bnm.Description = $"{transfer.FullName}, {transfer.ToAddress}"; - // bnm.Location = transfer.FromAddress; - // bnm.Subject = "Simple transfer"; - - AppointmentModels.Add(CreateAppointmentModel(transfer)); - } - - _dataStorage = new DxSchedulerDataStorage - { - AppointmentMappings = new DxSchedulerAppointmentMappings() - { - Type = "AppointmentType", - Start = "StartDate", - End = "EndDate", - Subject = "Caption", - AllDay = "AllDay", - Location = "Location", - Description = "Description", - LabelId = "Label", - StatusId = "Status", - RecurrenceInfo = "Recurrence" - }, - - AppointmentsSource = AppointmentModels - }; - } - - public AppointmentModel CreateAppointmentModel(Transfer transfer) - { - return new AppointmentModel { Id = transfer.Id, StartDate = transfer.Appointment, EndDate = transfer.Appointment.AddMinutes(30), Description = $"{transfer.FullName}, {transfer.ToAddress}", Location = transfer.FromAddress, Caption = "Simple transfer" }; - } - - void ColumnChooserButton_Click() - { - _gridTransfer.ShowColumnChooser(); - } - - - protected override void OnAfterRender(bool firstRender) - { - if (firstRender) - { - //_gridTransfer.ExpandDetailRow(0); - } - } + return Task.CompletedTask; + }, transfer.Id).Forget(); + } + catch (Exception ex) + { + _logger.Error($"RefreshTransferToDriversData error; transferId: {transfer?.Id}", ex); + } + } } \ No newline at end of file diff --git a/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor index 881a4f31..67c76709 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor @@ -27,14 +27,15 @@ @inject AdminSignalRClient AdminSignalRClient; @inject ISessionServiceClient sessionService @inject IComponentUpdateService ComponentUpdateService +@inject ITransferDataService transferDataService +Logger="_logger" +SignalRClient="AdminSignalRClient" +GetAllMessageTag="GetAllMessageTag" +ContextIds="@(ContextId.IsNullOrEmpty() ? throw new InvalidDataException($"ContextId.IsNullOrEmpty(); ContextId: {ContextId}") : [ContextId.Value])" +CustomizeElement="CustomizeElement" +ShowFilterRow="ShowFilterRow"> @@ -163,10 +164,24 @@ private Guid? myUserId; - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { _logger = new LoggerClient(LogWriters.ToArray()); - myUserId = _sessionService.User.UserId; + if(sessionService.User != null) + { + myUserId = _sessionService.User.UserId; + } + else + { + if(ContextId != null) + { + //should be transfer because in any other way, the user must be logged in + myUserId = Guid.Empty; //TODO get userId by transfer + var transfer = await AdminSignalRClient.GetTransferById((Guid)ContextId); + myUserId = transfer.UserId; + } + + } } private void CustomizeElement(GridCustomizeElementEventArgs e) diff --git a/TIAMSharedUI/Pages/User/SysAdmins/ToursFromTransferDestinations.razor b/TIAMSharedUI/Pages/User/SysAdmins/ToursFromTransferDestinations.razor new file mode 100644 index 00000000..5ec96792 --- /dev/null +++ b/TIAMSharedUI/Pages/User/SysAdmins/ToursFromTransferDestinations.razor @@ -0,0 +1,240 @@ +@page "/sysadmin/manage-tours" +@using System.ComponentModel.DataAnnotations +@using TIAM.Entities.Transfers +@using TIAMWebApp.Shared.Application.Interfaces +@using TIAMWebApp.Shared.Application.Models +@using TIAMWebApp.Shared.Application.Services +@using TIAMSharedUI.Shared +@inject ITransferDataService TransferDataService +@inject TourService TourService +@inject NavigationManager Navigation + +@layout AdminLayout + +Manage Tours + +

Manage Tours

+ +
+
+

Create New Tour

+ + + + + +
+ + + + @foreach (var dest in TransferDestinations) + { + + } + +
+ +
+ + +
+ +
+ + +
+ +
+ + + @if (!string.IsNullOrEmpty(UploadStatus)) + { +
@UploadStatus
+ } +
+ + + @if (IsEditing) + { + + } +
+
+ +
+ +
+

Existing Tours

+ @if (Tours.Any()) + { +
    + @foreach (var tour in Tours) + { + var dest = TransferDestinations.FirstOrDefault(d => d.Id == tour.TransferDestinationId); +
  • + + + @tour?.Title — @tour.FancyDescription + + + +
  • + } +
+ } + else + { +

No tours available.

+ } +
+
+ +@code { + private List TransferDestinations = []; + private List Tours = []; + + private TourFormModel newTour = new(); + private IBrowserFile? uploadedFile; + private string UploadStatus = string.Empty; + + private bool IsEditing = false; + private Guid? EditingTourId = null; + + + protected override async Task OnInitializedAsync() + { + TransferDestinations = (await TransferDataService.GetDestinationsAsync()).ToList(); + Tours = (await TourService.GetAllAsync()).ToList(); + } + + private void EditTour(TourInfo tour) + { + newTour = new TourFormModel + { + TransferDestinationId = tour.TransferDestinationId, + Name = tour.Title, + Description = tour.FancyDescription, + ImageBytes = null, + ImageFileName = null + }; + + IsEditing = true; + EditingTourId = tour.Id; + UploadStatus = string.Empty; + } + + private void CancelEdit() + { + newTour = new TourFormModel(); + uploadedFile = null; + IsEditing = false; + EditingTourId = null; + UploadStatus = string.Empty; + } + + // private async Task SaveTourAsync() + // { + // if (uploadedFile is not null) + // { + // using var stream = uploadedFile.OpenReadStream(maxAllowedSize: 5 * 1024 * 1024); + // using var ms = new MemoryStream(); + // await stream.CopyToAsync(ms); + // newTour.ImageBytes = ms.ToArray(); + // newTour.ImageFileName = uploadedFile.Name; + // } + + // TourInfo tourToCreate = new TourInfo(); + // tourToCreate.TransferDestinationId = newTour.TransferDestinationId; + // tourToCreate.FancyDescription = newTour.Description; + // tourToCreate.Title = newTour.Name; + // tourToCreate.CoverImageUrl = ""; + // if (tourToCreate.TransferDestinationId == Guid.Empty) + // { + // throw new InvalidOperationException("Transfer Destination must be selected."); + // } + + // await TourService.CreateAsync(tourToCreate, uploadedFile); + // newTour = new(); + // uploadedFile = null; + // UploadStatus = string.Empty; + // Tours = (await TourService.GetAllAsync()).ToList(); + // } + + private async Task HandleSubmit() + { + if (uploadedFile is not null) + { + using var stream = uploadedFile.OpenReadStream(maxAllowedSize: 5 * 1024 * 1024); + using var ms = new MemoryStream(); + await stream.CopyToAsync(ms); + newTour.ImageBytes = ms.ToArray(); + newTour.ImageFileName = uploadedFile.Name; + } + + if (IsEditing && EditingTourId.HasValue) + { + var updatedTour = new TourInfo + { + Id = EditingTourId.Value, + TransferDestinationId = newTour.TransferDestinationId, + Title = newTour.Name, + FancyDescription = newTour.Description, + CoverImageUrl = "" // assume your service handles image URL logic + }; + + await TourService.UpdateAsync(updatedTour, uploadedFile); + } + else + { + var tourToCreate = new TourInfo + { + TransferDestinationId = newTour.TransferDestinationId, + Title = newTour.Name, + FancyDescription = newTour.Description, + CoverImageUrl = newTour.ImageFileName + }; + + await TourService.CreateAsync(tourToCreate, uploadedFile); + } + + // Reset form + newTour = new TourFormModel(); + uploadedFile = null; + IsEditing = false; + EditingTourId = null; + UploadStatus = string.Empty; + + Tours = (await TourService.GetAllAsync()).ToList(); + } + + private void HandleFileChange(InputFileChangeEventArgs e) + { + uploadedFile = e.File; + UploadStatus = $"Selected: {uploadedFile.Name}"; + } + + private async Task DeleteTourAsync(Guid id) + { + await TourService.DeleteAsync(id); + Tours = (await TourService.GetAllAsync()).ToList(); + } + + public class TourFormModel + { + [Required] + public Guid TransferDestinationId { get; set; } + + [Required] + [StringLength(100, ErrorMessage = "Tour name cannot exceed 100 characters.")] + public string Name { get; set; } = string.Empty; + + public string? Description { get; set; } + + public byte[]? ImageBytes { get; set; } + public string? ImageFileName { get; set; } + } + +} + diff --git a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor index 2237f928..c7f3ece6 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/TransferDestinationGridComponent.razor @@ -135,7 +135,7 @@ newDestination.Id = Guid.NewGuid(); newDestination.Name = "Destination name"; newDestination.Description = "Type some description here"; - newDestination.AddressString = "The address of the destination"; + newDestination.AddressString = $"The address of: {newDestination.Name}"; Guid addressId = Guid.NewGuid(); newDestination.Address = new Address(); newDestination.Address.Id = addressId; diff --git a/TIAMSharedUI/Shared/AdminLayout.razor b/TIAMSharedUI/Shared/AdminLayout.razor index 777fea80..09a5410b 100644 --- a/TIAMSharedUI/Shared/AdminLayout.razor +++ b/TIAMSharedUI/Shared/AdminLayout.razor @@ -18,7 +18,7 @@
- + diff --git a/TIAMSharedUI/Shared/Components/BlogComponent.razor b/TIAMSharedUI/Shared/Components/BlogComponent.razor new file mode 100644 index 00000000..134c4624 --- /dev/null +++ b/TIAMSharedUI/Shared/Components/BlogComponent.razor @@ -0,0 +1,81 @@ +@using TIAMWebApp.Shared.Application.Models +@using TIAMWebApp.Shared.Application.Services +@inject BlogService BlogService + +
+

Blog Posts

+

+ Discover the hidden gems and breathtaking landscapes of Hungary! Our blog features inspiring destinations, scenic routes, and must-see spots that invite you to explore the natural beauty of this enchanting country. Whether you're planning your next adventure or simply dreaming of a getaway, let these stories guide your journey. +

+ +@if (posts == null) +{ +

Loading blog posts...

+} +else if (posts.Count == 0) +{ +

No blog posts found.

+} +else +{ + @*
*@ +
+ @foreach (var post in posts) + { +
+
+ @if (!string.IsNullOrEmpty(post.CoverImage)) + { + @post.Title + } +
+
@post.Title
+ @if (!string.IsNullOrEmpty(post.Lead)) + { + +

@post.Lead

+ } + @if (post.Tags?.Count > 0) + { +

+ @string.Join(", ", post.Tags) +

+ } + Read More +
+
+
+ @* +
+
+

@post.Title

+

@post.Tags

+

@post.Lead

+

@post.Id

+
+ by + +
+
+
+
*@ + } + @*
*@ +
+} + +
+ +@code { + [Parameter] public int PreviewNumber { get; set; } = 4; + + private List? posts; + + protected override async Task OnInitializedAsync() + { + posts = (await BlogService.GetAllPostsAsync()).Take(PreviewNumber).ToList(); + } + + + +} diff --git a/TIAMSharedUI/Shared/Components/FooterComponent.razor b/TIAMSharedUI/Shared/Components/FooterComponent.razor index 3e522f92..33fc361e 100644 --- a/TIAMSharedUI/Shared/Components/FooterComponent.razor +++ b/TIAMSharedUI/Shared/Components/FooterComponent.razor @@ -1,11 +1,11 @@  -