27 Commits

Author SHA1 Message Date
74ac06b4c1 Finish v2.2.0(24) 2025-11-17 11:14:44 +01:00
70e68e59fb Finish v2.2.0(24) 2025-11-17 11:14:43 +01:00
032dd78c8c -> v2.2.0 (24) 2025-11-17 11:14:37 +01:00
e4b252f301 Migliorato caricamento clienti 2025-11-17 11:11:05 +01:00
a91e08f162 Aggiunta sync giornaliera delle commesse 2025-11-14 15:59:09 +01:00
3fd5410bf5 Aggiunta versione app a video 2025-11-14 12:40:17 +01:00
e338e7d253 Fix caricamenti in Modal Activity 2025-11-14 09:58:52 +01:00
d982aa9bf5 Finish v2.1.5(23) 2025-11-11 14:51:34 +01:00
39c34e7c7d Finish v2.1.5(23) 2025-11-11 14:51:33 +01:00
1f530bc130 -> v2.1.5 (23) 2025-11-11 14:51:25 +01:00
a4c2eee49d Valorizzato tipoAnag 2025-11-11 13:38:53 +01:00
70a34eef06 Finish v2.1.4(22) 2025-11-11 11:59:28 +01:00
c61ebe348c Finish v2.1.4(22) 2025-11-11 11:59:27 +01:00
e586279c6b -> v2.1.4 (22) 2025-11-11 11:59:22 +01:00
85e227a5cb Fix apple 2025-11-11 11:58:51 +01:00
71ce027fb8 Finish v2.1.4(21) 2025-11-11 11:32:26 +01:00
9318d7bd3f Finish v2.1.4(21) 2025-11-11 11:32:25 +01:00
3ae0a7f7d1 -> v2.1.4 (21) 2025-11-11 11:32:14 +01:00
2879008c20 Fix apple 2025-11-11 11:31:48 +01:00
0dfc0baa28 Finish v2.1.3(20) 2025-11-05 15:22:59 +01:00
b423ce8d16 Finish v2.1.3(20) 2025-11-05 15:22:57 +01:00
514f98a8a7 -> v2.1.3 (20) 2025-11-05 15:22:51 +01:00
a26f1a57cc Aggiunto caricamento file 2025-11-05 15:20:27 +01:00
f4b2e70881 Ripristinata cancellazione documenti 2025-11-05 15:06:34 +01:00
bb0bf1e496 Fix 2025-11-05 11:44:47 +01:00
d0f961b052 Aggiunta forzatura della sinc dopo 7 giorni 2025-11-04 12:06:10 +01:00
8dcd61b697 Finish v2.1.1(18) 2025-11-04 07:32:23 +01:00
16 changed files with 219 additions and 71 deletions

View File

