Navigazione

This commit is contained in:
2026-01-30 15:17:45 +01:00
parent cbfce91270
commit 1443740c4e
4 changed files with 63 additions and 9 deletions

View File

@ -9,7 +9,7 @@
</button>
<a class="navbar-brand align-middle" asp-area="" asp-controller="Home" asp-action="Index">
<img src="~/img/logo-dark.png" alt="Mantovani logo" style="height: 35px;" />
<img src="~/img/logo-dark.png" alt="TecniStamp logo" style="height: 35px;" />
</a>
<div class="position-relative">

View File

@ -0,0 +1,39 @@
@page "/anagrafiche"
@using Microsoft.EntityFrameworkCore
@using TecniStamp.Components.Widget
@using TecniStamp.Domain
@using TecniStamp.Utils
<main role="main">
<div class="container-fluid h-100 mt-10">
<div class="row justify-content-start">
@foreach (var item in TileList)
{
<HomeTile Text="@item.Nome" Icon="@item.Icona" Url="@item.Url" Blank="@item.Blank" />
}
</div>
</div>
</main>
@code {
public List<Sezione> TileList { get; set; } = new();
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
var roleId = await MembershipUtils.GetRoleId(_auth);
var parentSection = await _managerService.SezioneService.RicercaPer(x => x.Nome == "Anagrafiche");
var subSection = (await _managerService.SezioneService.RicercaQueryable(x => x.ParentId == parentSection.Id))
.Select(x => x.Id);
var permissionList = (await _managerService.PermissionService.RicercaQueryable(
x => x.RuoloId == roleId && subSection.Contains(x.Feature.Sezione.Id),
includi: x => x.Include(y => y.Feature).ThenInclude(z => z.Sezione),
ordinamento: x => x.OrderBy(y => y.Feature.Sezione.Ordinamento)));
TileList = permissionList
.Select(x => x.Feature.Sezione).Distinct().ToList();
}
}

View File

@ -7,13 +7,26 @@
@using TecniStamp.Domain
@using TecniStamp.Utils
<div class="card bg-primary-lt position-fixed w-100 rounded-0 shadow-sm" style="top: 58px; left:0; z-index: 100;">
<div class="card-body py-2">
<ol class="breadcrumb breadcrumb-arrows ">
</ol>
</div>
</div>
<main role="main">
<div class="container-fluid h-100 mt-10">
<div class="row justify-content-start">
@foreach (var item in TileList)
{
<HomeTile Text="@item.Feature.Sezione.Nome" Icon="@item.Feature.Sezione.Icona" />
<HomeTile Text="@item.Nome" Icon="@item.Icona" Url="@item.Url" Blank="@item.Blank" />
}
</div>
</div>
</main>
@code {
public List<Permission> TileList { get; set; } = new();
public List<Sezione> TileList { get; set; } = new();
protected override async Task OnInitializedAsync()
{
@ -21,8 +34,10 @@
var roleId = await MembershipUtils.GetRoleId(_auth);
TileList = (await _managerService.PermissionService.RicercaQueryable(
x => x.RuoloId == roleId && x.Feature.Sezione.ParentId == null,
x => x.RuoloId == roleId &&
(x.Feature.Sezione.ParentId == null || x.Feature.Sezione.Parent.ParentId == null),
includi:x => x.Include(y => y.Feature).ThenInclude(z => z.Sezione),
ordinamento:x => x.OrderBy(y => y.Feature.Sezione.Ordinamento))).ToList();
ordinamento:x => x.OrderBy(y => y.Feature.Sezione.Ordinamento)))
.Select(x => x.Feature.Sezione.Parent ?? x.Feature.Sezione).Distinct().ToList();
}
}