fix menu
This commit is contained in:
@@ -162,7 +162,7 @@
|
||||
</site>
|
||||
<site name="StockManMVC" id="2">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\samuele.steamw\source\StockMan\StockManMVC" />
|
||||
<virtualDirectory path="/" physicalPath="D:\Repo\StockMan\StockManMVC" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:4539:localhost" />
|
||||
@@ -170,7 +170,7 @@
|
||||
</site>
|
||||
<site name="SiteSelector" id="3">
|
||||
<application path="/" applicationPool="Clr4IntegratedAppPool">
|
||||
<virtualDirectory path="/" physicalPath="C:\Users\samuele.steamw\source\StockMan\SiteSelector" />
|
||||
<virtualDirectory path="/" physicalPath="D:\Repo\StockMan\SiteSelector" />
|
||||
</application>
|
||||
<bindings>
|
||||
<binding protocol="http" bindingInformation="*:3526:localhost" />
|
||||
|
||||
@@ -22,69 +22,20 @@
|
||||
<div class="links">
|
||||
@if (NavMenuLinks != null)
|
||||
{
|
||||
@foreach (var item in NavMenuLinks)
|
||||
@foreach (var item in NavMenuLinks.Where(x => x.NUMERO == 0))
|
||||
{
|
||||
<div>
|
||||
@if (hasChild(item.GRUPPO))
|
||||
{
|
||||
if (item.NUMERO == 0)
|
||||
<div class=" mb-2">
|
||||
<div class="header">
|
||||
<span><i class="@item.DESCRIZIONE"></i> @item.NOME</span>
|
||||
</div>
|
||||
<div class="body">
|
||||
@foreach (var child in NavMenuLinks.Where(x => (x.GRUPPO == item.GRUPPO) && (x.NUMERO > 0)))
|
||||
{
|
||||
@if (!isComp)
|
||||
{
|
||||
<div class="@isActive(item.GRUPPO)" @onclick="()=>doShowChildren(item.GRUPPO)">
|
||||
<i class="@item.DESCRIZIONE"></i>
|
||||
<h6>@item.NOME</h6>
|
||||
@if (item.GRUPPO == currChildOpen)
|
||||
{
|
||||
<i class="fa-solid fa-chevron-up"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="fa-solid fa-chevron-down"></i>
|
||||
}
|
||||
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="navLinkItemComp">
|
||||
<i class="@item.DESCRIZIONE"></i>
|
||||
</div>
|
||||
}
|
||||
<a href="@child.URL" class="text-dark text-decoration-none"><div class="py-1" style="@isActive(child.URL)">@child.NOME</div></a>
|
||||
}
|
||||
<div>
|
||||
<div class="linkChildren" id="@item.GRUPPO">
|
||||
@if (!isComp)
|
||||
{
|
||||
@foreach (var link in NavMenuLinksChild)
|
||||
{
|
||||
<div class="text-center p-1 linkChildItem">
|
||||
<a class="navLinkChildrenText" href="@link.URL">@link.NOME</a>
|
||||
</div>
|
||||
}
|
||||
<div class="chiusura">
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a href="@item.URL" style="text-decoration: none; color: #000;">
|
||||
<div class="navLinkItem">
|
||||
@if (!isComp)
|
||||
{
|
||||
<i class="@item.DESCRIZIONE"></i>
|
||||
<h6>@item.NOME</h6>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="@item.DESCRIZIONE"></i>
|
||||
}
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -92,39 +43,39 @@
|
||||
<div>
|
||||
<div class="bot">
|
||||
<AuthorizeView>
|
||||
@if (!isComp)
|
||||
{
|
||||
@if (User.Contains("\\"))
|
||||
@if (!isComp)
|
||||
{
|
||||
<div>
|
||||
@($"{User.Split("\\")[1].Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
@if (User.Contains("\\"))
|
||||
{
|
||||
<div>
|
||||
@($"{User.Split("\\")[1].Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
@($"{User.Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
}
|
||||
<h6>
|
||||
@User
|
||||
</h6>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
@($"{User.Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
@if (User.Contains("\\"))
|
||||
{
|
||||
<div>
|
||||
@($"{User.Split("\\")[1].Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
@($"{User.Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<h6>
|
||||
@User
|
||||
</h6>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (User.Contains("\\"))
|
||||
{
|
||||
<div>
|
||||
@($"{User.Split("\\")[1].Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
@($"{User.Substring(0, 1).ToUpper()}")
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace StockMan.CORE.Components
|
||||
[Parameter]
|
||||
public List<PermessiModel>? NavMenuLinks { get; set; } = null;
|
||||
|
||||
public List<PermessiModel> NavMenuLinksChild { get; set; } = new List<PermessiModel>();
|
||||
|
||||
[Parameter]
|
||||
public string Theme { get; set; } = "";
|
||||
@@ -22,6 +21,8 @@ namespace StockMan.CORE.Components
|
||||
[Parameter]
|
||||
public string User { get; set; } = "";
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager navManager { get; set; } = null!;
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Fields
|
||||
@@ -33,7 +34,8 @@ namespace StockMan.CORE.Components
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected int currChildOpen { get; set; } = 0;
|
||||
protected int currChildOpenGroup { get; set; } = 0;
|
||||
protected int currChildOpenNumber { get; set; } = 0;
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; } = null!;
|
||||
@@ -55,64 +57,12 @@ namespace StockMan.CORE.Components
|
||||
isComp = false;
|
||||
}
|
||||
|
||||
protected void doShowChildren(int id)
|
||||
protected string isActive(string URLPage)
|
||||
{
|
||||
if (currChildOpen != 0)
|
||||
string answ = "background-color: rgba(255,255,255,0.5)";
|
||||
if (navManager.Uri.Contains(URLPage))
|
||||
{
|
||||
JSRuntime.InvokeVoidAsync("doHideChildren", currChildOpen);
|
||||
}
|
||||
else
|
||||
{
|
||||
currChildOpen = id;
|
||||
}
|
||||
isChildOpen = !isChildOpen;
|
||||
|
||||
NavMenuLinksChild.Clear();
|
||||
if (NavMenuLinks != null)
|
||||
{
|
||||
var lista = NavMenuLinks.Where(x => x.GRUPPO == id).ToList();
|
||||
if (lista.Count != 1)
|
||||
{
|
||||
foreach (var item in lista)
|
||||
{
|
||||
if (item.NUMERO != 0)
|
||||
{
|
||||
NavMenuLinksChild.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isChildOpen)
|
||||
{
|
||||
JSRuntime.InvokeVoidAsync("doShowChildren", id);
|
||||
}
|
||||
else
|
||||
{
|
||||
JSRuntime.InvokeVoidAsync("doHideChildren", id);
|
||||
currChildOpen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool hasChild(int group)
|
||||
{
|
||||
bool hasIt = false;
|
||||
if (NavMenuLinks != null)
|
||||
{
|
||||
var lista = NavMenuLinks.Where(x => x.GRUPPO == group).ToList();
|
||||
if (lista.Count != 1)
|
||||
{
|
||||
hasIt = true;
|
||||
}
|
||||
}
|
||||
return hasIt;
|
||||
}
|
||||
|
||||
protected string isActive(int gruppo)
|
||||
{
|
||||
string answ = "navLinkItem";
|
||||
if (gruppo == currChildOpen)
|
||||
{
|
||||
answ = "navLinkItemActive";
|
||||
answ = "background-color: rgb(77, 182, 172); color: #fff";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.navMenu {
|
||||
background-color: #FF0000;
|
||||
padding: 1rem;
|
||||
padding: 0.7rem;
|
||||
width: 18rem;
|
||||
height: 100%;
|
||||
position: sticky;
|
||||
@@ -99,11 +99,8 @@
|
||||
transition: background-color 200ms ease-out 100ms;
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
.linkChildItem:hover {
|
||||
background-color: #f6faff;
|
||||
}
|
||||
.linkChildItem:hover a {
|
||||
color: #000;
|
||||
.body a div:hover {
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.navLinkItem {
|
||||
text-decoration: none;
|
||||
@@ -125,52 +122,16 @@
|
||||
justify-content: space-between;
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
.navLinkItemActive {
|
||||
text-decoration: none;
|
||||
padding: 0.5rem 1rem 0.5rem 1rem;
|
||||
transition: background-color 300ms ease-out 100ms;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
border-radius: 1rem 1rem 0 0;
|
||||
background-color: #f6faff;
|
||||
justify-content: space-between;
|
||||
.header {
|
||||
padding: 0.8rem 0 0.8rem 0;
|
||||
border-radius: 0.6rem 0.6rem 0 0;
|
||||
background-color: #ffffff;
|
||||
color: #000;
|
||||
}
|
||||
.navLinkItem:hover {
|
||||
background-color: rgba(246, 250, 255, 0.5);
|
||||
.body {
|
||||
background-color: rgba(255, 255, 255, 0.5);
|
||||
color: #000;
|
||||
}
|
||||
.navLinkItemComp:hover {
|
||||
background-color: rgba(246, 250, 255, 0.5);
|
||||
.body a div {
|
||||
color: #000;
|
||||
}
|
||||
.navLinkChildrenText {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
}
|
||||
.navLinkItem i,
|
||||
.navLinkItemActive i {
|
||||
width: 25%;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
flex-wrap: wrap;
|
||||
font-size: 1rem;
|
||||
}
|
||||
.navLinkItem h6,
|
||||
.navLinkItemActive h6 {
|
||||
width: 75%;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
font-weight: bold;
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
.chiusura {
|
||||
width: 100%;
|
||||
height: 0.5rem;
|
||||
background-color: rgba(179, 157, 219, 0.2);
|
||||
border-radius: 0 0 0.5rem 0.5rem;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
.navMenu {
|
||||
background-color: #FF0000;
|
||||
//margin: 0.8rem 0.4rem 0.8rem 0.8rem;
|
||||
padding: 1rem;
|
||||
padding: 0.7rem;
|
||||
width: 18rem;
|
||||
height: 100%;
|
||||
position: sticky;
|
||||
@@ -26,6 +26,7 @@
|
||||
transition: 1s;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.titleComp {
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
@@ -124,12 +125,8 @@
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.linkChildItem:hover {
|
||||
background-color: rgb(246,250,255);
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
}
|
||||
.body a div:hover {
|
||||
background-color: rgb(255,255,255);
|
||||
}
|
||||
|
||||
|
||||
@@ -155,56 +152,19 @@
|
||||
margin-top: 0.2rem;
|
||||
}
|
||||
|
||||
.navLinkItemActive {
|
||||
text-decoration: none;
|
||||
padding: 0.5rem 1rem 0.5rem 1rem;
|
||||
transition: background-color 300ms ease-out 100ms;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
border-radius: 1rem 1rem 0 0;
|
||||
background-color: rgb(246,250,255);
|
||||
justify-content: space-between;
|
||||
|
||||
.header {
|
||||
padding: 0.8rem 0 0.8rem 0;
|
||||
border-radius: 0.6rem 0.6rem 0 0;
|
||||
background-color: rgb(255,255,255);
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.navLinkItem:hover {
|
||||
background-color: rgba(246,250,255,0.5);
|
||||
color: #000;
|
||||
}
|
||||
.navLinkItemComp:hover {
|
||||
background-color: rgba(246,250,255,0.5);
|
||||
.body {
|
||||
background-color: rgba(255,255,255,0.5);
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.navLinkChildrenText {
|
||||
text-decoration: none;
|
||||
color: #fff;
|
||||
.body a div {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.navLinkItem i, .navLinkItemActive i {
|
||||
width: 25%;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
flex-wrap: wrap;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.navLinkItem h6, .navLinkItemActive h6 {
|
||||
width: 75%;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
font-weight: bold;
|
||||
padding-top: 0.5rem;
|
||||
}
|
||||
|
||||
|
||||
.chiusura {
|
||||
width: 100%;
|
||||
height: 0.5rem;
|
||||
background-color: rgba(179, 157, 219, 0.2);
|
||||
border-radius: 0 0 0.5rem 0.5rem;
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
.navMenu{background-color:#f00;padding:1rem;width:18rem;height:100%;position:sticky;background-color:#3547d3;box-shadow:3px 3px 10px 0 #d1d1d1;color:#fff;}#myBtn{transition:.25s;border:0;background:none;padding:0;}.title{text-align:center;display:flex;justify-content:space-between;transition:1s;margin-bottom:1rem;}.titleComp{margin-bottom:1rem;}.icon{margin-top:.5rem;padding:.8rem;background-color:#d9d9d9;border-radius:50%;}.title h4{margin-top:.7rem;}.links{align-content:center;text-align:center;display:grid;height:100%;}.decoration{text-decoration:none;}.bot{position:absolute;bottom:0;left:0;background-color:#f6faff;width:100%;display:flex;justify-content:space-evenly;align-content:center;flex-wrap:wrap;color:#000;}.bot div{display:flex;justify-content:space-evenly;align-content:center;flex-wrap:wrap;}.bot h6{padding-top:2rem;color:#000;}.bot div{background-color:rgba(52,73,94,.5);height:3rem;width:3rem;margin:1rem;display:flex;justify-content:space-evenly;align-content:center;flex-wrap:wrap;font-size:1.5rem;}.navLinkIcon{padding:0;margin:0;}.navLinkIcon,.navLinkText{width:50%;transition:.25s;}.linkChildren{align-content:start;display:none;height:0%;transition:1s;}.linkChildItem{background-color:rgba(179,157,219,.2);transition:background-color 200ms ease-out 100ms;}.last{background-color:rgba(179,157,219,.2);transition:background-color 200ms ease-out 100ms;border-radius:.5rem;}.linkChildItem:hover{background-color:#f6faff;}.linkChildItem:hover a{color:#000;}.navLinkItem{text-decoration:none;padding:.5rem 1rem .5rem 1rem;border-radius:1rem;transition:background-color 300ms ease-out 100ms;display:flex;width:100%;justify-content:space-between;margin-top:.2rem;}.navLinkItemComp{text-decoration:none;padding:.5rem 1rem .5rem 1rem;border-radius:1rem;transition:background-color 300ms ease-out 100ms;display:flex;width:100%;justify-content:space-between;margin-top:.2rem;}.navLinkItemActive{text-decoration:none;padding:.5rem 1rem .5rem 1rem;transition:background-color 300ms ease-out 100ms;display:flex;width:100%;border-radius:1rem 1rem 0 0;background-color:#f6faff;justify-content:space-between;color:#000;}.navLinkItem:hover{background-color:rgba(246,250,255,.5);color:#000;}.navLinkItemComp:hover{background-color:rgba(246,250,255,.5);color:#000;}.navLinkChildrenText{text-decoration:none;color:#fff;}.navLinkItem i,.navLinkItemActive i{width:25%;text-align:center;display:flex;justify-content:center;align-content:center;flex-wrap:wrap;font-size:1rem;}.navLinkItem h6,.navLinkItemActive h6{width:75%;text-align:center;display:flex;flex-wrap:wrap;align-content:center;font-weight:bold;padding-top:.5rem;}.chiusura{width:100%;height:.5rem;background-color:rgba(179,157,219,.2);border-radius:0 0 .5rem .5rem;}
|
||||
.navMenu{background-color:#f00;padding:.7rem;width:18rem;height:100%;position:sticky;background-color:#3547d3;box-shadow:3px 3px 10px 0 #d1d1d1;color:#fff;}#myBtn{transition:.25s;border:0;background:none;padding:0;}.title{text-align:center;display:flex;justify-content:space-between;transition:1s;margin-bottom:1rem;}.titleComp{margin-bottom:1rem;}.icon{margin-top:.5rem;padding:.8rem;background-color:#d9d9d9;border-radius:50%;}.title h4{margin-top:.7rem;}.links{align-content:center;text-align:center;display:grid;height:100%;}.decoration{text-decoration:none;}.bot{position:absolute;bottom:0;left:0;background-color:#f6faff;width:100%;display:flex;justify-content:space-evenly;align-content:center;flex-wrap:wrap;color:#000;}.bot div{display:flex;justify-content:space-evenly;align-content:center;flex-wrap:wrap;}.bot h6{padding-top:2rem;color:#000;}.bot div{background-color:rgba(52,73,94,.5);height:3rem;width:3rem;margin:1rem;display:flex;justify-content:space-evenly;align-content:center;flex-wrap:wrap;font-size:1.5rem;}.navLinkIcon{padding:0;margin:0;}.navLinkIcon,.navLinkText{width:50%;transition:.25s;}.linkChildren{align-content:start;display:none;height:0%;transition:1s;}.linkChildItem{background-color:rgba(179,157,219,.2);transition:background-color 200ms ease-out 100ms;}.last{background-color:rgba(179,157,219,.2);transition:background-color 200ms ease-out 100ms;border-radius:.5rem;}.body a div:hover{background-color:#fff;}.navLinkItem{text-decoration:none;padding:.5rem 1rem .5rem 1rem;border-radius:1rem;transition:background-color 300ms ease-out 100ms;display:flex;width:100%;justify-content:space-between;margin-top:.2rem;}.navLinkItemComp{text-decoration:none;padding:.5rem 1rem .5rem 1rem;border-radius:1rem;transition:background-color 300ms ease-out 100ms;display:flex;width:100%;justify-content:space-between;margin-top:.2rem;}.header{padding:.8rem 0 .8rem 0;border-radius:.6rem .6rem 0 0;background-color:#fff;color:#000;}.body{background-color:rgba(255,255,255,.5);color:#000;}.body a div{color:#000;}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
using StockMan.CORE.Data;
|
||||
using StockMan.Data.DbModels;
|
||||
using System.Net;
|
||||
@@ -30,6 +31,8 @@ namespace StockMan.CORE.Shared
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; } = null!;
|
||||
[Inject]
|
||||
protected MessageService MService { get; set; } = null!;
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; } = null!;
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
@@ -37,6 +40,7 @@ namespace StockMan.CORE.Shared
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await forceReload();
|
||||
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
|
||||
navMenuLinks = await SDService.PermessiGetAll();
|
||||
MService.EA_UserName += OnNewUserName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user