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

@@ -39,18 +39,26 @@
<div class="form-container">
<span class="disable-full-width">Commessa</span>
<MudAutocomplete
Disabled="ActivityModel.Cliente.IsNullOrEmpty()"
T="JtbComt?" ReadOnly="IsView"
@bind-Value="SelectedComessa"
@bind-Value:after="OnCommessaSelectedAfter"
SearchFunc="SearchCommesseAsync"
ToStringFunc="@(c => c == null ? string.Empty : $"{c.CodJcom} - {c.Descrizione}")"
Clearable="true"
ShowProgressIndicator="true"
DebounceInterval="300"
MaxItems="50"
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code"/>
@if (ActivityModel.CodJcom != null && SelectedComessa == null)
{
<MudSkeleton />
}
else
{
<MudAutocomplete
Disabled="ActivityModel.Cliente.IsNullOrEmpty()"
T="JtbComt?" ReadOnly="IsView"
@bind-Value="SelectedComessa"
@bind-Value:after="OnCommessaSelectedAfter"
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,19 +98,27 @@
<div class="form-container">
<span class="disable-full-width">Assegnata a</span>
<MudAutocomplete
Disabled="Users.IsNullOrEmpty()" ReadOnly="IsView"
T="StbUser"
@bind-Value="SelectedUser"
@bind-Value:after="OnUserSelectedAfter"
SearchFunc="SearchUtentiAsync"
ToStringFunc="@(u => u == null ? string.Empty : u.FullName)"
Clearable="true"
ShowProgressIndicator="true"
DebounceInterval="300"
MaxItems="50"
Class="customIcon-select"
AdornmentIcon="@Icons.Material.Filled.Code"/>
@if (ActivityModel.UserName != null && SelectedUser == null)
{
<MudSkeleton />
}
else
{
<MudAutocomplete
Disabled="Users.IsNullOrEmpty()" ReadOnly="IsView"
T="StbUser"
@bind-Value="SelectedUser"
@bind-Value:after="OnUserSelectedAfter"
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>
<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>
@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)