Completata gestione allegati e riepilogo commessa

This commit is contained in:
2025-09-01 17:38:16 +02:00
parent 588dbe308a
commit 8be3fa9f9e
17 changed files with 341 additions and 60 deletions

View File

@@ -1,15 +1,19 @@
@page "/commessa/{CodJcom}"
@page "/commessa/{CodJcom}/{RagSoc}"
@attribute [Authorize]
@using AutoMapper
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Core.Dto
@using salesbook.Shared.Core.Dto.JobProgress
@using salesbook.Shared.Core.Dto.PageState
@using salesbook.Shared.Core.Entity
@using salesbook.Shared.Core.Interface
@inject JobSteps JobSteps
@inject IManageDataService ManageData
@inject IIntegryApiService IntegryApiService
@inject IMapper Mapper
<HeaderLayout Title="@CodJcom" ShowProfile="false" Back="true" BackTo="Indietro"/>
@@ -62,8 +66,48 @@ else
</div>
}
</div>
<div class="tab-content">Contenuto 2</div>
<div class="tab-content">Contenuto 3</div>
<div class="tab-content">
@if (ActivityIsLoading)
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
}
else
{
@if (ActivityList is { Count: > 0 })
{
<div class="contentFlex">
<Virtualize Items="ActivityList" Context="activity">
<ActivityCard Activity="activity" />
</Virtualize>
</div>
}
else
{
<NoDataAvailable Text="Nessuna attività trovata" />
}
}
</div>
<div class="tab-content">
@if (AttachedIsLoading)
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
}
else
{
@if (ListAttached != null)
{
<div class="contentFlex">
<Virtualize Items="ListAttached" Context="attached">
<AttachCard Attached="attached" />
</Virtualize>
</div>
}
else
{
<NoDataAvailable Text="Nessun allegato presente" />
}
}
</div>
</div>
}
</div>
@@ -74,9 +118,13 @@ else
[Parameter] public string RagSoc { get; set; } = "";
private List<CRMJobStepDTO>? Steps { get; set; }
private List<ActivityDTO> ActivityList { get; set; } = [];
private List<CRMAttachedResponseDTO>? ListAttached { get; set; }
private JtbComt? CommessaModel { get; set; }
private bool IsLoading { get; set; } = true;
private bool ActivityIsLoading { get; set; } = true;
private bool AttachedIsLoading { get; set; } = true;
protected override async Task OnInitializedAsync()
{
@@ -88,8 +136,34 @@ else
CommessaModel = (await ManageData.GetTable<JtbComt>(x => x.CodJcom.Equals(CodJcom))).LastOrDefault();
Steps = JobSteps.Steps;
_ = LoadActivity();
_ = LoadAttached();
IsLoading = false;
}
private async Task LoadActivity()
{
await Task.Run(async () =>
{
var activities = await IntegryApiService.RetrieveActivity(new CRMRetrieveActivityRequestDTO { CodJcom = CodJcom });
ActivityList = Mapper.Map<List<ActivityDTO>>(activities);
});
ActivityIsLoading = false;
StateHasChanged();
}
private async Task LoadAttached()
{
await Task.Run(async () =>
{
ListAttached = await IntegryApiService.RetrieveAttached(CodJcom);
});
AttachedIsLoading = false;
StateHasChanged();
}
}

View File

@@ -198,6 +198,21 @@
padding: .5rem;
}
.contentFlex {
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.tab-content::-webkit-scrollbar { width: 6px; }
.tab-content::-webkit-scrollbar-thumb {
background: #bbb;
border-radius: 3px;
}
.contentFlex ::deep > div:first-child:not(.activity-card) { display: none; }
#tab1:checked ~ .tab-container .tab-content:nth-child(1),
#tab2:checked ~ .tab-container .tab-content:nth-child(2),
#tab3:checked ~ .tab-container .tab-content:nth-child(3) { display: block; }