log textwrap, menu permissions, others
This commit is contained in:
parent
8517864be4
commit
d1a8f706d4
|
|
@ -5,6 +5,13 @@ namespace TIAM.Core.Consts;
|
|||
public static class TiamConstClient
|
||||
{
|
||||
public static Guid TransferProductId = Guid.Parse("814b5495-c2e9-4f1d-a73f-37cd5d353078");
|
||||
public static Guid[] DevAdminIds = new Guid[2]{Guid.Parse("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd"), Guid.Parse("4cbaed43-2465-4d99-84f1-c8bc6b7025f7") };
|
||||
public static Guid[] SysAdmins = new Guid[3]
|
||||
{
|
||||
Guid.Parse("dcf451d2-cc4c-4ac2-8c1f-da00041be1fd"),
|
||||
Guid.Parse("4cbaed43-2465-4d99-84f1-c8bc6b7025f7"),
|
||||
Guid.Parse("540271f6-c604-4c16-8160-d5a7cafedf00")
|
||||
};
|
||||
}
|
||||
|
||||
public class TiamConst : AcConst
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="8.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.6" />
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace TIAM.Database.Test
|
|||
//_userDal = new UserDal(_mockContext.Object);
|
||||
}
|
||||
|
||||
//[TestMethod]
|
||||
[TestMethod]
|
||||
public async Task ConvertOldPassword()
|
||||
{
|
||||
//var loginService = new LoginService(Dal, AppSettingsConfiguration);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace TIAMMobileApp
|
|||
builder.Services.AddScoped<ISupplierService, SupplierService>();
|
||||
builder.Services.AddScoped<IUserDataService, UserDataServiceMobile>();
|
||||
builder.Services.AddScoped<ISecureStorageHandler, SecureStorageHandler>();
|
||||
builder.Services.AddScoped<ISessionService, SessionServiceMobile>();
|
||||
builder.Services.AddSingleton<ISessionService, SessionServiceMobile>();
|
||||
builder.Services.AddSingleton<IComponentUpdateService, ComponentUpdateServiceMobile>();
|
||||
builder.Services.AddScoped<IServiceProviderDataService, ServiceProviderDataService>();
|
||||
builder.Services.AddScoped<IClientNoticeSenderService, ClientNoticeSenderService>();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ namespace TIAMMobileApp.Services
|
|||
public string? SessionId { get; set; }
|
||||
public UserSessionModel? User { get; set; }
|
||||
public IPAddress? IPAddress { get; set; }
|
||||
public bool IsAuthenticated { get; set; }
|
||||
public bool IsAuthenticated { get; set; } = false;
|
||||
public bool HasCompany { get; set; } = false;
|
||||
public bool IsDriver { get; set; } = false;
|
||||
public bool IsDevAdmin { get; set; } = false;
|
||||
public bool IsSysAdmin { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@* @page "/"; *@
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using TIAM.Core.Consts
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
|
|
@ -107,9 +108,9 @@
|
|||
string _userId = jsontoken.Claims.First(claim => claim.Type == JwtRegisteredClaimNames.NameId).Value;
|
||||
string _email = jsontoken.Claims.First(claim => claim.Type == JwtRegisteredClaimNames.Email).Value;
|
||||
var user = await UserDataService.IsLoggedInAsync(Guid.Parse(_userId));
|
||||
sessionService.User = user;
|
||||
SaveToSessionInfo(user);
|
||||
_logger.Info($"Saved user in db is: {user.DisplayName}, setting autenthicated state");
|
||||
sessionService.IsAuthenticated = true;
|
||||
|
||||
//NavManager.NavigateTo("/");
|
||||
}
|
||||
else
|
||||
|
|
@ -121,6 +122,29 @@
|
|||
|
||||
}
|
||||
|
||||
protected void SaveToSessionInfo(UserSessionModel user)
|
||||
{
|
||||
sessionService.User = user;
|
||||
sessionService.IsAuthenticated = true;
|
||||
sessionService.HasCompany = user.UserModelDto.UserProductMappings.Count > 0;
|
||||
if (user.UserModelDto.UserProductMappings.Any(x => x.ProductId == TiamConstClient.TransferProductId))
|
||||
{
|
||||
sessionService.IsDriver = true;
|
||||
}
|
||||
if (user.UserModelDto.Id == TiamConstClient.DevAdminIds[0] || user.UserModelDto.Id == TiamConstClient.DevAdminIds[1])
|
||||
{
|
||||
sessionService.IsDevAdmin = true;
|
||||
}
|
||||
foreach (var guid in TiamConstClient.SysAdmins)
|
||||
{
|
||||
if (user.UserModelDto.Id == guid)
|
||||
{
|
||||
sessionService.IsSysAdmin = true;
|
||||
}
|
||||
}
|
||||
_logger.Debug($"Saved to session: IsAuthenticated: {sessionService.IsAuthenticated}, HasCompany: {sessionService.HasCompany}, IsDriver: {sessionService.IsDriver}, IsDevAdmin: {sessionService.IsDevAdmin}, IsSysAdmin: {sessionService.IsSysAdmin}");
|
||||
}
|
||||
|
||||
public async Task<(string, string)> GetLocalSettings()
|
||||
{
|
||||
string userDetailsStr = await SecureStorageHandler.GetFromSecureStorageAsync(nameof(Setting.UserBasicDetails));
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using TIAMSharedUI.Resources;
|
|||
using Microsoft.Extensions.Localization;
|
||||
using AyCode.Services.Loggers;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using TIAM.Core.Consts;
|
||||
|
||||
namespace TIAMSharedUI.Pages
|
||||
{
|
||||
|
|
@ -159,6 +160,23 @@ namespace TIAMSharedUI.Pages
|
|||
{
|
||||
sessionService.User = user;
|
||||
sessionService.IsAuthenticated = true;
|
||||
sessionService.HasCompany = user.UserModelDto.UserProductMappings.Count > 0;
|
||||
if(user.UserModelDto.UserProductMappings.Any(x=>x.ProductId==TiamConstClient.TransferProductId))
|
||||
{
|
||||
sessionService.IsDriver = true;
|
||||
}
|
||||
if (user.UserModelDto.Id == TiamConstClient.DevAdminIds[0] || user.UserModelDto.Id == TiamConstClient.DevAdminIds[1])
|
||||
{
|
||||
sessionService.IsDevAdmin = true;
|
||||
}
|
||||
foreach (var guid in TiamConstClient.SysAdmins)
|
||||
{
|
||||
if (user.UserModelDto.Id == guid)
|
||||
{
|
||||
sessionService.IsSysAdmin = true;
|
||||
}
|
||||
}
|
||||
BrowserConsoleLogWriter.Debug($"Saved to session: IsAuthenticated: {sessionService.IsAuthenticated}, HasCompany: {sessionService.HasCompany}, IsDriver: {sessionService.IsDriver}, IsDevAdmin: {sessionService.IsDevAdmin}, IsSysAdmin: {sessionService.IsSysAdmin}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
@page "/user/hoteladmin"
|
||||
@page "/user/hoteladmin/{id}"
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces;
|
||||
@layout AdminLayout
|
||||
@inject IPopulationStructureDataProvider DataProvider
|
||||
@inject ISupplierService SupplierService
|
||||
@inject IUserDataService UserDataService
|
||||
@inject ISessionService SessionService
|
||||
<PageTitle>HotelAdmin</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
|
|
@ -16,179 +15,31 @@
|
|||
|
||||
<div class="container">
|
||||
|
||||
<HotelComponent Id="@Id"></HotelComponent>
|
||||
<HotelComponent Id="@id"></HotelComponent>
|
||||
|
||||
<!-- Stats admin-->
|
||||
<hr />
|
||||
|
||||
|
||||
@* <div class="row py-3">
|
||||
<div class=" col-12 col-xl-3">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="fw-bold text-body">Panel title</span>
|
||||
<p class="text-muted mb-0">Subtitle</p>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="mb-0"> <a href="#">All details</a> </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Some info</h5>
|
||||
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
|
||||
<li class="step0 active" id="step1">
|
||||
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
|
||||
</li>
|
||||
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
|
||||
<li class="step0 text-muted text-end" id="step3">
|
||||
<span style="margin-right: 22px;">FINISHED</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<h4> Some <span class="small text-muted"> conclusion </span></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-2 px-4">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<a href="#!">Modify</a>
|
||||
<div class="border-start h-100"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="fw-bold text-body">Panel title</span>
|
||||
<p class="text-muted mb-0">Subtitle</p>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="mb-0"> <a href="#">All details</a> </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Some info</h5>
|
||||
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
|
||||
<li class="step0 active" id="step1">
|
||||
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
|
||||
</li>
|
||||
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
|
||||
<li class="step0 text-muted text-end" id="step3">
|
||||
<span style="margin-right: 22px;">FINISHED</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<h4> Some <span class="small text-muted"> conclusion </span></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-2 px-4">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<a href="#!">Modify</a>
|
||||
<div class="border-start h-100"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="fw-bold text-body">Panel title</span>
|
||||
<p class="text-muted mb-0">Subtitle</p>
|
||||
</div>
|
||||
<div>
|
||||
<h6 class="mb-0"> <a href="#">All details</a> </h6>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<div class="flex-fill">
|
||||
<h5 class="bold">Some info</h5>
|
||||
<p class="text-muted"> Budapest, Dózsa György út 35, 1146</p>
|
||||
</div>
|
||||
<div>
|
||||
<!--img class="align-self-center img-fluid"
|
||||
src="https://mdbcdn.b-cdn.net/img/Photos/Horizontal/E-commerce/Products/6.webp" width="250"-->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<ul id="progressbar-1" class="mx-0 mt-0 mb-5 px-0 pt-0 pb-4">
|
||||
<li class="step0 active" id="step1">
|
||||
<span style="margin-left: 22px; margin-top: 12px;">PLACED</span>
|
||||
</li>
|
||||
<li class="step0 active text-center" id="step2"><span>WAITING FOR PICK UP</span></li>
|
||||
<li class="step0 text-muted text-end" id="step3">
|
||||
<span style="margin-right: 22px;">FINISHED</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<h4> Some <span class="small text-muted"> conclusion </span></h4>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer py-2 px-4">
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<a href="#!">Modify</a>
|
||||
<div class="border-start h-100"></div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" col-12 col-xl-3">
|
||||
|
||||
</div>
|
||||
|
||||
</div> *@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
string Id = "2312-32132121-32123";
|
||||
[Parameter] public Guid id { get; set; }
|
||||
bool isUserLoggedIn;
|
||||
int userType = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
//check if Id matches with userproductmapping
|
||||
if (!SessionService.IsAuthenticated)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var check = SessionService.User.UserModelDto.UserProductMappings.Any(x => x.ProductId == id);
|
||||
if (!check)
|
||||
{
|
||||
return;
|
||||
}
|
||||
base.OnInitialized();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
namespace TIAMSharedUI.Pages.User
|
||||
{
|
||||
public partial class Home
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,7 @@ namespace TIAMSharedUI.Pages.User.Hotels
|
|||
{
|
||||
|
||||
[Parameter]
|
||||
public string? Id { get; set; }
|
||||
public Guid Id { get; set; }
|
||||
|
||||
[Inject]
|
||||
ISupplierService SupplierService { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
@page "/user/properties"
|
||||
@using BlazorAnimation
|
||||
@using TIAM.Entities.ServiceProviders
|
||||
@using TIAM.Resources
|
||||
@using TIAM.Services
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
|
|
@ -15,57 +17,32 @@
|
|||
@inject ISessionService SessionService
|
||||
@inject IServiceProviderDataService ServiceProviderDataService
|
||||
@inject AdminSignalRClient AdminSignalRClient;
|
||||
<PageTitle>User permissions</PageTitle>
|
||||
|
||||
<h3>Properties</h3>
|
||||
<div class="text-center m-5">
|
||||
<h1>Drivers</h1>
|
||||
<h2 style="font-size:small">Manage drivers here!</h2>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class=" col-12 col-xl-6">
|
||||
<div class="card glass card-admin" style="border-radius: 16px;">
|
||||
<div class="card-header py-2 px-4">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<span class="fw-bold text-body">Service providers list</span>
|
||||
|
||||
<div class=" col-12">
|
||||
<Animation Effect="@Effect.FadeInUp" Speed="@Speed.Fast" Delay="@TimeSpan.FromMilliseconds(250)">
|
||||
<div class="card">
|
||||
<div class="d-flex flex-column mb-4 pb-2">
|
||||
<div class="align-self-end pl-2 pb-2">
|
||||
<DxButton Text="Column Chooser"
|
||||
RenderStyle="ButtonRenderStyle.Secondary"
|
||||
IconCssClass="btn-column-chooser"
|
||||
Click="ColumnChooserButton_Click" />
|
||||
</div>
|
||||
<div>
|
||||
<!--div class="target-container" @onclick="@(() => EulaVisible = true)">
|
||||
<button class="btn btn-primary">Create</button>
|
||||
</div-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body card-admin-body py-2 px-4">
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
|
||||
|
||||
|
||||
@*<DxPopup CssClass="popup-demo-events"
|
||||
@bind-Visible="@EulaVisible"
|
||||
ShowFooter="true"
|
||||
CloseOnEscape="false"
|
||||
CloseOnOutsideClick="false"
|
||||
ShowCloseButton="true"
|
||||
HeaderText="@localizer.GetString(ResourceKeys.ServiceProviderTitle)"
|
||||
Closing="EulaPopupClosing"
|
||||
Closed="EulaPopupClosed">
|
||||
<BodyContentTemplate>
|
||||
<InputWizard Data=@myModel OnSubmit="SubmitForm" SubmitButtonText=@ResourceKeys.ButtonSave TitleResourceString=@ResourceKeys.ServiceProviderTitle></InputWizard>
|
||||
</BodyContentTemplate>
|
||||
<FooterContentTemplate Context="Context">
|
||||
<div class="popup-demo-events-footer">
|
||||
<!--DxCheckBox CssClass="popup-demo-events-checkbox" @bind-Checked="@EulaAccepted">I accept the terms of the EULA</!--DxCheckBox-->
|
||||
<!--DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Primary" Text="OK" Click="Context.CloseCallback" /-->
|
||||
<DxButton CssClass="popup-demo-events-button ms-2" RenderStyle="ButtonRenderStyle.Secondary" Text=@localizer.GetString(ResourceKeys.ButtonCancel) Click="CancelCreateClick" />
|
||||
</div>
|
||||
</FooterContentTemplate>
|
||||
</DxPopup>*@
|
||||
|
||||
<CompanyGrid @ref="_gridCompany"
|
||||
Logger="_logger"
|
||||
SignalRClient="AdminSignalRClient"
|
||||
|
||||
ContextIds="contextIds"
|
||||
GetAllMessageTag="SignalRTags.GetCompaniesByContextId"
|
||||
PageSize="12"
|
||||
ValidationEnabled="false"
|
||||
DetailRowDisplayMode="GridDetailRowDisplayMode.Always"
|
||||
|
|
@ -78,28 +55,20 @@
|
|||
<a class="d-block text-left" href="user/serviceprovider/@context.Value.ToString()">@context.Value</a>
|
||||
</CellDisplayTemplate>
|
||||
</DxGridDataColumn>
|
||||
<DxGridDataColumn Caption="Address" FieldName="Profile.Address.AddressText" MinWidth="80" />
|
||||
<DxGridDataColumn FieldName="Name" MinWidth="80" />
|
||||
<DxGridDataColumn FieldName="OwnerId" MinWidth="80" />
|
||||
<DxGridDataColumn FieldName="Created" DisplayFormat="g" Width="140" />
|
||||
<DxGridDataColumn FieldName="Modified" DisplayFormat="g" Width="140" />
|
||||
|
||||
</Columns>
|
||||
<DetailRowTemplate>
|
||||
@{
|
||||
<text>@(((Company)context.DataItem).Profile.Address.AddressText)</text>
|
||||
<p>@(((Company)context.DataItem).Profile.Address.AddressText)</p>
|
||||
}
|
||||
</DetailRowTemplate>
|
||||
</CompanyGrid>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex flex-row mb-4 pb-2">
|
||||
<h4> Some <span class="small text-muted"> conclusion </span></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</Animation>
|
||||
</div>
|
||||
|
||||
<div class=" col-12 col-xl-6">
|
||||
|
|
@ -119,11 +88,10 @@
|
|||
bool EulaAccepted { get; set; }
|
||||
bool EulaVisible { get; set; }
|
||||
|
||||
private Guid[] contextIds = new Guid[0];
|
||||
|
||||
void CancelCreateClick()
|
||||
{
|
||||
|
||||
|
||||
EulaVisible = false;
|
||||
}
|
||||
void EulaPopupClosed()
|
||||
|
|
@ -161,12 +129,18 @@
|
|||
_logger = new LoggerClient<MyServiceProviders>(LogWriters.ToArray());
|
||||
|
||||
var myId = SessionService.User.UserId;
|
||||
|
||||
ServiceProviderDataService.GetPropertiesByOwnerIdAsync(myId, companyPropertiesByOwner =>
|
||||
{
|
||||
_logger.DetailConditional($"companyPropertiesByOwner count: {companyPropertiesByOwner?.Count.ToString() ?? "NULL"}");
|
||||
}).Forget();
|
||||
contextIds = new Guid[1];
|
||||
contextIds[0] = myId;
|
||||
// ServiceProviderDataService.GetPropertiesByOwnerIdAsync(myId, companyPropertiesByOwner =>
|
||||
// {
|
||||
// _logger.DetailConditional($"companyPropertiesByOwner count: {companyPropertiesByOwner?.Count.ToString() ?? "NULL"}");
|
||||
// }).Forget();
|
||||
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
void ColumnChooserButton_Click()
|
||||
{
|
||||
_gridCompany.ShowColumnChooser();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<PageTitle>Admin - Companies</PageTitle>
|
||||
|
||||
<div class="text-center m-5">
|
||||
<h1>Company: @Id</h1>
|
||||
<h1>Company</h1>
|
||||
<h2 style="font-size:small">Manage your service provider details</h2>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,10 @@
|
|||
@{
|
||||
var a = ((LogItemViewerModel)context.DataItem);
|
||||
}
|
||||
<div>@($"{a.CategoryName}->{a.CallerName}")</div>
|
||||
<div>@($"{a.Text}")</div><br />
|
||||
<div><p>@($"{a.CategoryName}->{a.CallerName}")</p></div>
|
||||
<div><p>@($"{a.Text}")</p></div><br />
|
||||
<div style="font-weight: bold;">Exception:</div>
|
||||
<div style="word-wrap: break-word;">@a.Exception</div>
|
||||
<div><p style="text-wrap: wrap;">@a.Exception</p></div>
|
||||
</DetailRowTemplate>
|
||||
<ToolbarTemplate>
|
||||
<div>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,16 @@
|
|||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using AyCode.Services.Loggers
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using Newtonsoft.Json
|
||||
@using TIAM.Core.Loggers
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using AyCode.Interfaces.StorageHandlers;
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@inject ISecureStorageHandler SecureStorageHandler
|
||||
@inject ISessionService SessionService
|
||||
@inject IUserDataService UserDataService
|
||||
@inject AuthenticationStateProvider AuthStateProvider
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
||||
|
||||
|
||||
<div class="w-100" style="height:40px; position:fixed;">
|
||||
|
|
@ -13,7 +23,7 @@
|
|||
<DxMenuItem NavigateUrl="user/media" Text="Media" IconCssClass="menu-icon-home menu-icon" />
|
||||
<DxMenuItem NavigateUrl="user/messages" Text="Media" IconCssClass="menu-icon-home menu-icon" />
|
||||
|
||||
<DxMenuItem Text="SysAdmin" IconCssClass="menu-icon-products menu-icon">
|
||||
<DxMenuItem Text="SysAdmin" Visible="@IsSysAdmin" IconCssClass="menu-icon-products menu-icon">
|
||||
<Items>
|
||||
<DxMenuItem NavigateUrl="user/sysadmin" Text="Dashboard" />
|
||||
<DxMenuItem NavigateUrl="sysadmin/transfers" Text="Transfers" />
|
||||
|
|
@ -26,9 +36,15 @@
|
|||
|
||||
<DxMenuItem NavigateUrl="sysadmin/userproductmappings" Text="Permissions" />
|
||||
<DxMenuItem NavigateUrl="sysadmin/users" Text="Users" />
|
||||
</Items>
|
||||
</DxMenuItem>
|
||||
|
||||
<DxMenuItem Text="DevAdmin" Visible="@IsDevAdmin" IconCssClass="menu-icon-products menu-icon">
|
||||
<Items>
|
||||
<DxMenuItem NavigateUrl="sysadmin/logs" Text="Logs" />
|
||||
</Items>
|
||||
</DxMenuItem>
|
||||
|
||||
<DxMenuItem Text="HotelAdmin" IconCssClass="menu-icon-support menu-icon">
|
||||
<Items>
|
||||
<DxMenuItem NavigateUrl="user/hoteladmin" Text="Dashboard" />
|
||||
|
|
@ -184,9 +200,29 @@
|
|||
private bool expandHotelAdminNav = false;
|
||||
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
||||
|
||||
private bool IsDevAdmin;
|
||||
private bool IsSysAdmin;
|
||||
private bool IsDriver;
|
||||
|
||||
private ILogger _logger;
|
||||
|
||||
MenuDisplayMode DisplayMode { get; set; } = MenuDisplayMode.Auto;
|
||||
Orientation Orientation { get; set; } = Orientation.Horizontal;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_logger = new LoggerClient<AdminNavMenu>(LogWriters.ToArray());
|
||||
_logger.Debug($"UserId: {SessionService.User.UserModelDto.Id}");
|
||||
IsDevAdmin = SessionService.IsDevAdmin;
|
||||
_logger.Debug($"UserId: {SessionService.IsDevAdmin}");
|
||||
IsSysAdmin = SessionService.IsSysAdmin;
|
||||
_logger.Debug($"UserId: {SessionService.IsSysAdmin}");
|
||||
IsDriver = SessionService.IsDriver;
|
||||
_logger.Debug($"UserId: {SessionService.IsDriver}");
|
||||
|
||||
base.OnInitialized();
|
||||
}
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
|
|
@ -197,9 +233,22 @@
|
|||
|
||||
}
|
||||
|
||||
private void SignOut()
|
||||
private async Task SignOut()
|
||||
{
|
||||
SecureStorageHandler.ClearAllSecureStorageAsync();
|
||||
bool serverResult;
|
||||
string userDetailsStr = await SecureStorageHandler.GetFromSecureStorageAsync(nameof(Setting.UserBasicDetails));
|
||||
if (!string.IsNullOrEmpty(userDetailsStr))
|
||||
{
|
||||
var userBasicDetail = JsonConvert.DeserializeObject<UserBasicDetails>(userDetailsStr);
|
||||
serverResult = await UserDataService.Logout(userBasicDetail.RefreshToken);
|
||||
}
|
||||
await SecureStorageHandler.ClearAllSecureStorageAsync();
|
||||
var result = await AuthStateProvider.GetAuthenticationStateAsync();
|
||||
|
||||
SessionService.User = null;
|
||||
SessionService.IsAuthenticated = false;
|
||||
NavigationManager.NavigateTo("/");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ builder.Services.AddScoped<ISupplierService, SupplierService>();
|
|||
builder.Services.AddScoped<IUserDataService, UserDataServiceWeb>();
|
||||
builder.Services.AddScoped<ISecureStorageHandler, SecureStorageHandler>();
|
||||
builder.Services.AddBlazoredLocalStorage();
|
||||
builder.Services.AddScoped<ISessionService, SessionServiceWeb>();
|
||||
builder.Services.AddSingleton<ISessionService, SessionServiceWeb>();
|
||||
|
||||
builder.Services.AddSingleton<IComponentUpdateService, ComponentUpdateServiceWeb>();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,5 +10,9 @@ namespace TIAMWebApp.Client.Services
|
|||
public UserSessionModel? User { get; set; }
|
||||
public IPAddress? IPAddress { get; set; }
|
||||
public bool IsAuthenticated { get; set; } = false;
|
||||
public bool HasCompany { get; set; } = false;
|
||||
public bool IsDriver { get; set; } = false;
|
||||
public bool IsDevAdmin { get; set; } = false;
|
||||
public bool IsSysAdmin { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,5 +9,12 @@ namespace TIAMWebApp.Shared.Application.Interfaces
|
|||
public UserSessionModel? User { get; set; }
|
||||
public IPAddress? IPAddress { get; set; }
|
||||
public bool IsAuthenticated { get; set; }
|
||||
|
||||
public bool HasCompany { get; set; }
|
||||
public bool IsDriver { get; set; }
|
||||
|
||||
public bool IsDevAdmin { get; set; }
|
||||
|
||||
public bool IsSysAdmin { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue