Gestite schede nella pagina ispezione e migliorie grafiche
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user