88 lines
3.5 KiB
Plaintext
88 lines
3.5 KiB
Plaintext
@using salesbook.Shared.Core.Dto
|
|
@using salesbook.Shared.Core.Entity
|
|
@using salesbook.Shared.Core.Interface
|
|
@inject IManageDataService ManageData
|
|
|
|
<div class="user-card-card">
|
|
<div class="user-card-left-section">
|
|
<div class="user-card-body-section">
|
|
<div class="title-section">
|
|
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@(User.IsContact? Icons.Material.Filled.Person : Icons.Material.Filled.PersonOutline)" Size="Size.Large" />
|
|
|
|
<div class="user-card-right-section">
|
|
<div class="user-card-title">
|
|
<MudText Typo="Typo.body1" @onclick="OpenUser" HtmlTag="h3">@User.RagSoc</MudText>
|
|
<MudIcon @onclick="ShowCommesse" Color="Color.Info" Icon="@Icons.Material.Outlined.Info" Size="Size.Medium"/>
|
|
</div>
|
|
|
|
<div class="user-card-subtitle @(ShowSectionCommesse ? "show" : "")">
|
|
@if (ShowSectionCommesse && IsLoading)
|
|
{
|
|
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
|
|
}
|
|
else
|
|
{
|
|
@if (!Commesse.IsNullOrEmpty())
|
|
{
|
|
<div @onclick="OpenUser" class="container-commesse">
|
|
|
|
@for (var i = 0; i < Commesse!.Count; i++)
|
|
{
|
|
var commessa = Commesse[i];
|
|
|
|
<div class="commessa">
|
|
@if (i > 5 && Commesse.Count - i > 1)
|
|
{
|
|
<span>@($"E altre {Commesse.Count - i} commesse")</span>
|
|
}
|
|
else
|
|
{
|
|
<span>@($"{commessa.CodJcom} - {commessa.Descrizione}")</span>
|
|
}
|
|
</div>
|
|
|
|
@if (i > 5 && Commesse.Count - i > 1) break;
|
|
}
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
<div class="commessa">
|
|
<span>Nessuna commessa presente</span>
|
|
</div>
|
|
}
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter] public ContactDTO User { get; set; } = new();
|
|
|
|
private List<JtbComt>? 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<JtbComt>(x => x.CodAnag.Equals(User.CodContact)))
|
|
.OrderByDescending(x => x.CodJcom).ToList();
|
|
IsLoading = false;
|
|
StateHasChanged();
|
|
return;
|
|
}
|
|
|
|
IsLoading = true;
|
|
}
|
|
|
|
} |