Compare commits
7 Commits
v2.2.0(24)
...
ce86cba86c
| Author | SHA1 | Date | |
|---|---|---|---|
| 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;
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,6 +127,19 @@ public class ManageDataService(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (lastSync == null)
|
||||||
|
{
|
||||||
|
await InsertDbUsers(new UsersSyncResponseDTO
|
||||||
|
{
|
||||||
|
AnagClie = clienti.AnagClie,
|
||||||
|
VtbDest = clienti.VtbDest,
|
||||||
|
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||||
|
PtbPros = prospect.PtbPros,
|
||||||
|
PtbProsRif = prospect.PtbProsRif
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
||||||
{
|
{
|
||||||
AnagClie = clienti.AnagClie,
|
AnagClie = clienti.AnagClie,
|
||||||
@@ -135,6 +148,7 @@ public class ManageDataService(
|
|||||||
PtbPros = prospect.PtbPros,
|
PtbPros = prospect.PtbPros,
|
||||||
PtbProsRif = prospect.PtbProsRif
|
PtbProsRif = prospect.PtbProsRif
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (lastSync != null)
|
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)
|
private static List<T>? MergeLists<T, TKey>(List<T>? localList, List<T>? apiList, Func<T, TKey> keySelector)
|
||||||
{
|
{
|
||||||
if (localList == null || apiList == null) return null;
|
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);
|
var dictionary = localList!.ToDictionary(keySelector);
|
||||||
|
|
||||||
foreach (var apiItem in apiList)
|
foreach (var apiItem in apiList)
|
||||||
{
|
{
|
||||||
@@ -323,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 () =>
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ 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;
|
||||||
@@ -106,6 +108,7 @@ namespace salesbook.Maui
|
|||||||
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
||||||
builder.Services.AddSingleton<IGenericSystemService, GenericSystemService>();
|
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.2.0</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>2.2.1</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>24</ApplicationVersion>
|
<ApplicationVersion>25</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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Components.SingleElements
|
@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"/>
|
||||||
|
|
||||||
@@ -155,18 +157,10 @@
|
|||||||
private void UpdateDb(bool withData = false)
|
private void UpdateDb(bool withData = false)
|
||||||
{
|
{
|
||||||
LocalStorage.Remove("last-user-sync");
|
LocalStorage.Remove("last-user-sync");
|
||||||
|
UserState.IsLoaded = false;
|
||||||
|
UserState.IsLoading = false;
|
||||||
|
|
||||||
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
|
NavigationManager.NavigateTo(withData ? $"/sync/{DateTime.Today:yyyy-MM-dd}" : "/sync", replace: true);
|
||||||
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,8 +3,10 @@
|
|||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@using salesbook.Shared.Core.Services
|
||||||
@inject ISyncDbService SyncDb
|
@inject ISyncDbService SyncDb
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
|
@inject PreloadService PreloadService
|
||||||
|
|
||||||
<SyncSpinner Elements="@Elements"/>
|
<SyncSpinner Elements="@Elements"/>
|
||||||
|
|
||||||
@@ -55,6 +57,11 @@
|
|||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)) ||
|
||||||
|
|||||||
@@ -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; }
|
||||||
@@ -770,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}");
|
||||||
@@ -789,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);
|
||||||
}
|
}
|
||||||
@@ -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