@using SteUp.Shared.Core.Dto @using SteUp.Shared.Core.Entities
@if (CompactView) { if (OnLoading) { } else { @PuntoVendita.CodMdep - @PuntoVendita.Descrizione } } else { if (OnLoading) { } else { @PuntoVendita.CodMdep - @PuntoVendita.Descrizione @PuntoVendita.Indirizzo } }
Data ispezione @if (OnLoading) { } else { @Ispezione.Data.ToString("d") }
Stato ispezione @if (OnLoading) { } else { @Ispezione.Stato.ConvertToHumanReadable() }
@code { [Parameter] public Ispezione Ispezione { get; set; } = new(); [Parameter] public bool CompactView { get; set; } [Parameter] public EventCallback OnClick { get; set; } private PuntoVenditaDto PuntoVendita { get; set; } = new(); private bool OnLoading { get; set; } = true; protected override async Task OnParametersSetAsync() { OnLoading = true; StateHasChanged(); var puntoVendita = SteupDataService.PuntiVenditaList.Find(x => x.CodMdep != null && x.CodMdep.EqualsIgnoreCase(Ispezione.CodMdep) ); await Task.Delay(750); PuntoVendita = puntoVendita ?? throw new Exception("Punto vendita non trovato"); OnLoading = false; StateHasChanged(); } private Task OnCardClick() => OnClick.HasDelegate ? OnClick.InvokeAsync(Ispezione) : Task.CompletedTask; }