@using SteUp.Shared.Core.Dto
@using SteUp.Shared.Core.Interface.LocalDb
@inject IIspezioniService IspezioniService
@PuntoVendita.CodMdep
@PuntoVendita.Descrizione
@if (!Luogo.IsNullOrEmpty())
{
@Luogo
}
@code {
[Parameter] public PuntoVenditaDto PuntoVendita { get; set; } = null!;
[Parameter] public EventCallback OnStarting { get; set; }
// Indirizzo, citta', CAP e provincia su una riga sola con separatore " · ":
// sono metadati, non meritano tre chip che fanno rumore.
private string Luogo => string.Join(" · ", new[]
{
PuntoVendita.Indirizzo,
PuntoVendita.Citta,
string.Join(" ", new[] { PuntoVendita.Cap, PuntoVendita.Provincia }
.Where(x => !x.IsNullOrEmpty()))
}
.Where(x => !x.IsNullOrEmpty()));
private async Task StartInspection()
{
await OnStarting.InvokeAsync();
SteupDataService.InspectionPageState.Ispezione = await IspezioniService.GetOrCreateIspezioneAsync(
PuntoVendita.CodMdep!,
DateTime.Now,
UserSession.User.Username
);
NavigationManager.NavigateTo("/ispezione");
}
}