Finish v2.1.3(20)

This commit is contained in:
2025-11-05 15:22:57 +01:00
5 changed files with 60 additions and 19 deletions

View File

@@ -29,8 +29,8 @@
<ApplicationId>it.integry.salesbook</ApplicationId> <ApplicationId>it.integry.salesbook</ApplicationId>
<!-- Versions --> <!-- Versions -->
<ApplicationDisplayVersion>2.1.1</ApplicationDisplayVersion> <ApplicationDisplayVersion>2.1.3</ApplicationDisplayVersion>
<ApplicationVersion>18</ApplicationVersion> <ApplicationVersion>20</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'"> <!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">

View File

@@ -22,7 +22,9 @@
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync"); var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && lastSyncDate.Equals(DateTime.MinValue)) var syncAllData = lastSyncDate.Equals(DateTime.MinValue) || (DateTime.Now - lastSyncDate).TotalDays >= 7;
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && syncAllData)
{ {
var returnPath = System.Web.HttpUtility.UrlEncode("/"); var returnPath = System.Web.HttpUtility.UrlEncode("/");
NavigationManager.NavigateTo($"/sync?path={returnPath}"); NavigationManager.NavigateTo($"/sync?path={returnPath}");

View File

@@ -42,7 +42,7 @@
{ {
<SpinnerLayout FullScreen="false"/> <SpinnerLayout FullScreen="false"/>
} }
else if (GroupedUserList.IsNullOrEmpty() || FilteredGroupedUserList.IsNullOrEmpty()) else if (GroupedUserList?.Count > 0)
{ {
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item"> <Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
@if (item.ShowHeader) @if (item.ShowHeader)

View File

@@ -214,29 +214,36 @@
@if (item.p.Type == AttachedDTO.TypeAttached.Position) @if (item.p.Type == AttachedDTO.TypeAttached.Position)
{ {
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success" <MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success"
OnClick="() => OpenPosition(item.p)" OnClose="() => OnRemoveAttached(item.index)"> OnClick="@(() => OpenPosition(item.p))" OnClose="@(() => OnRemoveAttached(item.index))">
@item.p.Description @item.p.Description
</MudChip> </MudChip>
} }
else else
{ {
<MudChip T="string" Color="Color.Default" OnClick="() => OpenAttached(item.p)" <MudChip T="string" Color="Color.Default" OnClick="@(() => OpenAttached(item.p))"
OnClose="() => OnRemoveAttached(item.index)"> OnClose="@(() => OnRemoveAttached(item.index))">
@item.p.Name @item.p.Name
</MudChip> </MudChip>
} }
} }
} }
@if (ActivityFileList != null) @if (!IsLoading)
{ {
foreach (var file in ActivityFileList) if (ActivityFileList != null)
{ {
<MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" Color="Color.Default"> foreach (var file in ActivityFileList)
@file.FileName {
</MudChip> <MudChip T="string" OnClick="@(() => OpenAttached(file.Id, file.FileName))" OnClose="@(() => DeleteAttach(file))" Color="Color.Default">
@file.FileName
</MudChip>
}
} }
} }
else
{
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
}
</div> </div>
@if (!IsView) @if (!IsView)
@@ -318,6 +325,7 @@
private List<ActivityFileDto>? ActivityFileList { get; set; } private List<ActivityFileDto>? ActivityFileList { get; set; }
private bool IsNew { get; set; } private bool IsNew { get; set; }
private bool IsLoading { get; set; }
private bool IsView => !NetworkService.ConnectionAvailable; private bool IsView => !NetworkService.ConnectionAvailable;
private string? LabelSave { get; set; } private string? LabelSave { get; set; }
@@ -443,6 +451,9 @@
{ {
return Task.Run(async () => return Task.Run(async () =>
{ {
IsLoading = true;
await InvokeAsync(StateHasChanged);
SelectedComessa = ActivityModel.Commessa; SelectedComessa = ActivityModel.Commessa;
Users = await ManageData.GetTable<StbUser>(); Users = await ManageData.GetTable<StbUser>();
@@ -456,6 +467,7 @@
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" }); Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
Pros = await ManageData.GetProspect(); Pros = await ManageData.GetProspect();
IsLoading = false;
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
}); });
} }
@@ -479,8 +491,8 @@
if (ActivityModel.CodAnag == null) if (ActivityModel.CodAnag == null)
{ {
Commesse = await ManageData.GetTable<JtbComt>(x => Commesse = await ManageData.GetTable<JtbComt>(x =>
x.CodJcom.Contains(searchValue, StringComparison.OrdinalIgnoreCase) || x.CodJcom.ToUpper().Contains(searchValue.ToUpper()) ||
x.Descrizione.Contains(searchValue, StringComparison.OrdinalIgnoreCase) x.Descrizione.ToUpper().Contains(searchValue.ToUpper())
); );
} }
else else
@@ -544,11 +556,11 @@
var results = new List<string>(); var results = new List<string>();
results.AddRange(Clienti results.AddRange(Clienti
.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)) .Where(x => (x.CodAnag != null && x.CodAnag.Contains(value, StringComparison.OrdinalIgnoreCase)) || x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
.Select(x => $"{x.CodAnag} - {x.RagSoc}")); .Select(x => $"{x.CodAnag} - {x.RagSoc}"));
results.AddRange(Pros results.AddRange(Pros
.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)) .Where(x => (x.CodPpro != null && x.CodPpro.Contains(value, StringComparison.OrdinalIgnoreCase)) || x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
.Select(x => $"{x.CodPpro} - {x.RagSoc}")); .Select(x => $"{x.CodPpro} - {x.RagSoc}"));
return Task.FromResult<IEnumerable<string>?>(results); return Task.FromResult<IEnumerable<string>?>(results);
@@ -775,6 +787,33 @@
} }
} }
private async Task DeleteAttach(ActivityFileDto file)
{
Snackbar.Clear();
if (ActivityFileList == null) return;
try
{
ActivityFileList.Remove(file);
StateHasChanged();
await IntegryApiService.DeleteFile(ActivityModel.ActivityId!, file.FileName);
}
catch (Exception ex)
{
ActivityFileList.Add(file);
StateHasChanged();
Snackbar.Add("Impossibile eliminare il file", Severity.Error);
Console.WriteLine($"Impossibile eliminare il file: {ex.Message}");
}
finally
{
Snackbar.Add($"{file.FileName} eliminato con successo", Severity.Info);
}
}
private void OpenPosition(AttachedDTO attached) private void OpenPosition(AttachedDTO attached)
{ {
if (attached is { Lat: not null, Lng: not null }) if (attached is { Lat: not null, Lng: not null })

View File

@@ -160,7 +160,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
} }
public Task<Stream> DownloadFile(string activityId, string fileName) => public Task<Stream> DownloadFile(string activityId, string fileName) =>
integryApiRestClient.Download($"downloadStbFileAttachment/{activityId}/{fileName}")!; integryApiRestClient.Download($"downloadStbActivityFileAttachment/{activityId}/{fileName}")!;
public Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName) public Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName)
{ {