Gestite schede nella pagina ispezione e migliorie grafiche

This commit is contained in:
2026-02-23 10:12:36 +01:00
parent b39b7ba751
commit efefd3499b
21 changed files with 253 additions and 37 deletions

View File

@@ -1,17 +1,85 @@
@page "/ispezione"
@using SteUp.Shared.Components.Layout
@using SteUp.Shared.Components.SingleElements.Card
@using SteUp.Shared.Core.Dto
@using SteUp.Shared.Core.Entities
@using SteUp.Shared.Core.Interface.LocalDb
@using SteUp.Shared.Core.Messages.Scheda
@inject NewSchedaService NewScheda
@inject IIspezioniService IspezioniService
@implements IDisposable
<HeaderLayout Title="Ispezione" BackTo="Indietro" Back="true"/>
<div class="container content pb-safe-area">
<InspectionCard Ispezione="SteupDataService.InspectionPageState.Ispezione"/>
@if (!SchedeGrouped.IsNullOrEmpty())
{
<MudExpansionPanels MultiExpansion="true">
@foreach (var group in SchedeGrouped)
{
<MudExpansionPanel Expanded="true" Text="@group.Key.Descrizione">
<TitleContent>
<div class="header-scheda-group">
<div class="title">
<MudText Typo="Typo.h6"><b>@group.Key.Descrizione</b></MudText>
<MudChip T="string" Size="Size.Small" Color="Color.Default">
@($"{group.Value.Count} sched{(group.Value.Count == 1 ? "a" : "e")}")
</MudChip>
</div>
<div class="action-scheda-group">
<MudIconButton Variant="Variant.Filled" Icon="@Icons.Material.Rounded.Add" Color="Color.Warning" Size="Size.Medium"/>
</div>
</div>
</TitleContent>
<ChildContent>
@foreach (var scheda in group.Value)
{
<SchedaCard Scheda="scheda"/>
}
</ChildContent>
</MudExpansionPanel>
}
</MudExpansionPanels>
}
</div>
@code {
private Dictionary<JtbFasiDto, List<Scheda>> SchedeGrouped { get; set; } = [];
protected override async Task OnInitializedAsync()
protected override void OnInitialized()
{
NewScheda.OnNewScheda += LoadSchede;
LoadSchede();
}
private void LoadSchede()
{
var ispezione = SteupDataService.InspectionPageState.Ispezione;
InvokeAsync(async () =>
{
var schede = await IspezioniService.GetAllSchedeOfIspezioneAsync(
ispezione.CodMdep, ispezione.Data, ispezione.Rilevatore
);
SchedeGrouped = schede
.Where(s => s.Reparto != null)
.GroupBy(s => s.CodJfas)
.ToDictionary(
g => g.First().Reparto!,
g => g.ToList()
);
StateHasChanged();
});
}
void IDisposable.Dispose()
{
NewScheda.OnNewScheda -= LoadSchede;
}
}