Compare commits
17 Commits
39c34e7c7d
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b3841d7b6 | |||
| c8d3ec6eec | |||
| 3218ade202 | |||
| ce86cba86c | |||
| 37d66c90d2 | |||
| 5c1d74e04d | |||
| 394d0ace47 | |||
| 99cd67fd5e | |||
| c336084152 | |||
| 74ac06b4c1 | |||
| 70e68e59fb | |||
| 032dd78c8c | |||
| e4b252f301 | |||
| a91e08f162 | |||
| 3fd5410bf5 | |||
| e338e7d253 | |||
| d982aa9bf5 |
6
salesbook.Maui/Core/Interface/IFilePreviewService.cs
Normal file
6
salesbook.Maui/Core/Interface/IFilePreviewService.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace salesbook.Maui.Core.Interface;
|
||||||
|
|
||||||
|
public interface IFilePreviewService
|
||||||
|
{
|
||||||
|
Task Preview(string fileName, string filePath);
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Maui.Core.Interface;
|
||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
namespace salesbook.Maui.Core.Services;
|
namespace salesbook.Maui.Core.Services;
|
||||||
|
|
||||||
public class AttachedService : IAttachedService
|
public class AttachedService(IFilePreviewService filePreviewService) : IAttachedService
|
||||||
{
|
{
|
||||||
public async Task<AttachedDTO?> SelectImageFromCamera()
|
public async Task<AttachedDTO?> SelectImageFromCamera()
|
||||||
{
|
{
|
||||||
@@ -95,48 +96,34 @@ public class AttachedService : IAttachedService
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async Task<string?> SaveToTempStorage(Stream file, string fileName)
|
public async Task<string> SaveToTempStorage(Stream file, string fileName, CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
var cacheDirectory = FileSystem.CacheDirectory;
|
ArgumentNullException.ThrowIfNull(file);
|
||||||
var targetDirectory = Path.Combine(cacheDirectory, "file");
|
|
||||||
|
|
||||||
if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory);
|
if (file.CanSeek)
|
||||||
|
file.Position = 0;
|
||||||
|
|
||||||
var tempFilePath = Path.Combine(targetDirectory, fileName + ".temp");
|
fileName = Path.GetFileName(fileName);
|
||||||
var filePath = Path.Combine(targetDirectory, fileName);
|
|
||||||
|
|
||||||
if (File.Exists(filePath)) return filePath;
|
var dir = FileSystem.CacheDirectory;
|
||||||
|
var filePath = Path.Combine(dir, fileName);
|
||||||
|
|
||||||
try
|
await using var fileStream = File.Create(filePath);
|
||||||
{
|
await file.CopyToAsync(fileStream, ct);
|
||||||
await using var fileStream =
|
|
||||||
new FileStream(tempFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
|
|
||||||
await file.CopyToAsync(fileStream);
|
|
||||||
|
|
||||||
File.Move(tempFilePath, filePath);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Errore durante il salvataggio dello stream: {e.Message}");
|
|
||||||
SentrySdk.CaptureException(e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
if (File.Exists(tempFilePath)) File.Delete(tempFilePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task OpenFile(Stream file, string fileName)
|
public Task OpenFile(string fileName, string filePath)
|
||||||
{
|
{
|
||||||
var filePath = await SaveToTempStorage(file, fileName);
|
#if IOS
|
||||||
|
return filePreviewService.Preview(fileName, filePath);
|
||||||
if (filePath is null) return;
|
#else
|
||||||
await Launcher.OpenAsync(new OpenFileRequest
|
return Launcher.OpenAsync(new OpenFileRequest
|
||||||
{
|
{
|
||||||
|
Title = "Apri file",
|
||||||
File = new ReadOnlyFile(filePath)
|
File = new ReadOnlyFile(filePath)
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,14 +90,22 @@ public class ManageDataService(
|
|||||||
|
|
||||||
public async Task<List<ContactDTO>> GetContact(WhereCondContact? whereCond, DateTime? lastSync)
|
public async Task<List<ContactDTO>> GetContact(WhereCondContact? whereCond, DateTime? lastSync)
|
||||||
{
|
{
|
||||||
List<AnagClie>? contactList;
|
|
||||||
List<PtbPros>? prospectList;
|
|
||||||
whereCond ??= new WhereCondContact();
|
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)
|
if (networkService.ConnectionAvailable)
|
||||||
{
|
{
|
||||||
var response = new UsersSyncResponseDTO();
|
|
||||||
|
|
||||||
var clienti = await integryApiService.RetrieveAnagClie(
|
var clienti = await integryApiService.RetrieveAnagClie(
|
||||||
new CRMAnagRequestDTO
|
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(
|
var prospect = await integryApiService.RetrieveProspect(
|
||||||
new CRMProspectRequestDTO
|
new CRMProspectRequestDTO
|
||||||
{
|
{
|
||||||
@@ -123,31 +127,54 @@ public class ManageDataService(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
response.PtbPros = prospect.PtbPros;
|
if (lastSync == null)
|
||||||
response.PtbProsRif = prospect.PtbProsRif;
|
{
|
||||||
|
await InsertDbUsers(new UsersSyncResponseDTO
|
||||||
|
{
|
||||||
|
AnagClie = clienti.AnagClie,
|
||||||
|
VtbDest = clienti.VtbDest,
|
||||||
|
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||||
|
PtbPros = prospect.PtbPros,
|
||||||
|
PtbProsRif = prospect.PtbProsRif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
||||||
|
{
|
||||||
|
AnagClie = clienti.AnagClie,
|
||||||
|
VtbDest = clienti.VtbDest,
|
||||||
|
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||||
|
PtbPros = prospect.PtbPros,
|
||||||
|
PtbProsRif = prospect.PtbProsRif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
_ = UpdateDbUsers(response);
|
if (lastSync != null)
|
||||||
|
{
|
||||||
|
contactList = MergeLists(
|
||||||
|
contactList,
|
||||||
|
clienti.AnagClie,
|
||||||
|
x => x.CodAnag
|
||||||
|
);
|
||||||
|
|
||||||
contactList = clienti.AnagClie;
|
prospectList = MergeLists(
|
||||||
prospectList = prospect.PtbPros;
|
prospectList,
|
||||||
}
|
prospect.PtbPros,
|
||||||
else
|
x => x.CodPpro
|
||||||
{
|
);
|
||||||
contactList = await localDb.Get<AnagClie>(x =>
|
}
|
||||||
(whereCond.FlagStato != null && x.FlagStato.Equals(whereCond.FlagStato)) ||
|
else
|
||||||
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
{
|
||||||
(whereCond.PartIva == null && whereCond.FlagStato == null)
|
contactList = clienti.AnagClie;
|
||||||
);
|
prospectList = prospect.PtbPros;
|
||||||
prospectList = await localDb.Get<PtbPros>(x =>
|
}
|
||||||
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
|
||||||
(whereCond.PartIva == null)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mappa i contatti
|
// Mappa i contatti
|
||||||
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
||||||
|
|
||||||
// Mappa i prospects
|
// Mappa i prospect
|
||||||
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
|
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
|
||||||
|
|
||||||
contactMapper.AddRange(prospectMapper);
|
contactMapper.AddRange(prospectMapper);
|
||||||
@@ -155,6 +182,23 @@ public class ManageDataService(
|
|||||||
return contactMapper;
|
return contactMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static List<T>? MergeLists<T, TKey>(List<T>? localList, List<T>? apiList, Func<T, TKey> keySelector)
|
||||||
|
{
|
||||||
|
if (apiList == null && localList != null) return localList;
|
||||||
|
if (apiList != null && localList == null) return apiList;
|
||||||
|
if (apiList == null && localList == 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)
|
public async Task<ContactDTO?> GetSpecificContact(string codAnag, bool isContact)
|
||||||
{
|
{
|
||||||
if (isContact)
|
if (isContact)
|
||||||
@@ -251,7 +295,8 @@ public class ManageDataService(
|
|||||||
var returnDto = activities
|
var returnDto = activities
|
||||||
.Select(activity =>
|
.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;
|
activity.CodJcom = null;
|
||||||
}
|
}
|
||||||
@@ -263,8 +308,7 @@ public class ManageDataService(
|
|||||||
var minuteBefore = activity.EstimatedTime.Value - activity.AlarmTime.Value;
|
var minuteBefore = activity.EstimatedTime.Value - activity.AlarmTime.Value;
|
||||||
dto.MinuteBefore = (int)Math.Abs(minuteBefore.TotalMinutes);
|
dto.MinuteBefore = (int)Math.Abs(minuteBefore.TotalMinutes);
|
||||||
|
|
||||||
dto.NotificationDate = dto.MinuteBefore == 0 ?
|
dto.NotificationDate = dto.MinuteBefore == 0 ? activity.EstimatedTime : activity.AlarmTime;
|
||||||
activity.EstimatedTime : activity.AlarmTime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activity.CodJcom != null)
|
if (activity.CodJcom != null)
|
||||||
@@ -281,7 +325,7 @@ public class ManageDataService(
|
|||||||
string? ragSoc;
|
string? ragSoc;
|
||||||
|
|
||||||
if (distinctUser != null && (distinctUser.TryGetValue(activity.CodAnag, out 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;
|
dto.Cliente = ragSoc;
|
||||||
}
|
}
|
||||||
@@ -295,6 +339,24 @@ public class ManageDataService(
|
|||||||
return returnDto;
|
return returnDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task InsertDbUsers(UsersSyncResponseDTO response)
|
||||||
|
{
|
||||||
|
if (response.AnagClie != null)
|
||||||
|
{
|
||||||
|
await localDb.InsertAll(response.AnagClie);
|
||||||
|
|
||||||
|
if (response.VtbDest != null) await localDb.InsertAll(response.VtbDest);
|
||||||
|
if (response.VtbCliePersRif != null) await localDb.InsertAll(response.VtbCliePersRif);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.PtbPros != null)
|
||||||
|
{
|
||||||
|
await localDb.InsertAll(response.PtbPros);
|
||||||
|
|
||||||
|
if (response.PtbProsRif != null) await localDb.InsertAll(response.PtbProsRif);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Task UpdateDbUsers(UsersSyncResponseDTO response)
|
private Task UpdateDbUsers(UsersSyncResponseDTO response)
|
||||||
{
|
{
|
||||||
return Task.Run(async () =>
|
return Task.Run(async () =>
|
||||||
|
|||||||
8
salesbook.Maui/Core/System/GenericSystemService.cs
Normal file
8
salesbook.Maui/Core/System/GenericSystemService.cs
Normal 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;
|
||||||
|
}
|
||||||
@@ -5,8 +5,11 @@ using Microsoft.AspNetCore.Components.Authorization;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using MudBlazor.Services;
|
using MudBlazor.Services;
|
||||||
using MudExtensions.Services;
|
using MudExtensions.Services;
|
||||||
|
using salesbook.Maui.Core;
|
||||||
|
using salesbook.Maui.Core.Interface;
|
||||||
using salesbook.Maui.Core.RestClient.IntegryApi;
|
using salesbook.Maui.Core.RestClient.IntegryApi;
|
||||||
using salesbook.Maui.Core.Services;
|
using salesbook.Maui.Core.Services;
|
||||||
|
using salesbook.Maui.Core.System;
|
||||||
using salesbook.Maui.Core.System.Network;
|
using salesbook.Maui.Core.System.Network;
|
||||||
using salesbook.Maui.Core.System.Notification;
|
using salesbook.Maui.Core.System.Notification;
|
||||||
using salesbook.Maui.Core.System.Notification.Push;
|
using salesbook.Maui.Core.System.Notification.Push;
|
||||||
@@ -16,6 +19,7 @@ using salesbook.Shared.Core.Dto.PageState;
|
|||||||
using salesbook.Shared.Core.Helpers;
|
using salesbook.Shared.Core.Helpers;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
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.Network;
|
||||||
using salesbook.Shared.Core.Interface.System.Notification;
|
using salesbook.Shared.Core.Interface.System.Notification;
|
||||||
using salesbook.Shared.Core.Messages.Activity.Copy;
|
using salesbook.Shared.Core.Messages.Activity.Copy;
|
||||||
@@ -102,7 +106,9 @@ namespace salesbook.Maui
|
|||||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||||
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
||||||
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
||||||
|
builder.Services.AddSingleton<IGenericSystemService, GenericSystemService>();
|
||||||
builder.Services.AddSingleton<LocalDbService>();
|
builder.Services.AddSingleton<LocalDbService>();
|
||||||
|
builder.Services.AddSingleton<IFilePreviewService, FilePreviewService>();
|
||||||
|
|
||||||
_ = typeof(System.Runtime.InteropServices.SafeHandle);
|
_ = typeof(System.Runtime.InteropServices.SafeHandle);
|
||||||
_ = typeof(System.IO.FileStream);
|
_ = typeof(System.IO.FileStream);
|
||||||
|
|||||||
11
salesbook.Maui/Platforms/Android/Core/FilePreviewService.cs
Normal file
11
salesbook.Maui/Platforms/Android/Core/FilePreviewService.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using salesbook.Maui.Core.Interface;
|
||||||
|
|
||||||
|
namespace salesbook.Maui.Core;
|
||||||
|
|
||||||
|
public class FilePreviewService :IFilePreviewService
|
||||||
|
{
|
||||||
|
public Task Preview(string fileName, string filePath)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
24
salesbook.Maui/Platforms/iOS/Core/FilePreviewService.cs
Normal file
24
salesbook.Maui/Platforms/iOS/Core/FilePreviewService.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using QuickLook;
|
||||||
|
using salesbook.Maui.Core.Interface;
|
||||||
|
using salesbook.Maui.Helpers;
|
||||||
|
using UIKit;
|
||||||
|
|
||||||
|
namespace salesbook.Maui.Core;
|
||||||
|
|
||||||
|
public class FilePreviewService : IFilePreviewService
|
||||||
|
{
|
||||||
|
public Task Preview(string fileName, string filePath)
|
||||||
|
{
|
||||||
|
var currentController = UIApplication.SharedApplication.KeyWindow?.RootViewController;
|
||||||
|
while (currentController?.PresentedViewController != null)
|
||||||
|
currentController = currentController.PresentedViewController;
|
||||||
|
|
||||||
|
var currentView = currentController?.View;
|
||||||
|
var qLPreview = new QLPreviewController();
|
||||||
|
var item = new QlPreviewItemBundle(fileName, filePath);
|
||||||
|
qLPreview.DataSource = new PreviewControllerDs(item);
|
||||||
|
currentController?.PresentViewController(qLPreview, true, null);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
16
salesbook.Maui/Platforms/iOS/Helpers/PreviewControllerDs.cs
Normal file
16
salesbook.Maui/Platforms/iOS/Helpers/PreviewControllerDs.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using QuickLook;
|
||||||
|
|
||||||
|
namespace salesbook.Maui.Helpers;
|
||||||
|
|
||||||
|
public class PreviewControllerDs(QLPreviewItem item) : QLPreviewControllerDataSource
|
||||||
|
{
|
||||||
|
public override nint PreviewItemCount(QLPreviewController controller)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IQLPreviewItem GetPreviewItem(QLPreviewController controller, nint index)
|
||||||
|
{
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
19
salesbook.Maui/Platforms/iOS/Helpers/QlPreviewItemBundle.cs
Normal file
19
salesbook.Maui/Platforms/iOS/Helpers/QlPreviewItemBundle.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Foundation;
|
||||||
|
using QuickLook;
|
||||||
|
|
||||||
|
namespace salesbook.Maui.Helpers;
|
||||||
|
|
||||||
|
public class QlPreviewItemBundle(string fileName, string filePath) : QLPreviewItem
|
||||||
|
{
|
||||||
|
public override string PreviewItemTitle => fileName;
|
||||||
|
public override NSUrl PreviewItemUrl
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var documents = NSBundle.MainBundle.BundlePath;
|
||||||
|
var lib = Path.Combine(documents, filePath);
|
||||||
|
var url = NSUrl.FromFilename(lib);
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Foundation;
|
||||||
|
using QuickLook;
|
||||||
|
|
||||||
|
namespace salesbook.Maui.Helpers;
|
||||||
|
|
||||||
|
public class QlPreviewItemFileSystem(string fileName, string filePath) : QLPreviewItem
|
||||||
|
{
|
||||||
|
public override string PreviewItemTitle => fileName;
|
||||||
|
|
||||||
|
public override NSUrl PreviewItemUrl => NSUrl.FromString(filePath);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||||
|
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<ApplicationDisplayVersion>2.1.5</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>2.2.2</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>23</ApplicationVersion>
|
<ApplicationVersion>26</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'">
|
||||||
@@ -156,7 +156,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />
|
<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.2.2" />
|
<PackageReference Include="IntegryApiClient.MAUI" Version="1.2.3" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.120" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.120" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.120" />
|
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.120" />
|
||||||
|
|||||||
@@ -121,6 +121,7 @@
|
|||||||
background: var(--light-card-background);
|
background: var(--light-card-background);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
overflow: clip;
|
overflow: clip;
|
||||||
|
min-height: 45px;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
{
|
{
|
||||||
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
||||||
var syncAllData = lastSyncDate.Equals(DateTime.MinValue) || (DateTime.Now - lastSyncDate).TotalDays >= 7;
|
var syncAllData = lastSyncDate.Equals(DateTime.MinValue) || (DateTime.Now - lastSyncDate).TotalDays >= 7;
|
||||||
|
var syncCodJcom = lastSyncDate.Day != DateTime.Now.Day;
|
||||||
|
|
||||||
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && syncAllData)
|
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && syncAllData)
|
||||||
{
|
{
|
||||||
@@ -31,6 +32,13 @@
|
|||||||
return;
|
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();
|
NetworkService.ConnectionAvailable = NetworkService.IsNetworkAvailable();
|
||||||
|
|
||||||
await LoadNotification();
|
await LoadNotification();
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
@page "/login"
|
@page "/login"
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Core.Interface.System
|
||||||
@using salesbook.Shared.Core.Services
|
@using salesbook.Shared.Core.Services
|
||||||
@inject IUserAccountService UserAccountService
|
@inject IUserAccountService UserAccountService
|
||||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||||
|
@inject IGenericSystemService GenericSystemService
|
||||||
|
|
||||||
@if (Spinner)
|
@if (Spinner)
|
||||||
{
|
{
|
||||||
@@ -34,7 +36,7 @@ else
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="my-4 login-footer">
|
<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">
|
<img src="_content/salesbook.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
@page "/PersonalInfo"
|
@page "/PersonalInfo"
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Core.Authorization.Enum
|
@using salesbook.Shared.Core.Authorization.Enum
|
||||||
|
@using salesbook.Shared.Core.Dto.PageState
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Interface.System.Network
|
@using salesbook.Shared.Core.Interface.System.Network
|
||||||
@using salesbook.Shared.Core.Services
|
@using salesbook.Shared.Core.Services
|
||||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IFormFactor FormFactor
|
@inject IFormFactor FormFactor
|
||||||
|
@inject UserListState UserState
|
||||||
|
|
||||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
||||||
|
|
||||||
@@ -16,7 +19,8 @@
|
|||||||
<div class="container content pb-safe-area">
|
<div class="container content pb-safe-area">
|
||||||
<div class="container-primary-info">
|
<div class="container-primary-info">
|
||||||
<div class="section-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)
|
@UtilityString.ExtractInitials(UserSession.User.Fullname)
|
||||||
</MudAvatar>
|
</MudAvatar>
|
||||||
|
|
||||||
@@ -24,7 +28,8 @@
|
|||||||
<span class="info-nome">@UserSession.User.Fullname</span>
|
<span class="info-nome">@UserSession.User.Fullname</span>
|
||||||
@if (UserSession.User.KeyGroup is not null)
|
@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>
|
||||||
</div>
|
</div>
|
||||||
@@ -85,7 +90,7 @@
|
|||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Outlined.Sync"
|
StartIcon="@Icons.Material.Outlined.Sync"
|
||||||
Size="Size.Medium"
|
Size="Size.Medium"
|
||||||
OnClick="() => UpdateDb()"
|
OnClick="@(() => UpdateDb())"
|
||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Sincronizza
|
Sincronizza
|
||||||
</MudButton>
|
</MudButton>
|
||||||
@@ -113,6 +118,8 @@
|
|||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<AppVersion/>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@@ -149,17 +156,11 @@
|
|||||||
|
|
||||||
private void UpdateDb(bool withData = false)
|
private void UpdateDb(bool withData = false)
|
||||||
{
|
{
|
||||||
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
|
LocalStorage.Remove("last-user-sync");
|
||||||
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;
|
UserState.IsLoaded = false;
|
||||||
|
UserState.IsLoading = false;
|
||||||
|
|
||||||
string path;
|
NavigationManager.NavigateTo(withData ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : "/sync", replace: true);
|
||||||
|
|
||||||
if (withData)
|
|
||||||
path = pathAndQuery == null ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : $"/sync/{DateTime.Today:yyyy-MM-dd}?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
|
|
||||||
else
|
|
||||||
path = pathAndQuery == null ? "/sync" : "/sync?path=" + System.Web.HttpUtility.UrlEncode(pathAndQuery);
|
|
||||||
|
|
||||||
NavigationManager.NavigateTo(path, replace: true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,31 @@
|
|||||||
@page "/sync"
|
@page "/sync"
|
||||||
@page "/sync/{DateFilter}"
|
@page "/sync/{DateFilter}"
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@inject ISyncDbService syncDb
|
@using salesbook.Shared.Core.Services
|
||||||
@inject IManageDataService manageData
|
@inject ISyncDbService SyncDb
|
||||||
|
@inject IManageDataService ManageData
|
||||||
|
@inject PreloadService PreloadService
|
||||||
|
|
||||||
<SyncSpinner Elements="@Elements"/>
|
<SyncSpinner Elements="@Elements"/>
|
||||||
|
|
||||||
|
<AppVersion/>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public string? DateFilter { get; set; }
|
[Parameter] public string? DateFilter { get; set; }
|
||||||
|
|
||||||
private Dictionary<string, bool> Elements { get; set; } = new();
|
private Dictionary<string, bool> Elements { get; set; } = new();
|
||||||
|
|
||||||
private bool _hasStarted = false;
|
private bool _hasStarted;
|
||||||
private int _completedCount = 0;
|
private int _completedCount;
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
Elements["Commesse"] = false;
|
Elements["Commesse"] = false;
|
||||||
Elements["Impostazioni"] = false;
|
|
||||||
|
if (DateFilter is null)
|
||||||
|
Elements["Impostazioni"] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
@@ -28,9 +35,7 @@
|
|||||||
_hasStarted = true;
|
_hasStarted = true;
|
||||||
|
|
||||||
if (DateFilter is null)
|
if (DateFilter is null)
|
||||||
{
|
await ManageData.ClearDb();
|
||||||
await manageData.ClearDb();
|
|
||||||
}
|
|
||||||
|
|
||||||
await Task.WhenAll(
|
await Task.WhenAll(
|
||||||
RunAndTrack(SetCommesse),
|
RunAndTrack(SetCommesse),
|
||||||
@@ -52,13 +57,18 @@
|
|||||||
var originalPath = pathQuery["path"] ?? null;
|
var originalPath = pathQuery["path"] ?? null;
|
||||||
var path = originalPath ?? "/Calendar";
|
var path = originalPath ?? "/Calendar";
|
||||||
|
|
||||||
|
if (path.Equals("/Calendar") && DateFilter is null)
|
||||||
|
{
|
||||||
|
_ = Task.Run(() => { _ = PreloadService.PreloadUsersAsync(); });
|
||||||
|
}
|
||||||
|
|
||||||
NavigationManager.NavigateTo(path, replace: true);
|
NavigationManager.NavigateTo(path, replace: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SetCommesse()
|
private async Task SetCommesse()
|
||||||
{
|
{
|
||||||
await Task.Run(async () => { await syncDb.GetAndSaveCommesse(DateFilter); });
|
await Task.Run(async () => { await SyncDb.GetAndSaveCommesse(DateFilter); });
|
||||||
|
|
||||||
Elements["Commesse"] = true;
|
Elements["Commesse"] = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
@@ -66,10 +76,13 @@
|
|||||||
|
|
||||||
private async Task SetSettings()
|
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;
|
Elements["Impostazioni"] = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
OnSave="() => OpenUserForm(Anag)"
|
OnSave="() => OpenUserForm(Anag)"
|
||||||
Back="true"
|
Back="true"
|
||||||
BackOnTop="true"
|
BackOnTop="true"
|
||||||
Title=""
|
Title="@Anag.CodContact"
|
||||||
ShowProfile="false"/>
|
ShowProfile="false"/>
|
||||||
|
|
||||||
@if (IsLoading)
|
@if (IsLoading)
|
||||||
@@ -111,7 +111,7 @@ else
|
|||||||
<label class="tab-trigger" for="tab2" @onclick="() => SwitchTab(1)">Commesse</label>
|
<label class="tab-trigger" for="tab2" @onclick="() => SwitchTab(1)">Commesse</label>
|
||||||
</li>
|
</li>
|
||||||
<li class="tab-item">
|
<li class="tab-item">
|
||||||
<label class="tab-trigger" for="tab3" @onclick="() => SwitchTab(2)">Attivit<EFBFBD></label>
|
<label class="tab-trigger" for="tab3" @onclick="() => SwitchTab(2)">Attività</label>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -219,7 +219,7 @@ else
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tab Attivit<EFBFBD> -->
|
<!-- Tab Attività -->
|
||||||
<div class="tab-content" style="display: @(ActiveTab == 2 ? "block" : "none")">
|
<div class="tab-content" style="display: @(ActiveTab == 2 ? "block" : "none")">
|
||||||
@if (ActivityIsLoading)
|
@if (ActivityIsLoading)
|
||||||
{
|
{
|
||||||
@@ -227,7 +227,7 @@ else
|
|||||||
}
|
}
|
||||||
else if (ActivityList?.Count == 0)
|
else if (ActivityList?.Count == 0)
|
||||||
{
|
{
|
||||||
<NoDataAvailable Text="Nessuna attivit<EFBFBD> presente"/>
|
<NoDataAvailable Text="Nessuna attività presente"/>
|
||||||
}
|
}
|
||||||
else if (ActivityList != null)
|
else if (ActivityList != null)
|
||||||
{
|
{
|
||||||
@@ -274,9 +274,9 @@ else
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MudScrollToTop Selector="#topPage" VisibleCssClass="visible absolute" TopOffset="100" HiddenCssClass="invisible">
|
@* <MudScrollToTop Selector="#topPage" VisibleCssClass="visible absolute" TopOffset="100" HiddenCssClass="invisible"> *@
|
||||||
<MudFab Size="Size.Small" Color="Color.Primary" StartIcon="@Icons.Material.Rounded.KeyboardArrowUp"/>
|
@* <MudFab Size="Size.Small" Color="Color.Primary" StartIcon="@Icons.Material.Rounded.KeyboardArrowUp"/> *@
|
||||||
</MudScrollToTop>
|
@* </MudScrollToTop> *@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -309,7 +309,7 @@ else
|
|||||||
private string _searchTermCommesse = string.Empty;
|
private string _searchTermCommesse = string.Empty;
|
||||||
private List<JtbComt> _filteredCommesse = [];
|
private List<JtbComt> _filteredCommesse = [];
|
||||||
|
|
||||||
// Paginazione e filtri per ATTIVIT<EFBFBD>
|
// Paginazione e filtri per attività
|
||||||
private int _currentPageActivity = 1;
|
private int _currentPageActivity = 1;
|
||||||
private int _selectedPageSizeActivity = 5;
|
private int _selectedPageSizeActivity = 5;
|
||||||
private string _searchTermActivity = string.Empty;
|
private string _searchTermActivity = string.Empty;
|
||||||
@@ -381,7 +381,7 @@ else
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Properties per Attivit<EFBFBD>
|
#region Properties per Attività
|
||||||
|
|
||||||
private int CurrentPageActivityIndex
|
private int CurrentPageActivityIndex
|
||||||
{
|
{
|
||||||
@@ -445,7 +445,7 @@ else
|
|||||||
{
|
{
|
||||||
_loadingCts = new CancellationTokenSource();
|
_loadingCts = new CancellationTokenSource();
|
||||||
|
|
||||||
if (UserState.CodUser?.Equals(CodContact) == true)
|
if (UserState.CodUser != null && UserState.CodUser.Equals(CodContact))
|
||||||
{
|
{
|
||||||
LoadDataFromSession();
|
LoadDataFromSession();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,7 @@
|
|||||||
|
|
||||||
var matchesText =
|
var matchesText =
|
||||||
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
|
(!string.IsNullOrEmpty(user.CodContact) && user.CodContact.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
@using salesbook.Shared.Core.Interface.System
|
||||||
|
@inject IGenericSystemService GenericSystemService
|
||||||
|
|
||||||
|
<div class="app-version">
|
||||||
|
<span>@($"v{GenericSystemService.GetCurrentAppVersion()}")</span>
|
||||||
|
</div>
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||||
@@ -34,12 +35,24 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<OverlayLayout Visible="VisibleOverlay" />
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public CRMAttachedResponseDTO Attached { get; set; } = new();
|
[Parameter] public CRMAttachedResponseDTO Attached { get; set; } = new();
|
||||||
|
|
||||||
|
private bool VisibleOverlay { get; set; }
|
||||||
|
|
||||||
private async Task OpenAttached()
|
private async Task OpenAttached()
|
||||||
{
|
{
|
||||||
var bytes = await IntegryApiService.DownloadFileFromRefUuid(Attached.RefUuid, Attached.FileName);
|
VisibleOverlay = true;
|
||||||
await AttachedService.OpenFile(bytes, Attached.FileName);
|
StateHasChanged();
|
||||||
|
|
||||||
|
await using var file = await IntegryApiService.DownloadFileFromRefUuid(Attached.RefUuid, Attached.FileName);
|
||||||
|
var path = await AttachedService.SaveToTempStorage(file, Attached.FileName);
|
||||||
|
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
await AttachedService.OpenFile(Attached.FileName, path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
@using CommunityToolkit.Mvvm.Messaging
|
@using CommunityToolkit.Mvvm.Messaging
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Components.Layout.Overlay
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Dto.Activity
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
@@ -235,7 +236,7 @@
|
|||||||
{
|
{
|
||||||
foreach (var file in ActivityFileList)
|
foreach (var file in ActivityFileList)
|
||||||
{
|
{
|
||||||
<MudChip T="string" OnClick="@(() => OpenAttached(file.Id, file.FileName))"
|
<MudChip T="string" OnClick="@(() => OpenAttached(file.FileName))"
|
||||||
OnClose="@(() => DeleteAttach(file))" Color="Color.Default">
|
OnClose="@(() => DeleteAttach(file))" Color="Color.Default">
|
||||||
@file.FileName
|
@file.FileName
|
||||||
</MudChip>
|
</MudChip>
|
||||||
@@ -304,6 +305,8 @@
|
|||||||
|
|
||||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||||
|
|
||||||
|
<OverlayLayout Visible="VisibleLoadingOverlay"/>
|
||||||
|
|
||||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel"
|
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel"
|
||||||
@bind-ActivityModel:after="OnAfterChangeEsito"/>
|
@bind-ActivityModel:after="OnAfterChangeEsito"/>
|
||||||
|
|
||||||
@@ -332,8 +335,9 @@
|
|||||||
|
|
||||||
private string? LabelSave { get; set; }
|
private string? LabelSave { get; set; }
|
||||||
|
|
||||||
//Overlay for save
|
//Overlay
|
||||||
private bool VisibleOverlay { get; set; }
|
private bool VisibleOverlay { get; set; }
|
||||||
|
private bool VisibleLoadingOverlay { get; set; }
|
||||||
private bool SuccessAnimation { get; set; }
|
private bool SuccessAnimation { get; set; }
|
||||||
|
|
||||||
private bool OpenEsito { get; set; }
|
private bool OpenEsito { get; set; }
|
||||||
@@ -460,7 +464,10 @@
|
|||||||
|
|
||||||
Users = await ManageData.GetTable<StbUser>();
|
Users = await ManageData.GetTable<StbUser>();
|
||||||
if (!ActivityModel.UserName.IsNullOrEmpty())
|
if (!ActivityModel.UserName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
|
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
|
||||||
|
await InvokeAsync(StateHasChanged);
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsNew && Id != null)
|
if (!IsNew && Id != null)
|
||||||
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
|
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
|
||||||
@@ -767,15 +774,29 @@
|
|||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OpenAttached(string idAttached, string fileName)
|
private async Task OpenAttached(string fileName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var bytes = await IntegryApiService.DownloadFile(ActivityModel.ActivityId!, fileName);
|
VisibleOverlay = true;
|
||||||
await AttachedService.OpenFile(bytes, fileName);
|
StateHasChanged();
|
||||||
|
|
||||||
|
await using var file = await IntegryApiService.DownloadFile(ActivityModel.ActivityId!, fileName);
|
||||||
|
var path = await AttachedService.SaveToTempStorage(file, fileName);
|
||||||
|
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
await AttachedService.OpenFile(fileName, path);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
if (VisibleOverlay)
|
||||||
|
{
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
Snackbar.Clear();
|
Snackbar.Clear();
|
||||||
Snackbar.Add("Impossibile aprire il file", Severity.Error);
|
Snackbar.Add("Impossibile aprire il file", Severity.Error);
|
||||||
Console.WriteLine($"Errore durante l'apertura del file: {ex.Message}");
|
Console.WriteLine($"Errore durante l'apertura del file: {ex.Message}");
|
||||||
@@ -786,7 +807,15 @@
|
|||||||
{
|
{
|
||||||
if (attached is { FileContent: not null, MimeType: not null })
|
if (attached is { FileContent: not null, MimeType: not null })
|
||||||
{
|
{
|
||||||
await AttachedService.OpenFile(attached.FileContent!, attached.Name);
|
VisibleOverlay = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
var path = await AttachedService.SaveToTempStorage(attached.FileContent!, attached.Name);
|
||||||
|
|
||||||
|
VisibleOverlay = false;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
await AttachedService.OpenFile(attached.Name, path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
public enum KeyGroupEnum
|
public enum KeyGroupEnum
|
||||||
{
|
{
|
||||||
UtenteAziendale = 2,
|
UtenteAziendale = 2,
|
||||||
|
Cliente = 3,
|
||||||
Agenti = 5,
|
Agenti = 5,
|
||||||
Tecnico = 22
|
AmministratoreAziendale = 9,
|
||||||
|
Tecnico = 22,
|
||||||
|
ResponsabileDiReparto = 23,
|
||||||
|
ResponsabileAmministrativo = 29,
|
||||||
|
Programmatore = 30
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,11 @@ public static class KeyGroupHelper
|
|||||||
KeyGroupEnum.Agenti => "Agenti",
|
KeyGroupEnum.Agenti => "Agenti",
|
||||||
KeyGroupEnum.Tecnico => "Tecnico",
|
KeyGroupEnum.Tecnico => "Tecnico",
|
||||||
KeyGroupEnum.UtenteAziendale => "Utente Aziendale",
|
KeyGroupEnum.UtenteAziendale => "Utente Aziendale",
|
||||||
|
KeyGroupEnum.AmministratoreAziendale => "Amministratore Aziendale",
|
||||||
|
KeyGroupEnum.ResponsabileDiReparto => "Responsabile Di Reparto",
|
||||||
|
KeyGroupEnum.Programmatore => "Programmatore",
|
||||||
|
KeyGroupEnum.Cliente => "Cliente",
|
||||||
|
KeyGroupEnum.ResponsabileAmministrativo => "Responsabile Amministrativo",
|
||||||
_ => throw new ArgumentOutOfRangeException(nameof(keyGroup), keyGroup, null)
|
_ => throw new ArgumentOutOfRangeException(nameof(keyGroup), keyGroup, null)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,5 +8,7 @@ public interface IAttachedService
|
|||||||
Task<AttachedDTO?> SelectImageFromGallery();
|
Task<AttachedDTO?> SelectImageFromGallery();
|
||||||
Task<AttachedDTO?> SelectFile();
|
Task<AttachedDTO?> SelectFile();
|
||||||
Task<AttachedDTO?> SelectPosition();
|
Task<AttachedDTO?> SelectPosition();
|
||||||
Task OpenFile(Stream file, string fileName);
|
|
||||||
|
Task<string> SaveToTempStorage(Stream file, string fileName, CancellationToken ct = default);
|
||||||
|
Task OpenFile(string fileName, string filePath);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace salesbook.Shared.Core.Interface.System;
|
||||||
|
|
||||||
|
public interface IGenericSystemService
|
||||||
|
{
|
||||||
|
string GetCurrentAppVersion();
|
||||||
|
}
|
||||||
@@ -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.Contact;
|
||||||
using salesbook.Shared.Core.Dto.PageState;
|
using salesbook.Shared.Core.Dto.PageState;
|
||||||
using salesbook.Shared.Core.Dto.Users;
|
using salesbook.Shared.Core.Dto.Users;
|
||||||
@@ -6,7 +8,7 @@ using salesbook.Shared.Core.Interface;
|
|||||||
|
|
||||||
namespace salesbook.Shared.Core.Services;
|
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()
|
public async Task PreloadUsersAsync()
|
||||||
{
|
{
|
||||||
@@ -15,7 +17,10 @@ public class PreloadService(IManageDataService manageData, UserListState userSta
|
|||||||
|
|
||||||
userState.IsLoading = true;
|
userState.IsLoading = true;
|
||||||
|
|
||||||
var users = await manageData.GetContact(new WhereCondContact { FlagStato = "A" });
|
DateTime? lastSync = localStorage.Get<DateTime>("last-user-sync");
|
||||||
|
lastSync = lastSync.Equals(DateTime.MinValue) ? null : lastSync;
|
||||||
|
|
||||||
|
var users = await manageData.GetContact(new WhereCondContact { FlagStato = "A" }, lastSync);
|
||||||
|
|
||||||
var sorted = users
|
var sorted = users
|
||||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
||||||
@@ -27,6 +32,8 @@ public class PreloadService(IManageDataService manageData, UserListState userSta
|
|||||||
userState.FilteredGroupedUserList = userState.GroupedUserList;
|
userState.FilteredGroupedUserList = userState.GroupedUserList;
|
||||||
userState.AllUsers = users;
|
userState.AllUsers = users;
|
||||||
|
|
||||||
|
localStorage.Set("last-user-sync", DateTime.Now);
|
||||||
|
|
||||||
userState.NotifyUsersLoaded();
|
userState.NotifyUsersLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.4" />
|
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.4" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="IntegryApiClient.Core" Version="1.2.2" />
|
<PackageReference Include="IntegryApiClient.Core" Version="1.2.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.10" />
|
||||||
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.120" />
|
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.120" />
|
||||||
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
|
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="IntegryApiClient.Blazor" Version="1.2.2" />
|
<PackageReference Include="IntegryApiClient.Blazor" Version="1.2.3" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.10" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.10" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.10" />
|
||||||
|
|||||||
Reference in New Issue
Block a user