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.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 218e8c8a..7a2bc0f6 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/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/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.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/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/TIAMSharedUI/Pages/EditTransfers.razor b/TIAMSharedUI/Pages/EditTransfers.razor index 01c5426d..0e4232b9 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);
- +
@@ -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
- + @@ -527,6 +528,11 @@ else navManager.NavigateTo("/mytransfers"); // 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) { try 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/PublicCreateAndManageTransfer.razor b/TIAMSharedUI/Pages/PublicCreateAndManageTransfer.razor index df50869e..c91d5ba6 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/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/ManageTransfers.razor b/TIAMSharedUI/Pages/User/SysAdmins/ManageTransfers.razor index 37cf6796..81cb097d 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/ManageTransfers.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/ManageTransfers.razor @@ -118,6 +118,7 @@ + @{ @@ -165,6 +166,9 @@ @editFormContext.GetEditor("LastName") + + @editFormContext.GetEditor("ContactEmail") + @editFormContext.GetEditor("ToAddress") diff --git a/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor b/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor index aeaf0d62..6d232a81 100644 --- a/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor +++ b/TIAMSharedUI/Pages/User/SysAdmins/MessageDetailGridComponent.razor @@ -27,14 +27,15 @@ @inject AdminSignalRClient AdminSignalRClient; @inject ISessionService 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/Shared/AdminLayout.razor b/TIAMSharedUI/Shared/AdminLayout.razor index d5a1d5e7..08301b5a 100644 --- a/TIAMSharedUI/Shared/AdminLayout.razor +++ b/TIAMSharedUI/Shared/AdminLayout.razor @@ -18,7 +18,7 @@
- + diff --git a/TIAMSharedUI/Shared/Users/AdminNavMenu.razor b/TIAMSharedUI/Shared/Users/AdminNavMenu.razor index 3079ac10..be47426e 100644 --- a/TIAMSharedUI/Shared/Users/AdminNavMenu.razor +++ b/TIAMSharedUI/Shared/Users/AdminNavMenu.razor @@ -12,13 +12,14 @@ @inject NavigationManager NavigationManager @inject IEnumerable LogWriters @inject IJSRuntime jsRuntime +@inject IComponentUpdateService componentUpdateService
+ Orientation="Orientation" + DisplayMode="DisplayMode" + HamburgerButtonPosition="MenuHamburgerButtonPosition.Right"> @{ if (_isMobile) @@ -32,29 +33,29 @@ @if (IsSysAdmin) { + BeginGroup="true" + IconCssClass="fa-solid fa-face-smile" + Tooltip="Transfers" + Alignment="ToolbarItemAlignment.Right" + Click="() => NavigationManager.NavigateTo(url1)" /> } @if (IsDriver) { + BeginGroup="true" + IconCssClass="fa-solid fa-taxi" + Tooltip="My tasks" + Alignment="ToolbarItemAlignment.Right" + Click="() => NavigationManager.NavigateTo(url2)" /> } + BeginGroup="true" + IconCssClass="fa-solid fa-envelope" + Tooltip="Messages" + Alignment="ToolbarItemAlignment.Right" + Click="() => NavigationManager.NavigateTo(url3)" /> } @@ -107,11 +108,11 @@ @* *@ @{ @@ -153,6 +154,7 @@ private bool expandHotelAdminNav = false; private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; + private bool myUser = false; private bool userHasCompany; private bool userHasHotels; private bool IsDriver; @@ -237,4 +239,56 @@ SessionService.ClearAll(); NavigationManager.NavigateTo("/"); } + + protected override void OnAfterRender(bool firstRender) + { + base.OnAfterRender(firstRender); + + if (firstRender) + componentUpdateService.GetOrAddComponent().RefreshRequested += RefreshMe; + } + + private void RefreshMe() + { + _logger.Debug($"Navbar refresh called! {DateTime.Now} "); + + //OnInitialized(); + InitUser(); + StateHasChanged(); + } + + private void InitUser() + { + if (SessionService.User != null) + { + myUser = true; + userId = SessionService.User.UserId; + userEmail = SessionService.User.Email; + + if (SessionService.User.UserModelDto.ProfileDto.FullName != null) + { + userFullName = SessionService.User.UserModelDto.ProfileDto.FullName!; + } + } + else + { + _logger.Debug($"Navbar myUser false! {DateTime.Now} "); + myUser = false; + } + + var properties = SessionService.User?.HasProperties; + if (properties == null) return; + + userHasCompany = SessionService.HasCompany; + userHasHotels = properties.Count > 0; + IsSysAdmin = SessionService.IsSysAdmin; + IsDevAdmin = SessionService.IsDevAdmin; + IsDriver = SessionService.IsDriver; + driverPermissionId = SessionService.DriverPersmissionId; + + foreach (var property in properties) + { + _logger.Detail($"First property: {property.Value} "); + } + } } diff --git a/TIAMSharedUI/TIAMSharedUI.csproj b/TIAMSharedUI/TIAMSharedUI.csproj index e9d3f208..bb1d18c9 100644 --- a/TIAMSharedUI/TIAMSharedUI.csproj +++ b/TIAMSharedUI/TIAMSharedUI.csproj @@ -19,7 +19,7 @@ - + diff --git a/TIAMSharedUI/TIAMSharedUI.csproj.bak b/TIAMSharedUI/TIAMSharedUI.csproj.bak index baa25e1a..e9d3f208 100644 --- a/TIAMSharedUI/TIAMSharedUI.csproj.bak +++ b/TIAMSharedUI/TIAMSharedUI.csproj.bak @@ -6,6 +6,11 @@ enable + + + + + @@ -14,10 +19,10 @@ - - - - + + + + @@ -74,9 +79,39 @@ + + true + + + true + + + true + + + true + true + + <_ContentIncludedByDefault Remove="Pages\Utility\DynamicForm.razor" /> + <_ContentIncludedByDefault Remove="Shared\Users\NavigationHelperComponent.razor" /> + + + + + + + + + + + + + + + diff --git a/TIAMWebApp/Client/Properties/PublishProfiles/FolderProfile.pubxml b/TIAMWebApp/Client/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 00000000..94711905 --- /dev/null +++ b/TIAMWebApp/Client/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,20 @@ + + + + + true + false + true + Release + Any CPU + FileSystem + D:\REPOS\AYCODE\Publish\ServerRelease + FileSystem + <_TargetId>Folder + + net8.0 + browser-wasm + 2091d897-ba49-4fc1-808f-036fa040376e + true + + \ No newline at end of file diff --git a/TIAMWebApp/Client/Services/WizardProcessor.cs b/TIAMWebApp/Client/Services/WizardProcessor.cs index 9fbaddc8..86581f8b 100644 --- a/TIAMWebApp/Client/Services/WizardProcessor.cs +++ b/TIAMWebApp/Client/Services/WizardProcessor.cs @@ -3,6 +3,7 @@ using TIAM.Entities.Emails; //using TIAM.Entities.TransferDestinations; using TIAMWebApp.Shared.Application.Interfaces; using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels; +using EmailMessage = TIAM.Entities.Emails.EmailMessage; namespace TIAMWebApp.Client.Services { diff --git a/TIAMWebApp/Client/TIAMWebApp.Client.csproj.user b/TIAMWebApp/Client/TIAMWebApp.Client.csproj.user index 983ecfc0..c60cdb27 100644 --- a/TIAMWebApp/Client/TIAMWebApp.Client.csproj.user +++ b/TIAMWebApp/Client/TIAMWebApp.Client.csproj.user @@ -1,7 +1,8 @@  - http + https + D:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Client\Properties\PublishProfiles\FolderProfile.pubxml ProjectDebugger diff --git a/TIAMWebApp/Server/Controllers/UserAPIController.cs b/TIAMWebApp/Server/Controllers/UserAPIController.cs index c5d6eef2..85485997 100644 --- a/TIAMWebApp/Server/Controllers/UserAPIController.cs +++ b/TIAMWebApp/Server/Controllers/UserAPIController.cs @@ -115,7 +115,13 @@ namespace TIAMWebApp.Server.Controllers if (!loggedInModel.IsLoggedIn) { _logger.Warning(@"User not valid! errorCode: " + loggedInModel.LoginErrorCode); - return null; + //return null; + return new MainResponse + { + Content = loggedInModel.LoginErrorCode, + IsSuccess = false, + ErrorMessage = "Not valid login." + }; } var response = new MainResponse @@ -550,7 +556,7 @@ namespace TIAMWebApp.Server.Controllers //send email _logger.Info($"Created transfer, send emailMessage!!!"); - var message = new MessageSenderModel(); + var message = new MessageSenderModel(); message.Message = new EmailMessage(); message.Message.EmailAddress = email; message.Message.Id = Guid.NewGuid(); diff --git a/TIAMWebApp/Server/Program.cs b/TIAMWebApp/Server/Program.cs index 804cf070..bf06f344 100644 --- a/TIAMWebApp/Server/Program.cs +++ b/TIAMWebApp/Server/Program.cs @@ -64,7 +64,8 @@ builder.Services.AddCors(options => { options.AddPolicy(myAllowSpecificOrigins, policy => { - policy.AllowAnyOrigin(); + policy.WithOrigins("http://touriam.com", + "http://www.touriam.com"); }); }); diff --git a/TIAMWebApp/Server/TIAMWebApp.Server.csproj b/TIAMWebApp/Server/TIAMWebApp.Server.csproj index 2fb8c354..1faa5af1 100644 --- a/TIAMWebApp/Server/TIAMWebApp.Server.csproj +++ b/TIAMWebApp/Server/TIAMWebApp.Server.csproj @@ -18,7 +18,7 @@ - + @@ -27,6 +27,7 @@ + diff --git a/TIAMWebApp/Server/TIAMWebApp.Server.csproj.user b/TIAMWebApp/Server/TIAMWebApp.Server.csproj.user index 9169adf7..7ba22969 100644 --- a/TIAMWebApp/Server/TIAMWebApp.Server.csproj.user +++ b/TIAMWebApp/Server/TIAMWebApp.Server.csproj.user @@ -2,7 +2,7 @@ https - C:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Server\Properties\PublishProfiles\ReleaseDeployProfile.pubxml + D:\REPOS\AYCODE\source\TourIAm\TIAMWebApp\Server\Properties\PublishProfiles\ReleaseDeployProfile.pubxml ProjectDebugger diff --git a/TIAMWebApp/Server/appsettings.json b/TIAMWebApp/Server/appsettings.json index 08c999a4..53fe55e4 100644 --- a/TIAMWebApp/Server/appsettings.json +++ b/TIAMWebApp/Server/appsettings.json @@ -1,6 +1,7 @@ { "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=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=194.164.235.47;Initial Catalog=TIAM_DEV;Trusted_Connection=false;Encrypt=false;TrustServerCertificate=True;Connect Timeout=200;User ID=Anata_Development_Team;Password=v6f_?xNfg9N1;MultipleActiveResultSets=true" }, "Logging": { "LogLevel": { diff --git a/TIAMWebApp/Shared/Interfaces/IClientNoticeSenderService.cs b/TIAMWebApp/Shared/Interfaces/IClientNoticeSenderService.cs index 6b60a393..f7445d2f 100644 --- a/TIAMWebApp/Shared/Interfaces/IClientNoticeSenderService.cs +++ b/TIAMWebApp/Shared/Interfaces/IClientNoticeSenderService.cs @@ -1,4 +1,5 @@ using TIAM.Entities.Emails; +using EmailMessage = TIAM.Entities.Emails.EmailMessage; namespace TIAMWebApp.Shared.Application.Interfaces { diff --git a/TIAMWebApp/Shared/Models/ClientSide/Setting.cs b/TIAMWebApp/Shared/Models/ClientSide/Setting.cs index 83fdc1ff..d1efeaa0 100644 --- a/TIAMWebApp/Shared/Models/ClientSide/Setting.cs +++ b/TIAMWebApp/Shared/Models/ClientSide/Setting.cs @@ -8,10 +8,10 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide //public static string BaseUrl = "https://touriam.mangoweb.hu"; //public static string ApiBaseUrl = "https://touriam.mangoweb.hu"; #if RELEASE - public static string BaseUrl = "https://test.touriam.com"; - public static string ApiBaseUrl = "https://test.touriam.com"; - //public static string BaseUrl = "https://touriam.com"; - //public static string ApiBaseUrl = "https://touriam.com"; + //public static string BaseUrl = "https://test.touriam.com"; + //public static string ApiBaseUrl = "https://test.touriam.com"; + public static string BaseUrl = "https://touriam.com"; + public static string ApiBaseUrl = "https://touriam.com"; //public static string BaseUrl = "https://qa.touriam.com"; //public static string ApiBaseUrl = "https://qa.touriam.com"; #else diff --git a/TIAMWebApp/Shared/Services/ClientNoticeSenderService.cs b/TIAMWebApp/Shared/Services/ClientNoticeSenderService.cs index 09113980..fdbbe5c9 100644 --- a/TIAMWebApp/Shared/Services/ClientNoticeSenderService.cs +++ b/TIAMWebApp/Shared/Services/ClientNoticeSenderService.cs @@ -5,6 +5,7 @@ using System.Net.Http.Json; //using AyCode.Models.Messages; using TIAM.Entities.Emails; using TIAMWebApp.Shared.Application.Models.ClientSide.Messages; +using EmailMessage = TIAM.Entities.Emails.EmailMessage; namespace TIAMWebApp.Shared.Application.Services { diff --git a/TIAMWebApp/Shared/Services/UserDataServiceClientBase.cs b/TIAMWebApp/Shared/Services/UserDataServiceClientBase.cs index 715d576d..1a8384ba 100644 --- a/TIAMWebApp/Shared/Services/UserDataServiceClientBase.cs +++ b/TIAMWebApp/Shared/Services/UserDataServiceClientBase.cs @@ -80,8 +80,8 @@ public abstract class UserDataServiceClientBase : IUserDataService public async Task AuthenticateUser(LoginModel loginModel) { Logger.Debug($"AuthenticateUser; email: {loginModel.Email}"); - - return await AdminSignalRClient.PostDataAsync(SignalRTags.AuthenticateUser, loginModel); + var result = await AdminSignalRClient.PostDataAsync(SignalRTags.AuthenticateUser, loginModel); + return result; //var result = string.Empty; //var url = $"{Setting.ApiBaseUrl}/{APIUrls.AuthenticateUser}";