@using salesbook.Shared.Core.Dto @using salesbook.Shared.Core.Entity @using salesbook.Shared.Core.Interface @inject IManageDataService ManageData
@User.RagSoc
@if (ShowSectionCommesse && IsLoading) { } else { @if (!Commesse.IsNullOrEmpty()) {
@for (var i = 0; i < Commesse!.Count; i++) { var commessa = Commesse[i];
@if (i > 5 && Commesse.Count - i > 1) { @($"E altre {Commesse.Count - i} commesse") } else { @($"{commessa.CodJcom} - {commessa.Descrizione}") }
@if (i > 5 && Commesse.Count - i > 1) break; }
} else {
Nessuna commessa presente
} }
@code { [Parameter] public ContactDTO User { get; set; } = new(); private List? Commesse { get; set; } private bool IsLoading { get; set; } = true; private bool ShowSectionCommesse { get; set; } private void OpenUser() => NavigationManager.NavigateTo($"/User/{User.CodContact}/{User.IsContact}"); private async Task ShowCommesse() { ShowSectionCommesse = !ShowSectionCommesse; if (ShowSectionCommesse) { Commesse = (await ManageData.GetTable(x => x.CodAnag.Equals(User.CodContact))) .OrderByDescending(x => x.CodJcom).ToList(); IsLoading = false; StateHasChanged(); return; } IsLoading = true; } }