@@ -90,14 +90,22 @@ public class ManageDataService(
public async Task<List<ContactDTO>> GetContact(WhereCondContact? whereCond, DateTime? lastSync)
{
List<AnagClie>? contactList;
List<PtbPros>? prospectList;
whereCond ??= new WhereCondContact();
// Ottengo liste locali
var contactList = await localDb.Get<AnagClie>(x =>
(whereCond.FlagStato != null && x.FlagStato == whereCond.FlagStato) ||
(whereCond.PartIva != null && x.PartIva == whereCond.PartIva) ||
(whereCond.PartIva == null && whereCond.FlagStato == null)
);
var prospectList = await localDb.Get<PtbPros>(x =>
(whereCond.PartIva != null && x.PartIva == whereCond.PartIva) ||
(whereCond.PartIva == null)
);
if (networkService.ConnectionAvailable)
{
var response = new UsersSyncResponseDTO();
var clienti = await integryApiService.RetrieveAnagClie(
new CRMAnagRequestDTO
{
@@ -109,10 +117,6 @@ public class ManageDataService(
}
);
response.AnagClie = clienti.AnagClie;
response.VtbDest = clienti.VtbDest;
response.VtbCliePersRif = clienti.VtbCliePersRif;
var prospect = await integryApiService.RetrieveProspect(
new CRMProspectRequestDTO
{
@@ -122,38 +126,62 @@ public class ManageDataService(
FilterDate = lastSync
}
);
_ = UpdateDbUsers(new UsersSyncResponseDTO
{
AnagClie = clienti.AnagClie,
VtbDest = clienti.VtbDest,
VtbCliePersRif = clienti.VtbCliePersRif,
PtbPros = prospect.PtbPros,
PtbProsRif = prospect.PtbProsRif
});
response.PtbPros = prospect.PtbPros;
response.PtbProsRif = prospect.PtbProsRif;
if (lastSync != null)
{
contactList = MergeLists(
contactList,
clienti.AnagClie,
x => x.CodAnag
);
_ = UpdateDbUsers(response);
contactList = clienti.AnagClie;
prospectList = prospect.PtbPros;
}
else
{
contactList = await localDb.Get<AnagClie>(x =>
(whereCond.FlagStato != null && x.FlagStato.Equals(whereCond.FlagStato)) ||
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
(whereCond.PartIva == null && whereCond.FlagStato == null)
);
prospectList = await localDb.Get<PtbPros>(x =>
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
(whereCond.PartIva == null)
);
prospectList = MergeLists(
prospectList,
prospect.PtbPros,
x => x.CodPpro
);
}
else
{
contactList = clienti.AnagClie;
prospectList = prospect.PtbPros;
}
}
// Mappa i contatti
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
// Mappa i prospects
// Mappa i prospect
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
contactMapper.AddRange(prospectMapper);
return contactMapper;
}
private static List<T>? MergeLists<T, TKey>(List<T>? localList, List<T>? apiList, Func<T, TKey> keySelector)
{
if (localList == null || apiList == null) return null;
var dictionary = localList.ToDictionary(keySelector);
foreach (var apiItem in apiList)
{
var key = keySelector(apiItem);
dictionary[key] = apiItem;
}
return dictionary.Values.ToList();
}
public async Task<ContactDTO?> GetSpecificContact(string codAnag, bool isContact)
{
@@ -240,7 +268,7 @@ public class ManageDataService(
.Distinct().ToList();
IDictionary<string, string?>? distinctUser = null;
if (userListState.AllUsers != null)
{
distinctUser = userListState.AllUsers
@@ -251,7 +279,8 @@ public class ManageDataService(
var returnDto = activities
.Select(activity =>
{
if (activity.CodJcom is "0000" && userSession.ProfileDb != null && userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase))
if (activity.CodJcom is "0000" && userSession.ProfileDb != null &&
userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase))
{
activity.CodJcom = null;
}
@@ -263,8 +292,7 @@ public class ManageDataService(
var minuteBefore = activity.EstimatedTime.Value - activity.AlarmTime.Value;
dto.MinuteBefore = (int)Math.Abs(minuteBefore.TotalMinutes);
dto.NotificationDate = dto.MinuteBefore == 0 ?
activity.EstimatedTime : activity.AlarmTime;
dto.NotificationDate = dto.MinuteBefore == 0 ? activity.EstimatedTime : activity.AlarmTime;
}
if (activity.CodJcom != null)
@@ -281,7 +309,7 @@ public class ManageDataService(
string? ragSoc;
if (distinctUser != null && (distinctUser.TryGetValue(activity.CodAnag, out ragSoc) ||
distinctUser.TryGetValue(activity.CodAnag, out ragSoc)))
distinctUser.TryGetValue(activity.CodAnag, out ragSoc)))
{
dto.Cliente = ragSoc;
}
@@ -343,7 +371,7 @@ public class ManageDataService(
public async Task DeleteProspect(string codPpro)
{
var persRifList = await GetTable<PtbProsRif>(x => x.CodPpro!.Equals(codPpro));
if (!persRifList.IsNullOrEmpty())
{
foreach (var persRif in persRifList)

View File

@@ -0,0 +1,8 @@
using salesbook.Shared.Core.Interface.System;
namespace salesbook.Maui.Core.System;
public class GenericSystemService : IGenericSystemService
{
public string GetCurrentAppVersion() => AppInfo.VersionString;
}

View File

@@ -7,6 +7,7 @@ using MudBlazor.Services;
using MudExtensions.Services;
using salesbook.Maui.Core.RestClient.IntegryApi;
using salesbook.Maui.Core.Services;
using salesbook.Maui.Core.System;
using salesbook.Maui.Core.System.Network;
using salesbook.Maui.Core.System.Notification;
using salesbook.Maui.Core.System.Notification.Push;
@@ -16,6 +17,7 @@ using salesbook.Shared.Core.Dto.PageState;
using salesbook.Shared.Core.Helpers;
using salesbook.Shared.Core.Interface;
using salesbook.Shared.Core.Interface.IntegryApi;
using salesbook.Shared.Core.Interface.System;
using salesbook.Shared.Core.Interface.System.Network;
using salesbook.Shared.Core.Interface.System.Notification;
using salesbook.Shared.Core.Messages.Activity.Copy;
@@ -102,6 +104,7 @@ namespace salesbook.Maui
builder.Services.AddSingleton<IFormFactor, FormFactor>();
builder.Services.AddSingleton<IAttachedService, AttachedService>();
builder.Services.AddSingleton<INetworkService, NetworkService>();
builder.Services.AddSingleton<IGenericSystemService, GenericSystemService>();
builder.Services.AddSingleton<LocalDbService>();
_ = typeof(System.Runtime.InteropServices.SafeHandle);

View File

@@ -51,6 +51,9 @@
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Permette all'app di salvare file o immagini nella tua libreria fotografica se necessario.</string>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Alcune librerie di sistema potrebbero accedere al Bluetooth. Lapp non utilizza direttamente il Bluetooth.</string>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>

View File

@@ -29,8 +29,8 @@
<ApplicationId>it.integry.salesbook</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>2.1.1</ApplicationDisplayVersion>
<ApplicationVersion>18</ApplicationVersion>
<ApplicationDisplayVersion>2.2.0</ApplicationDisplayVersion>
<ApplicationVersion>24</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
@@ -120,6 +120,7 @@
<PublishTrimmed>true</PublishTrimmed>
<PublishAot>true</PublishAot>
<MonoAotMode>Hybrid</MonoAotMode>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<ItemGroup>

View File

@@ -22,13 +22,23 @@
protected override async Task OnInitializedAsync()
{
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;
var syncCodJcom = lastSyncDate.Day != DateTime.Now.Day;
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && syncAllData)
{
var returnPath = System.Web.HttpUtility.UrlEncode("/");
NavigationManager.NavigateTo($"/sync?path={returnPath}");
return;
}
if (syncCodJcom && !syncAllData)
{
var returnPath = System.Web.HttpUtility.UrlEncode("/");
NavigationManager.NavigateTo($"/sync/{DateTime.Today:yyyy-MM-dd}?path={returnPath}");
return;
}
NetworkService.ConnectionAvailable = NetworkService.IsNetworkAvailable();
await LoadNotification();

View File

@@ -1,8 +1,10 @@
@page "/login"
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Core.Interface.System
@using salesbook.Shared.Core.Services
@inject IUserAccountService UserAccountService
@inject AppAuthenticationStateProvider AuthenticationStateProvider
@inject IGenericSystemService GenericSystemService
@if (Spinner)
{
@@ -34,7 +36,7 @@ else
</div>
<div class="my-4 login-footer">
<span>Powered by</span>
<span>@($"v{GenericSystemService.GetCurrentAppVersion()} | Powered by")</span>
<img src="_content/salesbook.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
</div>
</div>

View File

@@ -1,6 +1,7 @@
@page "/PersonalInfo"
@attribute [Authorize]
@using salesbook.Shared.Components.Layout
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Core.Authorization.Enum
@using salesbook.Shared.Core.Interface
@using salesbook.Shared.Core.Interface.System.Network
@@ -16,7 +17,8 @@
<div class="container content pb-safe-area">
<div class="container-primary-info">
<div class="section-primary-info">
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold"
Color="Color.Secondary">
@UtilityString.ExtractInitials(UserSession.User.Fullname)
</MudAvatar>
@@ -24,7 +26,8 @@
<span class="info-nome">@UserSession.User.Fullname</span>
@if (UserSession.User.KeyGroup is not null)
{
<span class="info-section">@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())</span>
<span
class="info-section">@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())</span>
}
</div>
</div>
@@ -85,7 +88,7 @@
FullWidth="true"
StartIcon="@Icons.Material.Outlined.Sync"
Size="Size.Medium"
OnClick="() => UpdateDb()"
OnClick="@(() => UpdateDb())"
Variant="Variant.Outlined">
Sincronizza
</MudButton>
@@ -113,6 +116,8 @@
</MudButton>
</div>
</div>
<AppVersion/>
}
@code {
@@ -149,6 +154,8 @@
private void UpdateDb(bool withData = false)
{
LocalStorage.Remove("last-user-sync");
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;

View File

@@ -1,24 +1,29 @@
@page "/sync"
@page "/sync/{DateFilter}"
@using salesbook.Shared.Components.Layout.Spinner
@using salesbook.Shared.Components.SingleElements
@using salesbook.Shared.Core.Interface
@inject ISyncDbService syncDb
@inject IManageDataService manageData
@inject ISyncDbService SyncDb
@inject IManageDataService ManageData
<SyncSpinner Elements="@Elements"/>
<AppVersion/>
@code {
[Parameter] public string? DateFilter { get; set; }
private Dictionary<string, bool> Elements { get; set; } = new();
private bool _hasStarted = false;
private int _completedCount = 0;
private bool _hasStarted;
private int _completedCount;
protected override void OnInitialized()
{
Elements["Commesse"] = false;
Elements["Impostazioni"] = false;
if (DateFilter is null)
Elements["Impostazioni"] = false;
}
protected override async Task OnAfterRenderAsync(bool firstRender)
@@ -28,9 +33,7 @@
_hasStarted = true;
if (DateFilter is null)
{
await manageData.ClearDb();
}
await ManageData.ClearDb();
await Task.WhenAll(
RunAndTrack(SetCommesse),
@@ -58,7 +61,7 @@
private async Task SetCommesse()
{
await Task.Run(async () => { await syncDb.GetAndSaveCommesse(DateFilter); });
await Task.Run(async () => { await SyncDb.GetAndSaveCommesse(DateFilter); });
Elements["Commesse"] = true;
StateHasChanged();
@@ -66,10 +69,13 @@
private async Task SetSettings()
{
await Task.Run(async () => { await syncDb.GetAndSaveSettings(DateFilter); });
if (DateFilter is null)
{
await Task.Run(async () => { await SyncDb.GetAndSaveSettings(DateFilter); });
Elements["Impostazioni"] = true;
StateHasChanged();
Elements["Impostazioni"] = true;
StateHasChanged();
}
}
}

View File

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

View File

@@ -0,0 +1,6 @@
@using salesbook.Shared.Core.Interface.System
@inject IGenericSystemService GenericSystemService
<div class="app-version">
<span>@($"v{GenericSystemService.GetCurrentAppVersion()}")</span>
</div>

View File

@@ -0,0 +1,11 @@
.app-version{
width: 100%;
display: flex;
justify-content: center;
margin: 8px 0;
}
.app-version span{
font-size: smaller;
color: var(--mud-palette-gray-darker);
}

View File

@@ -214,29 +214,38 @@
@if (item.p.Type == AttachedDTO.TypeAttached.Position)
{
<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
</MudChip>
}
else
{
<MudChip T="string" Color="Color.Default" OnClick="() => OpenAttached(item.p)"
OnClose="() => OnRemoveAttached(item.index)">
<MudChip T="string" Color="Color.Default" OnClick="@(() => OpenAttached(item.p))"
OnClose="@(() => OnRemoveAttached(item.index))">
@item.p.Name
</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">
@file.FileName
</MudChip>
foreach (var file in ActivityFileList)
{
<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>
@if (!IsView)
@@ -318,6 +327,7 @@
private List<ActivityFileDto>? ActivityFileList { get; set; }
private bool IsNew { get; set; }
private bool IsLoading { get; set; }
private bool IsView => !NetworkService.ConnectionAvailable;
private string? LabelSave { get; set; }
@@ -443,11 +453,17 @@
{
return Task.Run(async () =>
{
IsLoading = true;
await InvokeAsync(StateHasChanged);
SelectedComessa = ActivityModel.Commessa;
Users = await ManageData.GetTable<StbUser>();
if (!ActivityModel.UserName.IsNullOrEmpty())
{
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
await InvokeAsync(StateHasChanged);
}
if (!IsNew && Id != null)
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
@@ -456,6 +472,7 @@
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
Pros = await ManageData.GetProspect();
IsLoading = false;
await InvokeAsync(StateHasChanged);
});
}
@@ -479,8 +496,8 @@
if (ActivityModel.CodAnag == null)
{
Commesse = await ManageData.GetTable<JtbComt>(x =>
x.CodJcom.Contains(searchValue, StringComparison.OrdinalIgnoreCase) ||
x.Descrizione.Contains(searchValue, StringComparison.OrdinalIgnoreCase)
x.CodJcom.ToUpper().Contains(searchValue.ToUpper()) ||
x.Descrizione.ToUpper().Contains(searchValue.ToUpper())
);
}
else
@@ -544,11 +561,11 @@
var results = new List<string>();
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}"));
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}"));
return Task.FromResult<IEnumerable<string>?>(results);
@@ -564,6 +581,9 @@
{
ActivityModel.CodAnag = parts[0];
ActivityModel.Cliente = parts[1];
var isCliente = Clienti.FirstOrDefault(x => x.CodAnag != null && x.CodAnag.Equals(ActivityModel.CodAnag));
ActivityModel.TipoAnag = isCliente == null ? "P" : "C";
}
OnAfterChangeValue();
@@ -581,6 +601,7 @@
if (com.CodAnag != null)
{
ActivityModel.CodAnag = com.CodAnag;
ActivityModel.TipoAnag = com.TipoAnag;
ActivityModel.Cliente = Clienti
.Where(x => x.CodAnag != null && x.CodAnag.Equals(com.CodAnag))
.Select(x => x.RagSoc)
@@ -593,6 +614,7 @@
{
ActivityModel.CodAnag = null;
ActivityModel.Cliente = null;
ActivityModel.TipoAnag = null;
}
}
else
@@ -601,6 +623,7 @@
ActivityModel.Commessa = null;
ActivityModel.CodAnag = null;
ActivityModel.Cliente = null;
ActivityModel.TipoAnag = null;
}
OnAfterChangeValue();
@@ -775,6 +798,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)
{
if (attached is { Lat: not null, Lng: not null })
@@ -804,7 +854,7 @@
VisibleOverlay = true;
StateHasChanged();
_ = Task.Run(async () =>
{
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(ActivityModel.ActivityTypeId);
@@ -813,7 +863,7 @@
if (modal is { IsCanceled: false, Result: not null })
ActivityModel.ActivityDescription = modal.Result.Data!.ToString();
VisibleOverlay = false;
await InvokeAsync(StateHasChanged);
});

View File

@@ -0,0 +1,6 @@
namespace salesbook.Shared.Core.Interface.System;
public interface IGenericSystemService
{
string GetCurrentAppVersion();
}

View File

@@ -160,7 +160,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
}
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)
{

View File

@@ -1,4 +1,6 @@
using salesbook.Shared.Core.Dto;
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Storage;
using Java.Sql;
using salesbook.Shared.Core.Dto;
using salesbook.Shared.Core.Dto.Contact;
using salesbook.Shared.Core.Dto.PageState;
using salesbook.Shared.Core.Dto.Users;
@@ -6,7 +8,7 @@ using salesbook.Shared.Core.Interface;
namespace salesbook.Shared.Core.Services;
public class PreloadService(IManageDataService manageData, UserListState userState)
public class PreloadService(IManageDataService manageData, ILocalStorage localStorage, UserListState userState)
{
public async Task PreloadUsersAsync()
{
@@ -14,8 +16,11 @@ public class PreloadService(IManageDataService manageData, UserListState userSta
return;
userState.IsLoading = true;
DateTime? lastSync = localStorage.Get<DateTime>("last-user-sync");
lastSync = lastSync.Equals(DateTime.MinValue) ? null : lastSync;
var users = await manageData.GetContact(new WhereCondContact { FlagStato = "A" });
var users = await manageData.GetContact(new WhereCondContact { FlagStato = "A" }, lastSync);
var sorted = users
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
@@ -27,6 +32,8 @@ public class PreloadService(IManageDataService manageData, UserListState userSta
userState.FilteredGroupedUserList = userState.GroupedUserList;
userState.AllUsers = users;
localStorage.Set("last-user-sync", DateTime.Now);
userState.NotifyUsersLoaded();
}