diff --git a/TecniStamp/TecniStamp/Components/App.razor b/TecniStamp/TecniStamp/Components/App.razor index 62f1fc5..21a5641 100644 --- a/TecniStamp/TecniStamp/Components/App.razor +++ b/TecniStamp/TecniStamp/Components/App.razor @@ -3,7 +3,7 @@ - + diff --git a/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor b/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor index d919066..1177e63 100644 --- a/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor +++ b/TecniStamp/TecniStamp/Components/Layout/MainLayout.razor @@ -9,7 +9,7 @@ - Mantovani logo + TecniStamp logo
diff --git a/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/HomeAnagrafiche.razor b/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/HomeAnagrafiche.razor new file mode 100644 index 0000000..d870782 --- /dev/null +++ b/TecniStamp/TecniStamp/Components/Pages/Anagrafiche/HomeAnagrafiche.razor @@ -0,0 +1,39 @@ +@page "/anagrafiche" +@using Microsoft.EntityFrameworkCore +@using TecniStamp.Components.Widget +@using TecniStamp.Domain +@using TecniStamp.Utils + +
+
+
+ @foreach (var item in TileList) + { + + } +
+
+
+ +@code { + + public List 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(); + } + +} \ No newline at end of file diff --git a/TecniStamp/TecniStamp/Components/Pages/Home.razor b/TecniStamp/TecniStamp/Components/Pages/Home.razor index d2b3c0f..5f389c4 100644 --- a/TecniStamp/TecniStamp/Components/Pages/Home.razor +++ b/TecniStamp/TecniStamp/Components/Pages/Home.razor @@ -7,13 +7,26 @@ @using TecniStamp.Domain @using TecniStamp.Utils -@foreach (var item in TileList) -{ - -} +
+
+ +
+
+ +
+
+
+ @foreach (var item in TileList) + { + + } +
+
+
@code { - public List TileList { get; set; } = new(); + public List 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(); } } \ No newline at end of file