Compare commits
10 Commits
v2.2.0(24)
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b3841d7b6 | |||
| c8d3ec6eec | |||
| 3218ade202 | |||
| ce86cba86c | |||
| 37d66c90d2 | |||
| 5c1d74e04d | |||
| 394d0ace47 | |||
| 99cd67fd5e | |||
| c336084152 | |||
| 74ac06b4c1 |
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;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class AttachedService : IAttachedService
|
||||
public class AttachedService(IFilePreviewService filePreviewService) : IAttachedService
|
||||
{
|
||||
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;
|
||||
var targetDirectory = Path.Combine(cacheDirectory, "file");
|
||||
ArgumentNullException.ThrowIfNull(file);
|
||||
|
||||
if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory);
|
||||
if (file.CanSeek)
|
||||
file.Position = 0;
|
||||
|
||||
var tempFilePath = Path.Combine(targetDirectory, fileName + ".temp");
|
||||
var filePath = Path.Combine(targetDirectory, fileName);
|
||||
fileName = Path.GetFileName(fileName);
|
||||
|
||||
if (File.Exists(filePath)) return filePath;
|
||||
var dir = FileSystem.CacheDirectory;
|
||||
var filePath = Path.Combine(dir, fileName);
|
||||
|
||||
try
|
||||
{
|
||||
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);
|
||||
}
|
||||
await using var fileStream = File.Create(filePath);
|
||||
await file.CopyToAsync(fileStream, ct);
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public async Task OpenFile(Stream file, string fileName)
|
||||
public Task OpenFile(string fileName, string filePath)
|
||||
{
|
||||
var filePath = await SaveToTempStorage(file, fileName);
|
||||
|
||||
if (filePath is null) return;
|
||||
await Launcher.OpenAsync(new OpenFileRequest
|
||||
#if IOS
|
||||
return filePreviewService.Preview(fileName, filePath);
|
||||
#else
|
||||
return Launcher.OpenAsync(new OpenFileRequest
|
||||
{
|
||||
Title = "Apri file",
|
||||
File = new ReadOnlyFile(filePath)
|
||||
});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -126,15 +126,29 @@ public class ManageDataService(
|
||||
FilterDate = lastSync
|
||||
}
|
||||
);
|
||||
|
||||
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
||||
|
||||
if (lastSync == null)
|
||||
{
|
||||
AnagClie = clienti.AnagClie,
|
||||
VtbDest = clienti.VtbDest,
|
||||
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||
PtbPros = prospect.PtbPros,
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
if (lastSync != null)
|
||||
{
|
||||
@@ -170,9 +184,11 @@ public class ManageDataService(
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
@@ -323,6 +339,24 @@ public class ManageDataService(
|
||||
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)
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
|
||||
@@ -5,6 +5,8 @@ using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MudBlazor.Services;
|
||||
using MudExtensions.Services;
|
||||
using salesbook.Maui.Core;
|
||||
using salesbook.Maui.Core.Interface;
|
||||
using salesbook.Maui.Core.RestClient.IntegryApi;
|
||||
using salesbook.Maui.Core.Services;
|
||||
using salesbook.Maui.Core.System;
|
||||
@@ -106,6 +108,7 @@ namespace salesbook.Maui
|
||||
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
||||
builder.Services.AddSingleton<IGenericSystemService, GenericSystemService>();
|
||||
builder.Services.AddSingleton<LocalDbService>();
|
||||
builder.Services.AddSingleton<IFilePreviewService, FilePreviewService>();
|
||||
|
||||
_ = typeof(System.Runtime.InteropServices.SafeHandle);
|
||||
_ = 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>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>2.2.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>24</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>2.2.2</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>26</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
@@ -156,7 +156,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="12.2.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.Maui.Controls" Version="9.0.120" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.120" />
|
||||
|
||||
@@ -121,6 +121,7 @@
|
||||
background: var(--light-card-background);
|
||||
border-radius: 16px;
|
||||
overflow: clip;
|
||||
min-height: 45px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Authorization.Enum
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject INetworkService NetworkService
|
||||
@inject IFormFactor FormFactor
|
||||
@inject UserListState UserState
|
||||
|
||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
||||
|
||||
@@ -155,18 +157,10 @@
|
||||
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;
|
||||
UserState.IsLoaded = false;
|
||||
UserState.IsLoading = false;
|
||||
|
||||
string path;
|
||||
|
||||
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);
|
||||
NavigationManager.NavigateTo(withData ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : "/sync", replace: true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,10 @@
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject ISyncDbService SyncDb
|
||||
@inject IManageDataService ManageData
|
||||
@inject PreloadService PreloadService
|
||||
|
||||
<SyncSpinner Elements="@Elements"/>
|
||||
|
||||
@@ -55,6 +57,11 @@
|
||||
var originalPath = pathQuery["path"] ?? null;
|
||||
var path = originalPath ?? "/Calendar";
|
||||
|
||||
if (path.Equals("/Calendar") && DateFilter is null)
|
||||
{
|
||||
_ = Task.Run(() => { _ = PreloadService.PreloadUsersAsync(); });
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo(path, replace: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
OnSave="() => OpenUserForm(Anag)"
|
||||
Back="true"
|
||||
BackOnTop="true"
|
||||
Title=""
|
||||
Title="@Anag.CodContact"
|
||||
ShowProfile="false"/>
|
||||
|
||||
@if (IsLoading)
|
||||
@@ -111,7 +111,7 @@ else
|
||||
<label class="tab-trigger" for="tab2" @onclick="() => SwitchTab(1)">Commesse</label>
|
||||
</li>
|
||||
<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>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -219,7 +219,7 @@ else
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Tab Attivit<EFBFBD> -->
|
||||
<!-- Tab Attività -->
|
||||
<div class="tab-content" style="display: @(ActiveTab == 2 ? "block" : "none")">
|
||||
@if (ActivityIsLoading)
|
||||
{
|
||||
@@ -227,7 +227,7 @@ else
|
||||
}
|
||||
else if (ActivityList?.Count == 0)
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna attivit<EFBFBD> presente"/>
|
||||
<NoDataAvailable Text="Nessuna attività presente"/>
|
||||
}
|
||||
else if (ActivityList != null)
|
||||
{
|
||||
@@ -274,9 +274,9 @@ else
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<MudScrollToTop Selector="#topPage" VisibleCssClass="visible absolute" TopOffset="100" HiddenCssClass="invisible">
|
||||
<MudFab Size="Size.Small" Color="Color.Primary" StartIcon="@Icons.Material.Rounded.KeyboardArrowUp"/>
|
||||
</MudScrollToTop>
|
||||
@* <MudScrollToTop Selector="#topPage" VisibleCssClass="visible absolute" TopOffset="100" HiddenCssClass="invisible"> *@
|
||||
@* <MudFab Size="Size.Small" Color="Color.Primary" StartIcon="@Icons.Material.Rounded.KeyboardArrowUp"/> *@
|
||||
@* </MudScrollToTop> *@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -309,7 +309,7 @@ else
|
||||
private string _searchTermCommesse = string.Empty;
|
||||
private List<JtbComt> _filteredCommesse = [];
|
||||
|
||||
// Paginazione e filtri per ATTIVIT<EFBFBD>
|
||||
// Paginazione e filtri per attività
|
||||
private int _currentPageActivity = 1;
|
||||
private int _selectedPageSizeActivity = 5;
|
||||
private string _searchTermActivity = string.Empty;
|
||||
@@ -381,7 +381,7 @@ else
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties per Attivit<EFBFBD>
|
||||
#region Properties per Attività
|
||||
|
||||
private int CurrentPageActivityIndex
|
||||
{
|
||||
@@ -445,7 +445,7 @@ else
|
||||
{
|
||||
_loadingCts = new CancellationTokenSource();
|
||||
|
||||
if (UserState.CodUser?.Equals(CodContact) == true)
|
||||
if (UserState.CodUser != null && UserState.CodUser.Equals(CodContact))
|
||||
{
|
||||
LoadDataFromSession();
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@
|
||||
|
||||
var matchesText =
|
||||
(!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.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@@ -34,12 +35,24 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<OverlayLayout Visible="VisibleOverlay" />
|
||||
|
||||
@code {
|
||||
[Parameter] public CRMAttachedResponseDTO Attached { get; set; } = new();
|
||||
|
||||
private bool VisibleOverlay { get; set; }
|
||||
|
||||
private async Task OpenAttached()
|
||||
{
|
||||
var bytes = await IntegryApiService.DownloadFileFromRefUuid(Attached.RefUuid, Attached.FileName);
|
||||
await AttachedService.OpenFile(bytes, Attached.FileName);
|
||||
VisibleOverlay = true;
|
||||
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 salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@@ -235,7 +236,7 @@
|
||||
{
|
||||
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">
|
||||
@file.FileName
|
||||
</MudChip>
|
||||
@@ -304,6 +305,8 @@
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
<OverlayLayout Visible="VisibleLoadingOverlay"/>
|
||||
|
||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel"
|
||||
@bind-ActivityModel:after="OnAfterChangeEsito"/>
|
||||
|
||||
@@ -332,8 +335,9 @@
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
//Overlay
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool VisibleLoadingOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
private bool OpenEsito { get; set; }
|
||||
@@ -770,15 +774,29 @@
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OpenAttached(string idAttached, string fileName)
|
||||
private async Task OpenAttached(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var bytes = await IntegryApiService.DownloadFile(ActivityModel.ActivityId!, fileName);
|
||||
await AttachedService.OpenFile(bytes, fileName);
|
||||
VisibleOverlay = true;
|
||||
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)
|
||||
{
|
||||
if (VisibleOverlay)
|
||||
{
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("Impossibile aprire il file", Severity.Error);
|
||||
Console.WriteLine($"Errore durante l'apertura del file: {ex.Message}");
|
||||
@@ -789,7 +807,15 @@
|
||||
{
|
||||
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
|
||||
{
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
public enum KeyGroupEnum
|
||||
{
|
||||
UtenteAziendale = 2,
|
||||
Cliente = 3,
|
||||
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.Tecnico => "Tecnico",
|
||||
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)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,5 +8,7 @@ public interface IAttachedService
|
||||
Task<AttachedDTO?> SelectImageFromGallery();
|
||||
Task<AttachedDTO?> SelectFile();
|
||||
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);
|
||||
}
|
||||
@@ -24,7 +24,7 @@
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.4" />
|
||||
<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.Maui.Essentials" Version="9.0.120" />
|
||||
<PackageReference Include="SourceGear.sqlite3" Version="3.50.4.2" />
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</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.WebAssembly" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.10" />
|
||||
|
||||
Reference in New Issue
Block a user