Sistemati caricamenti

This commit is contained in:
2025-09-18 15:47:20 +02:00
parent 4645b2660e
commit c61093a942
5 changed files with 100 additions and 62 deletions

View File

@@ -232,7 +232,7 @@ public class ManageDataService(
return await MapActivity(activities);
}
private async Task<List<ActivityDTO>> MapActivity(List<StbActivity>? activities)
public async Task<List<ActivityDTO>> MapActivity(List<StbActivity>? activities)
{
if (activities == null) return [];
@@ -291,7 +291,7 @@ public class ManageDataService(
}
}
dto.Commessa = jtbComtList.LastOrDefault();
dto.Commessa = jtbComtList.Find(x => x.CodJcom.Equals(dto.CodJcom));
return dto;
})
.ToList();

View File

@@ -149,8 +149,7 @@ else
await Task.Run(async () =>
{
var activities = await IntegryApiService.RetrieveActivity(new CRMRetrieveActivityRequestDTO { CodJcom = CodJcom });
ActivityList = Mapper.Map<List<ActivityDTO>>(activities)
.OrderBy(x =>
ActivityList = (await ManageData.MapActivity(activities)).OrderByDescending(x =>
(x.EffectiveTime ?? x.EstimatedTime) ?? x.DataInsAct
).ToList();
});

View File

@@ -527,8 +527,7 @@ else
await Task.Run(async () =>
{
var activities = await IntegryApiService.RetrieveActivity(new CRMRetrieveActivityRequestDTO { CodAnag = Anag.CodContact });
ActivityList = Mapper.Map<List<ActivityDTO>>(activities)
.OrderByDescending(x =>
ActivityList = (await ManageData.MapActivity(activities)).OrderByDescending(x =>
(x.EffectiveTime ?? x.EstimatedTime) ?? x.DataInsAct
).ToList();
});
@@ -794,4 +793,5 @@ else
}
#endregion
}

View File

@@ -39,6 +39,12 @@
<div class="form-container">
<span class="disable-full-width">Commessa</span>
@if (ActivityModel.CodJcom != null && SelectedComessa == null)
{
<MudSkeleton />
}
else
{
<MudAutocomplete
Disabled="ActivityModel.Cliente.IsNullOrEmpty()"
T="JtbComt?" ReadOnly="IsView"
@@ -47,10 +53,12 @@
SearchFunc="SearchCommesseAsync"
ToStringFunc="@(c => c == null ? string.Empty : $"{c.CodJcom} - {c.Descrizione}")"
Clearable="true"
OnClearButtonClick="OnCommessaClear"
ShowProgressIndicator="true"
DebounceInterval="300"
MaxItems="50"
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code"/>
}
</div>
</div>
@@ -90,6 +98,12 @@
<div class="form-container">
<span class="disable-full-width">Assegnata a</span>
@if (ActivityModel.UserName != null && SelectedUser == null)
{
<MudSkeleton />
}
else
{
<MudAutocomplete
Disabled="Users.IsNullOrEmpty()" ReadOnly="IsView"
T="StbUser"
@@ -98,11 +112,13 @@
SearchFunc="SearchUtentiAsync"
ToStringFunc="@(u => u == null ? string.Empty : u.FullName)"
Clearable="true"
OnClearButtonClick="OnUserClear"
ShowProgressIndicator="true"
DebounceInterval="300"
MaxItems="50"
Class="customIcon-select"
AdornmentIcon="@Icons.Material.Filled.Code"/>
}
</div>
<div class="divider"></div>
@@ -110,12 +126,19 @@
<div class="form-container">
<span class="disable-full-width">Tipo</span>
@if (ActivityType.IsNullOrEmpty())
{
<MudSkeleton />
}
else
{
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityTypeId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
@foreach (var type in ActivityType)
{
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
}
</MudSelectExtended>
}
</div>
<div class="divider"></div>
@@ -370,14 +393,14 @@
{
return Task.Run(async () =>
{
if (!IsNew && Id != null)
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
SelectedComessa = ActivityModel.Commessa;
Users = await ManageData.GetTable<StbUser>();
if (!ActivityModel.UserName.IsNullOrEmpty())
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
SelectedComessa = ActivityModel.Commessa;
if (!IsNew && Id != null)
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
ActivityResult = await ManageData.GetTable<StbActivityResult>();
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
@@ -510,6 +533,20 @@
OnAfterChangeValue();
}
private async Task OnCommessaClear()
{
ActivityModel.Commessa = null;
ActivityModel.CodJcom = null;
StateHasChanged();
}
private async Task OnUserClear()
{
ActivityModel.UserName = null;
ActivityType = [];
StateHasChanged();
}
private void OnAfterChangeTimeBefore()
{
if (ActivityModel.EstimatedTime is not null)

View File

@@ -25,5 +25,7 @@ public interface IManageDataService
Task Delete<T>(T objectToDelete);
Task DeleteActivity(ActivityDTO activity);
Task<List<ActivityDTO>> MapActivity(List<StbActivity>? activities);
Task ClearDb();
}