fix grafici + aumento di livello delll'autenticazione

This commit is contained in:
zaccaria.majid
2023-02-20 18:14:41 +01:00
parent 111f47d273
commit 114e7a6ea3
5 changed files with 44 additions and 53 deletions
+9 -9
View File
@@ -12,15 +12,15 @@
<th>
Posizione
</th>
<th>
Riferimento
</th>
<th>
Qta
</th>
<th>
importo
</th>
<th>
Riferimento
</th>
<th>
</th>
@@ -38,24 +38,24 @@
<td>
@flux.LocationId
</td>
<td>
@flux.ExtLocationId
</td>
@if (flux.Qta > 0)
{
<td class="bg-success text-light">
<td class=" text-dark text-end" style="background-color: rgba(39, 174, 96, 0.7)">
@flux.Qta
</td>
}
else
{
<td class="bg-danger text-light">
<td class=" text-dark text-end" style="background-color: rgba(192, 57, 43, 0.7)">
@flux.Qta
</td>
}
<td>
<td class="text-end">
@($"{flux.TotValue:C2}")
</td>
<td>
@flux.ExtLocationId
</td>
<td>
<div class="d-flex justify-content-between">
<div class="d-flex justify-content-between">
+7 -8
View File
@@ -92,14 +92,12 @@
<div>
<div class="bot">
<AuthorizeView>
<i class="fas fa-user-alt"></i> <b>@userName</b>
</AuthorizeView>
@* @if (!isComp)
@if (!isComp)
{
@if (User.Contains("/"))
@if (User.Contains("\\"))
{
<div>
@($"{User.Split("/")[1].Substring(0, 1).ToUpper()}")
@($"{User.Split("\\")[1].Substring(0, 1).ToUpper()}")
</div>
}
else
@@ -114,10 +112,10 @@
}
else
{
@if (User.Contains("/"))
@if (User.Contains("\\"))
{
<div>
@($"{User.Split("/")[1].Substring(0, 1).ToUpper()}")
@($"{User.Split("\\")[1].Substring(0, 1).ToUpper()}")
</div>
}
else
@@ -126,7 +124,8 @@
@($"{User.Substring(0, 1).ToUpper()}")
</div>
}
}*@
}
</AuthorizeView>
</div>
</div>
</div>
+5 -33
View File
@@ -20,6 +20,9 @@ namespace StockMan.CORE.Components
[Parameter]
public string Title { get; set; } = "";
[Parameter]
public string User { get; set; } = "";
#endregion Public Properties
#region Protected Fields
@@ -31,9 +34,7 @@ namespace StockMan.CORE.Components
#region Protected Properties
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
protected int currChildOpen { get; set; } = 0;
[Inject]
@@ -118,36 +119,7 @@ namespace StockMan.CORE.Components
return answ;
}
protected override async Task OnInitializedAsync()
{
await forceReload();
}
#endregion Protected Methods
#region Private Fields
private string userName = "";
#endregion Private Fields
#region Private Methods
private async Task forceReload()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity != null && user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
// cercare in tabella operators e salvare sigla da registrare nei vari records sul DB
}
else
{
userName = "N.A.";
}
}
#endregion Private Methods
}
}
+4 -1
View File
@@ -5,7 +5,10 @@
<div class="page">
<div class="nav" id="navMain">
<NewNavMenu NavMenuLinks="@navMenuLinks" Title="STOCK MAN"></NewNavMenu>
@if (!string.IsNullOrEmpty(userName))
{
<NewNavMenu NavMenuLinks="@navMenuLinks" Title="STOCK MAN" User="@userName"></NewNavMenu>
}
</div>
<main>
+19 -2
View File
@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using StockMan.CORE.Data;
using StockMan.Data.DbModels;
using System.Net;
@@ -13,16 +14,32 @@ namespace StockMan.CORE.Shared
protected List<PermessiModel>? navMenuLinks { get; set; } = null;
protected string userName { get; set; } = "";
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
await forceReload();
navMenuLinks = await SDService.PermessiGetAll();
}
private async Task forceReload()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity != null && user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
// cercare in tabella operators e salvare sigla da registrare nei vari records sul DB
}
else
{
userName = "N.A.";
}
}
#endregion Protected Methods
}
}