diff --git a/TIAMMobileApp/Services/SessionServiceMobile.cs b/TIAMMobileApp/Services/SessionServiceMobile.cs index b1d3b2f6..e8f4bdb6 100644 --- a/TIAMMobileApp/Services/SessionServiceMobile.cs +++ b/TIAMMobileApp/Services/SessionServiceMobile.cs @@ -28,5 +28,18 @@ namespace TIAMMobileApp.Services } public Guid DriverPersmissionId { get; set; } = Guid.Empty; + public async Task ClearAll() + { + SessionId = ""; + User = null; + IPAddress = null; + IsAuthenticated = false; + HasCompany = false; + IsDriver = false; + IsDevAdmin = false; + IsSysAdmin = false; + DriverPersmissionId = Guid.Empty; + } + } } diff --git a/TIAMSharedUI/Pages/AppLaunchComponent.razor b/TIAMSharedUI/Pages/AppLaunchComponent.razor index a917c6b8..bd139f4e 100644 --- a/TIAMSharedUI/Pages/AppLaunchComponent.razor +++ b/TIAMSharedUI/Pages/AppLaunchComponent.razor @@ -214,8 +214,7 @@ UserDataService.Logout(userBasicDetail.RefreshToken); AuthStateProvider.GetAuthenticationStateAsync(); SecureStorageHandler.ClearAllSecureStorageAsync(); - sessionService.User = null; - sessionService.IsAuthenticated = false; + sessionService.ClearAll().Forget(); } CultureInfo Culture diff --git a/TIAMSharedUI/Shared/Components/Navbar.razor.cs b/TIAMSharedUI/Shared/Components/Navbar.razor.cs index 058e763e..d7040c39 100644 --- a/TIAMSharedUI/Shared/Components/Navbar.razor.cs +++ b/TIAMSharedUI/Shared/Components/Navbar.razor.cs @@ -109,9 +109,8 @@ namespace TIAMSharedUI.Shared.Components } await SecureStorageHandler.ClearAllSecureStorageAsync(); var result = await AuthStateProvider.GetAuthenticationStateAsync(); - - sessionService.User = null; - sessionService.IsAuthenticated = false; + + await sessionService.ClearAll(); navigationManager.NavigateTo("/"); myUser = false; } diff --git a/TIAMSharedUI/Shared/Users/AdminNavMenu.razor b/TIAMSharedUI/Shared/Users/AdminNavMenu.razor index 78c6c9ad..972c4c3b 100644 --- a/TIAMSharedUI/Shared/Users/AdminNavMenu.razor +++ b/TIAMSharedUI/Shared/Users/AdminNavMenu.razor @@ -11,12 +11,60 @@ @inject AuthenticationStateProvider AuthStateProvider @inject NavigationManager NavigationManager @inject IEnumerable LogWriters +@inject IJSRuntime jsRuntime
- + DisplayMode="DisplayMode" + HamburgerButtonPosition="MenuHamburgerButtonPosition.Right"> + + @{ + if (_isMobile) + { + string url1 = $"user/sysadmin"; + string url2 = $"driver/transfers/{driverPermissionId}"; + string url3 = $"user/messages/{userId}"; + + + @* + + + *@ + @if (IsSysAdmin) + { + + + } + @if (IsDriver) + { + + + } + + + + } + } + @{ @@ -24,13 +72,13 @@ { } - if(userHasHotels) + if (userHasHotels) { - + } } @* *@ - + @@ -79,7 +127,7 @@ @* *@ @{ string url3 = $"user/messages/{userId}"; - + } @@ -130,6 +178,8 @@ private ILogger _logger; + private bool _isMobile; + MenuDisplayMode DisplayMode { get; set; } = MenuDisplayMode.Auto; Orientation Orientation { get; set; } = Orientation.Horizontal; @@ -139,8 +189,9 @@ NavigationManager.NavigateTo(url); } - protected override void OnInitialized() + protected override async Task OnInitializedAsync() { + _isMobile = await jsRuntime.InvokeAsync("isDevice"); _logger = new LoggerClient(LogWriters.ToArray()); //_logger.Debug($"UserId: {SessionService.User.UserModelDto.Id}"); //errorokat dobott IsDevAdmin = SessionService.IsDevAdmin; @@ -154,17 +205,17 @@ { userHasHotels = true; } - if (SessionService.User != null) + if (SessionService.User != null) { userId = SessionService.User.UserId; driverPermissionId = SessionService.DriverPersmissionId; - userEmail = SessionService.User.Email; + userEmail = SessionService.User.Email; if (SessionService.User.UserModelDto.ProfileDto.FullName != null) { userFullName = SessionService.User.UserModelDto.ProfileDto.FullName; } } - base.OnInitialized(); + await base.OnInitializedAsync(); } private void ToggleNavMenu() @@ -189,8 +240,7 @@ await SecureStorageHandler.ClearAllSecureStorageAsync(); var result = await AuthStateProvider.GetAuthenticationStateAsync(); - SessionService.User = null; - SessionService.IsAuthenticated = false; + await SessionService.ClearAll(); NavigationManager.NavigateTo("/"); } diff --git a/TIAMSharedUI/wwwroot/css/TourIAm.css b/TIAMSharedUI/wwwroot/css/TourIAm.css index f52fe56d..04a0cf3a 100644 --- a/TIAMSharedUI/wwwroot/css/TourIAm.css +++ b/TIAMSharedUI/wwwroot/css/TourIAm.css @@ -415,9 +415,13 @@ select:focus-visible { border-width: 0px; } +.my-menu { + +} +.my-menu.dxbl-menu-horizontal > .dxbl-menu-nav .dxbl-menu-nav-bar.dxbl-menu-hamburger-btn-pos-right > .dxbl-menu-title { + width: 100%; +} /*forms*/ - - /* Reseting */ * { margin: 0; diff --git a/TIAMWebApp/Client/Services/SessionServiceWeb.cs b/TIAMWebApp/Client/Services/SessionServiceWeb.cs index 524571fb..01ae7b45 100644 --- a/TIAMWebApp/Client/Services/SessionServiceWeb.cs +++ b/TIAMWebApp/Client/Services/SessionServiceWeb.cs @@ -30,5 +30,18 @@ namespace TIAMWebApp.Client.Services } public Guid DriverPersmissionId { get; set; } = Guid.Empty; + + public async Task ClearAll() + { + SessionId = ""; + User = null; + IPAddress = null; + IsAuthenticated = false; + HasCompany = false; + IsDriver = false; + IsDevAdmin = false; + IsSysAdmin = false; + DriverPersmissionId = Guid.Empty; + } } } diff --git a/TIAMWebApp/Shared/Interfaces/ISessionService.cs b/TIAMWebApp/Shared/Interfaces/ISessionService.cs index c88d0036..7dc1cc3b 100644 --- a/TIAMWebApp/Shared/Interfaces/ISessionService.cs +++ b/TIAMWebApp/Shared/Interfaces/ISessionService.cs @@ -16,5 +16,6 @@ namespace TIAMWebApp.Shared.Application.Interfaces public bool IsSysAdmin { get; set; } public List GetHotels(); public Guid DriverPersmissionId { get; set; } + public Task ClearAll(); } }