Compare commits
72 Commits
4608c6764b
...
V2.0.1(7)
| Author | SHA1 | Date | |
|---|---|---|---|
| 2e51420b2c | |||
| 4521b2a02d | |||
| ec7bedeff6 | |||
| ea2f2d47c3 | |||
| 149eb27628 | |||
| 8b331d5824 | |||
| 31db52d0d7 | |||
| ce56e9e57d | |||
| c61093a942 | |||
| 4645b2660e | |||
| 06bda7c881 | |||
| 8a45bffebc | |||
| e9a0ffdb7a | |||
| 83264731f3 | |||
| 0f3047a2b6 | |||
| 223e74c490 | |||
| b798b01da0 | |||
| 85f19acda6 | |||
| 7bfe67a97c | |||
| 7319378e75 | |||
| dfb86e3cd7 | |||
| 54be40518a | |||
| 93b1a94c88 | |||
| 82d268d9f8 | |||
| 014e2ffc41 | |||
| 8508820350 | |||
| 374b99501e | |||
| 8be3fa9f9e | |||
| 588dbe308a | |||
| 833a1e456f | |||
| 9957229e70 | |||
| cd88c79b32 | |||
| c9d7091355 | |||
| d90a194a4e | |||
| de9d415f04 | |||
| b561405ddc | |||
| c93b0c9bec | |||
| c003c29d83 | |||
| 8dfb163cfa | |||
| 068723f31f | |||
| 8ebc6e3b8f | |||
| 9c69884cc9 | |||
| b34f6cb213 | |||
| 7bcb0581cc | |||
| b2064ad71e | |||
| 8c521dc81e | |||
| 65e48777e6 | |||
| bf2e1b65f0 | |||
| 691c132fb6 | |||
| 5d292a12ef | |||
| 60f7d14a72 | |||
| 5fe41f9445 | |||
| e614c83a5b | |||
| c2da42a51b | |||
| ca6be0c0a8 | |||
| ddbf9c832e | |||
| 201cfd4bc6 | |||
| 87264cf3aa | |||
| dba3cd0357 | |||
| 516fcca7cb | |||
| 453e291827 | |||
| 443ed95013 | |||
| a28b8e2f6c | |||
| 108fa715f0 | |||
| 3ad3ec23f0 | |||
| 3f2b7a6bb5 | |||
| a34e673cd2 | |||
| 10c1435dba | |||
| a97df74ef4 | |||
| 6c789a099e | |||
| 7f8dae7c7d | |||
| 51a4c7a971 |
@@ -1,77 +0,0 @@
|
||||
using AutoMapper;
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
using Template.Shared.Core.Helpers.Enum;
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
|
||||
public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManageDataService
|
||||
{
|
||||
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
|
||||
localDb.Get(whereCond);
|
||||
|
||||
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
||||
{
|
||||
var activities = await localDb.Get(whereCond);
|
||||
|
||||
var codJcomList = activities
|
||||
.Select(x => x.CodJcom)
|
||||
.Where(x => !string.IsNullOrEmpty(x))
|
||||
.Distinct().ToList();
|
||||
|
||||
var jtbComtList = await localDb.Get<JtbComt>(x => codJcomList.Contains(x.CodJcom));
|
||||
var commesseDict = jtbComtList.ToDictionary(x => x.CodJcom, x => x.Descrizione);
|
||||
|
||||
var codAnagList = activities
|
||||
.Select(x => x.CodAnag)
|
||||
.Where(x => !string.IsNullOrEmpty(x))
|
||||
.Distinct().ToList();
|
||||
var clientList = await localDb.Get<AnagClie>(x => codAnagList.Contains(x.CodAnag));
|
||||
var distinctClient = clientList.ToDictionary(x => x.CodAnag, x => x.RagSoc);
|
||||
|
||||
var prospectList = await localDb.Get<PtbPros>(x => codAnagList.Contains(x.CodPpro));
|
||||
var distinctProspect = prospectList.ToDictionary(x => x.CodPpro, x => x.RagSoc);
|
||||
|
||||
var returnDto = activities
|
||||
.Select(activity =>
|
||||
{
|
||||
var dto = mapper.Map<ActivityDTO>(activity);
|
||||
|
||||
if (activity.CodJcom != null)
|
||||
{
|
||||
dto.Category = ActivityCategoryEnum.Commessa;
|
||||
}
|
||||
else
|
||||
{
|
||||
dto.Category = activity.CodAnag != null ? ActivityCategoryEnum.Interna : ActivityCategoryEnum.Memo;
|
||||
}
|
||||
|
||||
if (dto.Category == ActivityCategoryEnum.Interna && activity.CodAnag != null)
|
||||
{
|
||||
string? ragSoc;
|
||||
|
||||
if (distinctClient.TryGetValue(activity.CodAnag, out ragSoc) ||
|
||||
distinctProspect.TryGetValue(activity.CodAnag, out ragSoc))
|
||||
{
|
||||
dto.Cliente = ragSoc;
|
||||
}
|
||||
}
|
||||
|
||||
dto.Commessa = activity.CodJcom != null && commesseDict.TryGetValue(activity.CodJcom, out var descr)
|
||||
? descr
|
||||
: null;
|
||||
return dto;
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return returnDto;
|
||||
}
|
||||
|
||||
public Task InsertOrUpdate<T>(T objectToSave) =>
|
||||
localDb.InsertOrUpdate<T>([objectToSave]);
|
||||
|
||||
public Task ClearDb() =>
|
||||
localDb.ResetDb();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
|
||||
public class NetworkService : INetworkService
|
||||
{
|
||||
public bool IsNetworkAvailable()
|
||||
{
|
||||
return Connectivity.Current.NetworkAccess == NetworkAccess.Internet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
using Template.Shared.Core.Helpers;
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
|
||||
public class SyncDbService(IIntegryApiService integryApiService, LocalDbService localDb) : ISyncDbService
|
||||
{
|
||||
public async Task GetAndSaveActivity(string? dateFilter)
|
||||
{
|
||||
var allActivity = await integryApiService.RetrieveActivity(dateFilter);
|
||||
|
||||
if (!allActivity.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(allActivity!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(allActivity!);
|
||||
}
|
||||
|
||||
public async Task GetAndSaveCommesse(string? dateFilter)
|
||||
{
|
||||
var allCommesse = await integryApiService.RetrieveAllCommesse(dateFilter);
|
||||
|
||||
if (!allCommesse.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(allCommesse!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(allCommesse!);
|
||||
}
|
||||
|
||||
public async Task GetAndSaveProspect(string? dateFilter)
|
||||
{
|
||||
var taskSyncResponseDto = await integryApiService.RetrieveProspect(dateFilter);
|
||||
|
||||
if (!taskSyncResponseDto.PtbPros.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(taskSyncResponseDto.PtbPros!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.PtbPros!);
|
||||
|
||||
if (!taskSyncResponseDto.PtbProsRif.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(taskSyncResponseDto.PtbProsRif!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.PtbProsRif!);
|
||||
}
|
||||
|
||||
public async Task GetAndSaveClienti(string? dateFilter)
|
||||
{
|
||||
var taskSyncResponseDto = await integryApiService.RetrieveAnagClie(dateFilter);
|
||||
|
||||
if (!taskSyncResponseDto.AnagClie.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(taskSyncResponseDto.AnagClie!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.AnagClie!);
|
||||
|
||||
if (!taskSyncResponseDto.VtbDest.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(taskSyncResponseDto.VtbDest!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.VtbDest!);
|
||||
|
||||
if (!taskSyncResponseDto.VtbCliePersRif.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(taskSyncResponseDto.VtbCliePersRif!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(taskSyncResponseDto.VtbCliePersRif!);
|
||||
}
|
||||
|
||||
public async Task GetAndSaveSettings(string? dateFilter)
|
||||
{
|
||||
if (dateFilter is not null)
|
||||
await localDb.ResetSettingsDb();
|
||||
|
||||
var settingsResponse = await integryApiService.RetrieveSettings();
|
||||
|
||||
if (!settingsResponse.ActivityResults.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.ActivityResults!);
|
||||
|
||||
if (!settingsResponse.ActivityTypes.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.ActivityTypes!);
|
||||
|
||||
if (!settingsResponse.StbUsers.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.StbUsers!);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Template.Shared.Core.Messages;
|
||||
|
||||
namespace Template.Maui
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new HardwareBackMessage("back"));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
using CommunityToolkit.Maui;
|
||||
using IntegryApiClient.MAUI;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MudBlazor.Services;
|
||||
using MudExtensions.Services;
|
||||
using Template.Maui.Core.Services;
|
||||
using Template.Shared;
|
||||
using Template.Shared.Core.Helpers;
|
||||
using Template.Shared.Core.Interface;
|
||||
using Template.Shared.Core.Messages;
|
||||
using Template.Shared.Core.Services;
|
||||
|
||||
namespace Template.Maui
|
||||
{
|
||||
public static class MauiProgram
|
||||
{
|
||||
private const string AppToken = "f0484398-1f8b-42f5-ab79-5282c164e1d8";
|
||||
|
||||
public static MauiApp CreateMauiApp()
|
||||
{
|
||||
InteractiveRenderSettings.ConfigureBlazorHybridRenderModes();
|
||||
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
.UseMauiApp<App>()
|
||||
.UseMauiCommunityToolkit()
|
||||
.ConfigureFonts(fonts =>
|
||||
{
|
||||
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
|
||||
})
|
||||
.UseLoginAzienda(AppToken);
|
||||
|
||||
builder.Services.AddMauiBlazorWebView();
|
||||
builder.Services.AddMudServices();
|
||||
builder.Services.AddMudExtensions();
|
||||
|
||||
builder.Services.AddAutoMapper(typeof(MappingProfile));
|
||||
|
||||
builder.Services.AddAuthorizationCore();
|
||||
builder.Services.AddScoped<AppAuthenticationStateProvider>();
|
||||
builder.Services.AddScoped<AuthenticationStateProvider>(provider =>
|
||||
provider.GetRequiredService<AppAuthenticationStateProvider>());
|
||||
|
||||
builder.Services.AddScoped<INetworkService, NetworkService>();
|
||||
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
|
||||
builder.Services.AddScoped<ISyncDbService, SyncDbService>();
|
||||
builder.Services.AddScoped<IManageDataService, ManageDataService>();
|
||||
builder.Services.AddScoped<BackNavigationService>();
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
builder.Logging.AddDebug();
|
||||
#endif
|
||||
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
builder.Services.AddSingleton<LocalDbService>();
|
||||
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true"></application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
@@ -1,13 +0,0 @@
|
||||
using Android.App;
|
||||
using Android.Content.PM;
|
||||
|
||||
namespace Template.Maui
|
||||
{
|
||||
[Activity(Theme = "@style/Maui.SplashTheme",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode |
|
||||
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace Template.Maui
|
||||
{
|
||||
[Application]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
{
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#512BD4</color>
|
||||
<color name="colorPrimaryDark">#2B0B98</color>
|
||||
<color name="colorAccent">#2B0B98</color>
|
||||
</resources>
|
||||
@@ -1,11 +0,0 @@
|
||||
using Foundation;
|
||||
using Template.Maui;
|
||||
|
||||
namespace Template.Maui
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
{
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.Maui;
|
||||
using Microsoft.Maui.Hosting;
|
||||
|
||||
namespace Template.Maui
|
||||
{
|
||||
internal class Program : MauiApplication
|
||||
{
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var app = new Program();
|
||||
app.Run(args);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest package="maui-application-id-placeholder" version="0.0.0" api-version="8" xmlns="http://tizen.org/ns/packages">
|
||||
<profile name="common" />
|
||||
<ui-application appid="maui-application-id-placeholder" exec="Template.Maui.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
|
||||
<label>maui-application-title-placeholder</label>
|
||||
<icon>maui-appicon-placeholder</icon>
|
||||
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
|
||||
</ui-application>
|
||||
<shortcut-list />
|
||||
<privileges>
|
||||
<privilege>http://tizen.org/privilege/internet</privilege>
|
||||
</privileges>
|
||||
<dependencies />
|
||||
<provides-appdefined-privileges />
|
||||
</manifest>
|
||||
@@ -1,8 +0,0 @@
|
||||
<maui:MauiWinUIApplication
|
||||
x:Class="Template.Maui.WinUI.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:maui="using:Microsoft.Maui"
|
||||
xmlns:local="using:Template.Maui.WinUI">
|
||||
|
||||
</maui:MauiWinUIApplication>
|
||||
@@ -1,25 +0,0 @@
|
||||
using Microsoft.UI.Xaml;
|
||||
|
||||
// To learn more about WinUI, the WinUI project structure,
|
||||
// and more about our project templates, see: http://aka.ms/winui-project-info.
|
||||
|
||||
namespace Template.Maui.WinUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
public partial class App : MauiWinUIApplication
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package
|
||||
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
|
||||
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
|
||||
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
|
||||
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
|
||||
IgnorableNamespaces="uap rescap">
|
||||
|
||||
<Identity Name="maui-package-name-placeholder" Publisher="CN=User Name" Version="0.0.0.0" />
|
||||
|
||||
<mp:PhoneIdentity PhoneProductId="725421B6-1171-41CC-BE20-94A305E6285E" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
|
||||
|
||||
<Properties>
|
||||
<DisplayName>$placeholder$</DisplayName>
|
||||
<PublisherDisplayName>User Name</PublisherDisplayName>
|
||||
<Logo>$placeholder$.png</Logo>
|
||||
</Properties>
|
||||
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.0" />
|
||||
</Dependencies>
|
||||
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$">
|
||||
<uap:VisualElements
|
||||
DisplayName="$placeholder$"
|
||||
Description="$placeholder$"
|
||||
Square150x150Logo="$placeholder$.png"
|
||||
Square44x44Logo="$placeholder$.png"
|
||||
BackgroundColor="transparent">
|
||||
<uap:DefaultTile Square71x71Logo="$placeholder$.png" Wide310x150Logo="$placeholder$.png" Square310x310Logo="$placeholder$.png" />
|
||||
<uap:SplashScreen Image="$placeholder$.png" />
|
||||
</uap:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
|
||||
<Capabilities>
|
||||
<rescap:Capability Name="runFullTrust" />
|
||||
</Capabilities>
|
||||
|
||||
</Package>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="Template.Maui.WinUI.app"/>
|
||||
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<!-- The combination of below two tags have the following effect:
|
||||
1) Per-Monitor for >= Windows 10 Anniversary Update
|
||||
2) System < Windows 10 Anniversary Update
|
||||
-->
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
</assembly>
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="0" y="0" width="456" height="456" fill="#512BD4" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 229 B |
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
@@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
|
||||
<title>Template.Maui</title>
|
||||
<base href="/"/>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
|
||||
|
||||
<link href="_content/Template.Shared/css/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="_content/Template.Shared/css/bootstrap/bootstrap-icons.min.css" rel="stylesheet"/>
|
||||
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
|
||||
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
|
||||
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/remixicon/remixicon.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/app.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/form.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/bottomSheet.css"/>
|
||||
<link rel="stylesheet" href="_content/Template.Shared/css/default-theme.css"/>
|
||||
<link rel="stylesheet" href="Template.Maui.styles.css"/>
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="status-bar-safe-area"></div>
|
||||
|
||||
<div id="app">
|
||||
<div class="spinner-container">
|
||||
<span class="loader"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.webview.js" autostart="false"></script>
|
||||
<script src="_content/Template.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add sortable.js reference if SortableList component is used in your application. -->
|
||||
<!--<script src="_content/Template.Shared/js/bootstrap/Sortable.min.js"></script>-->
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
|
||||
<script src="_content/Template.Shared/js/main.js"></script>
|
||||
<script src="_content/Template.Shared/js/calendar.js"></script>
|
||||
<script src="_content/Template.Shared/js/alphaScroll.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,89 +0,0 @@
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<div class="@(Back ? "" : "container") header">
|
||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||
@if (Back)
|
||||
{
|
||||
<div class="left-section">
|
||||
<MudButton StartIcon="@(!Cancel ? Icons.Material.Outlined.ArrowBackIosNew : "")"
|
||||
OnClick="GoBack"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@BackTo
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
|
||||
<h3 class="page-title">@Title</h3>
|
||||
|
||||
<div class="right-section">
|
||||
@if (LabelSave.IsNullOrEmpty())
|
||||
{
|
||||
@if (ShowFilter)
|
||||
{
|
||||
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt" Color="Color.Dark"/>
|
||||
}
|
||||
|
||||
@* @if (ShowCalendarToggle)
|
||||
{
|
||||
<MudIconButton OnClick="OnCalendarToggle" Icon="@Icons.Material.Filled.CalendarMonth" Color="Color.Dark"/>
|
||||
} *@
|
||||
|
||||
@if (ShowProfile)
|
||||
{
|
||||
<MudIconButton Class="user" OnClick="OpenPersonalInfo" Icon="@Icons.Material.Filled.Person" Color="Color.Dark"/>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudButton OnClick="OnSave"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@LabelSave
|
||||
</MudButton>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code{
|
||||
[Parameter] public string? Title { get; set; }
|
||||
[Parameter] public bool ShowFilter { get; set; }
|
||||
[Parameter] public bool ShowProfile { get; set; } = true;
|
||||
[Parameter] public bool Back { get; set; }
|
||||
[Parameter] public bool BackOnTop { get; set; }
|
||||
[Parameter] public string BackTo { get; set; } = "";
|
||||
|
||||
[Parameter] public EventCallback OnFilterToggle { get; set; }
|
||||
|
||||
[Parameter] public bool Cancel { get; set; }
|
||||
[Parameter] public EventCallback OnCancel { get; set; }
|
||||
[Parameter] public string? LabelSave { get; set; }
|
||||
[Parameter] public EventCallback OnSave { get; set; }
|
||||
|
||||
[Parameter] public bool ShowCalendarToggle { get; set; }
|
||||
[Parameter] public EventCallback OnCalendarToggle { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Back = !Back ? !Back && Cancel : Back;
|
||||
BackTo = Cancel ? "Annulla" : BackTo;
|
||||
}
|
||||
|
||||
private async Task GoBack()
|
||||
{
|
||||
if (Cancel)
|
||||
{
|
||||
await OnCancel.InvokeAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await JS.InvokeVoidAsync("goBack");
|
||||
}
|
||||
|
||||
private void OpenPersonalInfo() =>
|
||||
NavigationManager.NavigateTo("/PersonalInfo");
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
@using Template.Shared.Core.Messages
|
||||
@inherits LayoutComponentBase
|
||||
@inject IJSRuntime JS
|
||||
@inject BackNavigationService BackService
|
||||
|
||||
<MudThemeProvider Theme="_currentTheme" />
|
||||
<MudPopoverProvider />
|
||||
<MudDialogProvider />
|
||||
<MudSnackbarProvider />
|
||||
|
||||
<div class="page">
|
||||
<NavMenu />
|
||||
|
||||
<main>
|
||||
<article>
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private readonly MudTheme _currentTheme = new()
|
||||
{
|
||||
PaletteLight = new PaletteLight()
|
||||
{
|
||||
Primary = "#ABA9BF",
|
||||
Secondary = "#BEB7DF",
|
||||
Tertiary = "#B2FDAD"
|
||||
}
|
||||
};
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
BackService.OnHardwareBack += async () =>
|
||||
{
|
||||
await JS.InvokeVoidAsync("goBack");
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
<nav class="navbar @(IsVisible? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
<div class="container-navbar">
|
||||
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Users" Match="NavLinkMatch.All">
|
||||
<div class="d-flex flex-column">
|
||||
<i class="ri-group-line"></i>
|
||||
<span>Contatti</span>
|
||||
</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Calendar" Match="NavLinkMatch.All">
|
||||
<div class="d-flex flex-column">
|
||||
<i class="ri-calendar-todo-line"></i>
|
||||
<span>Agenda</span>
|
||||
</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Notifications" Match="NavLinkMatch.All">
|
||||
<div class="d-flex flex-column">
|
||||
<i class="ri-notification-4-line"></i>
|
||||
<span>Notifiche</span>
|
||||
</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@if (PlusVisible)
|
||||
{
|
||||
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
||||
<ActivatorContent>
|
||||
<MudFab Class="custom-plus-button" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium" IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add" />
|
||||
</ActivatorContent>
|
||||
<ChildContent>
|
||||
<MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem>
|
||||
<MudMenuItem OnClick="() => ModalHelpers.OpenActivityForm(Dialog)">Nuova attivit<69></MudMenuItem>
|
||||
</ChildContent>
|
||||
</MudMenu>
|
||||
}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
private bool IsVisible { get; set; } = true;
|
||||
private bool PlusVisible { get; set; } = true;
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
NavigationManager.LocationChanged += (_, args) =>
|
||||
{
|
||||
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
||||
|
||||
var newIsVisible = new List<string> { "Calendar", "Users", "Notifications" }
|
||||
.Contains(location);
|
||||
|
||||
var newPlusVisible = new List<string> { "Calendar", "Users" }
|
||||
.Contains(location);
|
||||
|
||||
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
|
||||
|
||||
IsVisible = newIsVisible;
|
||||
PlusVisible = newPlusVisible;
|
||||
StateHasChanged();
|
||||
};
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
@page "/"
|
||||
@using Template.Shared.Core.Interface
|
||||
@attribute [Authorize]
|
||||
@inject IFormFactor FormFactor
|
||||
@inject INetworkService NetworkService
|
||||
|
||||
@code
|
||||
{
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
||||
|
||||
if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
|
||||
{
|
||||
NavigationManager.NavigateTo("/sync");
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo("/Calendar");
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
@page "/Notifications"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
|
||||
<HeaderLayout Title="Notifiche" />
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
@page "/PersonalInfo"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Core.Authorization.Enum
|
||||
@using Template.Shared.Core.Interface
|
||||
@using Template.Shared.Core.Services
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject INetworkService NetworkService
|
||||
@inject IFormFactor FormFactor
|
||||
|
||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
||||
|
||||
<div class="container content">
|
||||
<div class="container-primary-info">
|
||||
<div class="section-primary-info">
|
||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
||||
@UtilityString.ExtractInitials(UserSession.User.Fullname)
|
||||
</MudAvatar>
|
||||
|
||||
<div class="personal-info">
|
||||
<span class="info-nome">@UserSession.User.Fullname</span>
|
||||
@if (UserSession.User.KeyGroup is not null)
|
||||
{
|
||||
<span class="info-section">@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="section-info">
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">Telefono</span>
|
||||
<span class="info-text">000 0000000</span> @*Todo: to implement*@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="info-title">Status</span>
|
||||
@if (NetworkService.IsNetworkAvailable())
|
||||
{
|
||||
<div class="status online">
|
||||
<i class="ri-wifi-line"></i>
|
||||
<span>Online</span>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="status offline">
|
||||
<i class="ri-wifi-off-line"></i>
|
||||
<span>Offline</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">E-mail</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(UserSession.User.Email))
|
||||
{
|
||||
@("Nessuna mail configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@UserSession.User.Email
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="info-title">Ultima sincronizzazione</span>
|
||||
<span class="info-text">@LastSync.ToString("g")</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings green-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Sync"
|
||||
Size="Size.Medium"
|
||||
OnClick="() => UpdateDb(true)"
|
||||
Variant="Variant.Outlined">
|
||||
Sincronizza
|
||||
</MudButton>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<MudButton Class="button-settings red-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Sync"
|
||||
Size="Size.Medium"
|
||||
OnClick="() => UpdateDb()"
|
||||
Variant="Variant.Outlined">
|
||||
Ripristina dati
|
||||
</MudButton>
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings exit"
|
||||
FullWidth="true"
|
||||
Color="Color.Error"
|
||||
Size="Size.Medium"
|
||||
OnClick="Logout"
|
||||
Variant="Variant.Outlined">
|
||||
Esci
|
||||
</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private bool Unavailable { get; set; }
|
||||
private DateTime LastSync { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Unavailable = FormFactor.IsWeb() || !NetworkService.IsNetworkAvailable();
|
||||
LastSync = LocalStorage.Get<DateTime>("last-sync");
|
||||
});
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void OpenSettings() =>
|
||||
NavigationManager.NavigateTo("/settings/Profilo");
|
||||
|
||||
private void Logout() =>
|
||||
AuthenticationStateProvider.SignOut();
|
||||
|
||||
private void UpdateDb(bool withData = false)
|
||||
{
|
||||
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
@page "/Users"
|
||||
@attribute [Authorize]
|
||||
@using Template.Shared.Components.Layout
|
||||
|
||||
<HeaderLayout Title="Contatti" />
|
||||
|
||||
<div class="container">
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
@using Microsoft.VisualBasic
|
||||
@using Template.Shared.Core.Dto
|
||||
@using Template.Shared.Components.Layout
|
||||
@using Template.Shared.Core.Entity
|
||||
@using Template.Shared.Core.Interface
|
||||
@using Template.Shared.Components.Layout.Overlay
|
||||
@using Template.Shared.Components.SingleElements.BottomSheet
|
||||
@inject IManageDataService ManageData
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuova" : $"{ActivityModel.ActivityId}")" />
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Descrizione" Variant="Variant.Text" Lines="3" @bind-Value="ActivityModel.ActivityDescription" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<MudInput ReadOnly="IsView" T="string?" Placeholder="Cliente" @bind-Value="ActivityModel.Cliente" @bind-Value:after="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<MudInput ReadOnly="IsView" T="string?" Placeholder="Commessa" @bind-Value="ActivityModel.Commessa" @bind-Value:after="OnAfterChangeValue" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span>Inizio</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="yyyy-MM-ddTHH:mm" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedTime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Fine</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="yyyy-MM-ddTHH:mm" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedEndtime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span>Avviso</span>
|
||||
|
||||
<MudSwitch ReadOnly="IsView" T="bool" Disabled="true" Color="Color.Primary" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Assegnata a</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="IsView" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.UserName" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var user in Users)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserName">@user.FullName</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
<MudSelectExtended ReadOnly="IsView" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityTypeId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var type in ActivityType)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container" @onclick="OpenSelectEsito">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended ReadOnly="true" FullWidth="true" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.ActivityResultId" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var result in ActivityResult)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView" T="string?" Placeholder="Note" Variant="Variant.Text" Lines="4" @bind-Value="ActivityModel.Note" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation" />
|
||||
|
||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" />
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public string? Id { get; set; }
|
||||
|
||||
private ActivityDTO OriginalModel { get; set; } = new();
|
||||
private ActivityDTO ActivityModel { get; set; } = new();
|
||||
|
||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
||||
private List<StbUser> Users { get; set; } = [];
|
||||
|
||||
private bool IsNew => Id.IsNullOrEmpty();
|
||||
private bool IsView => !IsNew && !NetworkService.IsNetworkAvailable();
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
private bool OpenEsito { get; set; } = false;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
_ = LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
|
||||
if (!Id.IsNullOrEmpty())
|
||||
ActivityModel = (await ManageData.GetActivity(x => x.ActivityId.Equals(Id))).Last();
|
||||
|
||||
if (IsNew)
|
||||
{
|
||||
ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour));
|
||||
ActivityModel.EstimatedEndtime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour) + TimeSpan.FromHours(1));
|
||||
}
|
||||
|
||||
OriginalModel = ActivityModel.Clone();
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var newActivity = await IntegryApiService.SaveActivity(ActivityModel);
|
||||
await ManageData.InsertOrUpdate(newActivity);
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(newActivity);
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
Users = await ManageData.GetTable<StbUser>();
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void OpenSelectEsito()
|
||||
{
|
||||
OpenEsito = !OpenEsito;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
.no-data {
|
||||
margin-top: 2rem;
|
||||
width: calc(100vw - (var(--bs-gutter-x) * .5) * 2);
|
||||
}
|
||||
|
||||
.no-data img {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
.no-data p {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using AutoMapper;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
|
||||
namespace Template.Shared.Core.Helpers;
|
||||
|
||||
public class MappingProfile : Profile
|
||||
{
|
||||
public MappingProfile()
|
||||
{
|
||||
CreateMap<StbActivity, ActivityDTO>();
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using MudBlazor;
|
||||
using Template.Shared.Components.SingleElements.Modal;
|
||||
|
||||
namespace Template.Shared.Core.Helpers;
|
||||
|
||||
public class ModalHelpers
|
||||
{
|
||||
public static async Task<DialogResult?> OpenActivityForm(IDialogService dialog, string? id = null)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ActivityForm>(
|
||||
"Activity form",
|
||||
new DialogParameters<ActivityForm>
|
||||
{
|
||||
{ x => x.Id, id }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = true,
|
||||
CloseButton = false,
|
||||
NoHeader = true
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
|
||||
namespace Template.Shared.Core.Interface;
|
||||
|
||||
public interface IIntegryApiService
|
||||
{
|
||||
Task<List<StbActivity>?> RetrieveActivity(string? dateFilter = null);
|
||||
Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter = null);
|
||||
Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter = null);
|
||||
Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter = null);
|
||||
Task<SettingsResponseDTO> RetrieveSettings();
|
||||
|
||||
Task<StbActivity?> SaveActivity(ActivityDTO activity);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
|
||||
namespace Template.Shared.Core.Interface;
|
||||
|
||||
public interface IManageDataService
|
||||
{
|
||||
Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new();
|
||||
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
|
||||
|
||||
Task InsertOrUpdate<T>(T objectToSave);
|
||||
|
||||
Task ClearDb();
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace Template.Shared.Core.Interface;
|
||||
|
||||
public interface INetworkService
|
||||
{
|
||||
public bool IsNetworkAvailable();
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Template.Shared.Core.Interface;
|
||||
|
||||
public interface ISyncDbService
|
||||
{
|
||||
Task GetAndSaveActivity(string? dateFilter = null);
|
||||
Task GetAndSaveCommesse(string? dateFilter = null);
|
||||
Task GetAndSaveProspect(string? dateFilter = null);
|
||||
Task GetAndSaveClienti(string? dateFilter = null);
|
||||
Task GetAndSaveSettings(string? dateFilter = null);
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Shared.Core.Services;
|
||||
|
||||
public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession)
|
||||
: IIntegryApiService
|
||||
{
|
||||
public Task<List<StbActivity>?> RetrieveActivity(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object> { { "dateFilter", dateFilter ?? "2020-01-01" } };
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<List<StbActivity>?>("crm/retrieveActivity", queryParams);
|
||||
}
|
||||
|
||||
public Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>();
|
||||
|
||||
if (dateFilter != null)
|
||||
{
|
||||
queryParams.Add("dateFilter", dateFilter);
|
||||
}
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("crm/retrieveCommesse", queryParams);
|
||||
}
|
||||
|
||||
public Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>();
|
||||
|
||||
if (dateFilter != null)
|
||||
{
|
||||
queryParams.Add("dateFilter", dateFilter);
|
||||
}
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveClienti", queryParams)!;
|
||||
}
|
||||
|
||||
public Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter)
|
||||
{
|
||||
var queryParams = new Dictionary<string, object>();
|
||||
|
||||
if (dateFilter != null)
|
||||
{
|
||||
queryParams.Add("dateFilter", dateFilter);
|
||||
}
|
||||
|
||||
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveProspect", queryParams)!;
|
||||
}
|
||||
|
||||
public Task<SettingsResponseDTO> RetrieveSettings() =>
|
||||
integryApiRestClient.AuthorizedGet<SettingsResponseDTO>("crm/retrieveSettings", null)!;
|
||||
|
||||
public Task<StbActivity?> SaveActivity(ActivityDTO activity) =>
|
||||
integryApiRestClient.AuthorizedPost<StbActivity?>("crm/saveActivity", activity);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
namespace Template.Shared.Core.Utility;
|
||||
|
||||
public static class UtilityString
|
||||
{
|
||||
public static string ExtractInitials(string fullname)
|
||||
{
|
||||
return string.Concat(fullname
|
||||
.Split(' ', StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(word => char.ToUpper(word[0])));
|
||||
}
|
||||
|
||||
public static string FirstCharToUpper(this string input) =>
|
||||
input switch
|
||||
{
|
||||
null => throw new ArgumentNullException(nameof(input)),
|
||||
"" => throw new ArgumentException($"{nameof(input)} cannot be empty", nameof(input)),
|
||||
_ => input[0].ToString().ToUpper() + input.Substring(1)
|
||||
};
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<SupportedPlatform Include="browser" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.Core" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.5" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.11.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.5" />
|
||||
<PackageReference Include="MudBlazor" Version="8.6.0" />
|
||||
<PackageReference Include="MudBlazor.ThemeManager" Version="3.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\css\lineicons\" />
|
||||
<Folder Include="wwwroot\js\bootstrap\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,10 +0,0 @@
|
||||
:root {
|
||||
/*Color*/
|
||||
--card-border-color: hsl(from var(--mud-palette-gray-light) h s 86%);
|
||||
--gray-for-shadow: hsl(from var(--mud-palette-gray-light) h s 95%);
|
||||
/*Utility*/
|
||||
--card-shadow: 5px 5px 10px 0 var(--gray-for-shadow);
|
||||
--custom-box-shadow: 1px 2px 5px rgba(165, 165, 165, 0.5);
|
||||
--mud-default-borderradius: 12px !important;
|
||||
--m-page-x: 1.25rem;
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
.title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.customDialog-form .content {
|
||||
height: calc(100vh - (.6rem + 40px));
|
||||
overflow: auto;
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
.customDialog-form .header { padding: 0 !important; }
|
||||
|
||||
.customDialog-form .content::-webkit-scrollbar { display: none; }
|
||||
|
||||
.input-card {
|
||||
width: 100%;
|
||||
background: var(--mud-palette-background-gray);
|
||||
border-radius: 9px;
|
||||
padding: .5rem 1rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.input-card.clearButton {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: .4rem 1rem !important;
|
||||
}
|
||||
|
||||
.input-card > .divider { margin: 0 !important; }
|
||||
|
||||
.form-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
min-height: 35px;
|
||||
}
|
||||
|
||||
.form-container > span {
|
||||
font-weight: 600;
|
||||
width: 50%;
|
||||
margin-right: .3rem;
|
||||
}
|
||||
|
||||
.form-container > .disable-full-width { width: unset !important; }
|
||||
|
||||
.dateTime-picker {
|
||||
display: flex;
|
||||
gap: .3rem;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/*Custom mudBlazor*/
|
||||
|
||||
.form-container .mud-input.mud-input-underline:before { border-bottom: none !important; }
|
||||
|
||||
.form-container .mud-input.mud-input-underline:after { border-bottom: none !important; }
|
||||
|
||||
.form-container.text-align-end .mud-input-slot { text-align: end; }
|
||||
|
||||
.input-card .mud-input.mud-input-underline:before { border-bottom: none !important; }
|
||||
|
||||
.input-card .mud-input.mud-input-underline:after { border-bottom: none !important; }
|
||||
|
||||
.form-container .customIcon-select .mud-icon-root.mud-svg-icon {
|
||||
rotate: 90deg !important;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.form-container .customIcon-select .mud-input-slot { text-align: end; }
|
||||
|
||||
.input-card .mud-input {
|
||||
width: 100%;
|
||||
font-weight: 500;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Dto;
|
||||
using Template.Shared.Core.Entity;
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Web.Core.Services;
|
||||
|
||||
public class ManageDataService : IManageDataService
|
||||
{
|
||||
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task InsertOrUpdate<T>(T objectToSave)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Task ClearDb()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Template.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Web.Core.Services;
|
||||
|
||||
public class NetworkService : INetworkService
|
||||
{
|
||||
public bool IsNetworkAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
|
||||
android:Application.WindowSoftInputModeAdjust="Resize"
|
||||
x:Class="Template.Maui.App">
|
||||
x:Class="salesbook.Maui.App">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
|
||||
<Color x:Key="PageBackgroundColor">#512bdf</Color>
|
||||
<Color x:Key="PageBackgroundColor">#dff2ff</Color>
|
||||
<Color x:Key="PrimaryTextColor">White</Color>
|
||||
|
||||
<Style TargetType="Label">
|
||||
@@ -18,7 +18,7 @@
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="TextColor" Value="{DynamicResource PrimaryTextColor}" />
|
||||
<Setter Property="FontFamily" Value="OpenSansRegular" />
|
||||
<Setter Property="BackgroundColor" Value="#2b0b98" />
|
||||
<Setter Property="BackgroundColor" Value="#dff2ff" />
|
||||
<Setter Property="Padding" Value="14,10" />
|
||||
</Style>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
@@ -0,0 +1,10 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Maui.Core.RestClient.IntegryApi.Dto;
|
||||
|
||||
public class RegisterDeviceDTO
|
||||
{
|
||||
[JsonPropertyName("userDeviceToken")]
|
||||
public WtbUserDeviceTokenDTO UserDeviceToken { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Maui.Core.RestClient.IntegryApi.Dto;
|
||||
|
||||
public class WtbUserDeviceTokenDTO
|
||||
{
|
||||
[JsonPropertyName("type")]
|
||||
public string Type => "wtb_user_device_tokens";
|
||||
|
||||
[JsonPropertyName("deviceToken")]
|
||||
public string DeviceToken { get; set; }
|
||||
|
||||
[JsonPropertyName("userName")]
|
||||
public string Username { get; set; }
|
||||
|
||||
[JsonPropertyName("appName")]
|
||||
public int AppName => 7; //salesbook
|
||||
|
||||
[JsonPropertyName("platform")]
|
||||
public string Platform { get; set; }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using salesbook.Maui.Core.RestClient.IntegryApi.Dto;
|
||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
namespace salesbook.Maui.Core.RestClient.IntegryApi;
|
||||
|
||||
public class IntegryRegisterNotificationRestClient(
|
||||
ILogger<IntegryRegisterNotificationRestClient> logger,
|
||||
IUserSession userSession,
|
||||
IIntegryApiRestClient integryApiRestClient
|
||||
) : IIntegryRegisterNotificationRestClient
|
||||
{
|
||||
public async Task Register(string fcmToken, ILogger? logger1 = null)
|
||||
{
|
||||
logger1 ??= logger;
|
||||
|
||||
var userDeviceToken = new RegisterDeviceDTO()
|
||||
{
|
||||
UserDeviceToken = new WtbUserDeviceTokenDTO()
|
||||
{
|
||||
DeviceToken = fcmToken,
|
||||
Platform = OperatingSystem.IsAndroid() ? "Android" : "iOS",
|
||||
Username = userSession.User.Username
|
||||
}
|
||||
};
|
||||
try
|
||||
{
|
||||
await integryApiRestClient.AuthorizedPost<object>($"device_tokens/insert", userDeviceToken,
|
||||
logger: logger1);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SentrySdk.CaptureException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
138
salesbook.Maui/Core/Services/AttachedService.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class AttachedService : IAttachedService
|
||||
{
|
||||
public async Task<AttachedDTO?> SelectImageFromCamera()
|
||||
{
|
||||
var cameraPerm = await Permissions.RequestAsync<Permissions.Camera>();
|
||||
if (cameraPerm != PermissionStatus.Granted)
|
||||
return null;
|
||||
|
||||
FileResult? result = null;
|
||||
|
||||
try
|
||||
{
|
||||
result = await MediaPicker.Default.CapturePhotoAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore cattura foto: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image);
|
||||
}
|
||||
|
||||
public async Task<AttachedDTO?> SelectImageFromGallery()
|
||||
{
|
||||
var storagePerm = await Permissions.RequestAsync<Permissions.StorageRead>();
|
||||
if (storagePerm != PermissionStatus.Granted)
|
||||
return null;
|
||||
|
||||
FileResult? result = null;
|
||||
|
||||
try
|
||||
{
|
||||
result = await MediaPicker.Default.PickPhotoAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore selezione galleria: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
|
||||
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image);
|
||||
}
|
||||
|
||||
|
||||
public async Task<AttachedDTO?> SelectFile()
|
||||
{
|
||||
var perm = await Permissions.RequestAsync<Permissions.StorageRead>();
|
||||
if (perm != PermissionStatus.Granted) return null;
|
||||
|
||||
var result = await FilePicker.PickAsync();
|
||||
|
||||
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Document);
|
||||
}
|
||||
|
||||
public async Task<AttachedDTO?> SelectPosition()
|
||||
{
|
||||
var perm = await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
|
||||
if (perm != PermissionStatus.Granted) return null;
|
||||
|
||||
var loc = await Geolocation.GetLastKnownLocationAsync();
|
||||
if (loc is null) return null;
|
||||
|
||||
return new AttachedDTO
|
||||
{
|
||||
Name = "Posizione attuale",
|
||||
Lat = loc.Latitude,
|
||||
Lng = loc.Longitude,
|
||||
Type = AttachedDTO.TypeAttached.Position
|
||||
};
|
||||
}
|
||||
|
||||
private static async Task<AttachedDTO> ConvertToDto(FileResult file, AttachedDTO.TypeAttached type)
|
||||
{
|
||||
var stream = await file.OpenReadAsync();
|
||||
using var ms = new MemoryStream();
|
||||
await stream.CopyToAsync(ms);
|
||||
|
||||
return new AttachedDTO
|
||||
{
|
||||
Name = file.FileName,
|
||||
Path = file.FullPath,
|
||||
MimeType = file.ContentType,
|
||||
DimensionBytes = ms.Length,
|
||||
FileBytes = ms.ToArray(),
|
||||
Type = type
|
||||
};
|
||||
}
|
||||
|
||||
private static async Task<string?> SaveToTempStorage(Stream file, string fileName)
|
||||
{
|
||||
var cacheDirectory = FileSystem.CacheDirectory;
|
||||
var targetDirectory = Path.Combine(cacheDirectory, "file");
|
||||
|
||||
if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory);
|
||||
|
||||
var tempFilePath = Path.Combine(targetDirectory, fileName + ".temp");
|
||||
var filePath = Path.Combine(targetDirectory, fileName);
|
||||
|
||||
if (File.Exists(filePath)) return filePath;
|
||||
|
||||
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}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (File.Exists(tempFilePath)) File.Delete(tempFilePath);
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public async Task OpenFile(Stream file, string fileName)
|
||||
{
|
||||
var filePath = await SaveToTempStorage(file, fileName);
|
||||
|
||||
if (filePath is null) return;
|
||||
await Launcher.OpenAsync(new OpenFileRequest
|
||||
{
|
||||
File = new ReadOnlyFile(filePath)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using Template.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace Template.Maui.Core.Services;
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class FormFactor : IFormFactor
|
||||
{
|
||||
@@ -1,7 +1,8 @@
|
||||
using SQLite;
|
||||
using System.Linq.Expressions;
|
||||
using Template.Shared.Core.Entity;
|
||||
namespace Template.Maui.Core.Services;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class LocalDbService
|
||||
{
|
||||
@@ -21,7 +22,10 @@ public class LocalDbService
|
||||
_connection.CreateTableAsync<VtbDest>();
|
||||
_connection.CreateTableAsync<StbActivityResult>();
|
||||
_connection.CreateTableAsync<StbActivityType>();
|
||||
_connection.CreateTableAsync<SrlActivityTypeUser>();
|
||||
_connection.CreateTableAsync<StbUser>();
|
||||
_connection.CreateTableAsync<VtbTipi>();
|
||||
_connection.CreateTableAsync<Nazioni>();
|
||||
}
|
||||
|
||||
public async Task ResetSettingsDb()
|
||||
@@ -30,11 +34,17 @@ public class LocalDbService
|
||||
{
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_result;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_type;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS srl_activity_type_user;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_user;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS vtb_tipi;");
|
||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS nazioni;");
|
||||
|
||||
await _connection.CreateTableAsync<StbActivityResult>();
|
||||
await _connection.CreateTableAsync<StbActivityType>();
|
||||
await _connection.CreateTableAsync<SrlActivityTypeUser>();
|
||||
await _connection.CreateTableAsync<StbUser>();
|
||||
await _connection.CreateTableAsync<VtbTipi>();
|
||||
await _connection.CreateTableAsync<Nazioni>();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -110,4 +120,7 @@ public class LocalDbService
|
||||
: _connection.Table<T>().Where(whereCond).ToListAsync();
|
||||
|
||||
public List<T> Get<T>(string sql) where T : new() => _connection.QueryAsync<T>(sql).Result;
|
||||
|
||||
public async Task Delete<T>(T entity) =>
|
||||
await _connection.DeleteAsync(entity);
|
||||
}
|
||||
370
salesbook.Maui/Core/Services/ManageDataService.cs
Normal file
@@ -0,0 +1,370 @@
|
||||
using AutoMapper;
|
||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Storage;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Dto.Activity;
|
||||
using salesbook.Shared.Core.Dto.Contact;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using salesbook.Shared.Core.Helpers;
|
||||
using salesbook.Shared.Core.Helpers.Enum;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
using salesbook.Shared.Core.Interface.System.Network;
|
||||
using System.Linq.Expressions;
|
||||
using salesbook.Shared.Core.Dto.PageState;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class ManageDataService(
|
||||
LocalDbService localDb,
|
||||
IMapper mapper,
|
||||
UserListState userListState,
|
||||
IIntegryApiService integryApiService,
|
||||
INetworkService networkService
|
||||
) : IManageDataService
|
||||
{
|
||||
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
|
||||
localDb.Get(whereCond);
|
||||
|
||||
public async Task<List<AnagClie>> GetClienti(WhereCondContact? whereCond)
|
||||
{
|
||||
List<AnagClie> clienti = [];
|
||||
whereCond ??= new WhereCondContact();
|
||||
whereCond.OnlyContact = true;
|
||||
|
||||
if (networkService.ConnectionAvailable)
|
||||
{
|
||||
var response = await integryApiService.RetrieveAnagClie(
|
||||
new CRMAnagRequestDTO
|
||||
{
|
||||
CodAnag = whereCond.CodAnag,
|
||||
FlagStato = whereCond.FlagStato,
|
||||
PartIva = whereCond.PartIva,
|
||||
ReturnPersRif = !whereCond.OnlyContact
|
||||
}
|
||||
);
|
||||
|
||||
clienti = response.AnagClie ?? [];
|
||||
}
|
||||
else
|
||||
{
|
||||
clienti = await localDb.Get<AnagClie>(x =>
|
||||
(whereCond.FlagStato != null && x.FlagStato.Equals(whereCond.FlagStato)) ||
|
||||
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||
(whereCond.PartIva == null && whereCond.FlagStato == null)
|
||||
);
|
||||
}
|
||||
|
||||
return clienti;
|
||||
}
|
||||
|
||||
public async Task<List<PtbPros>> GetProspect(WhereCondContact? whereCond)
|
||||
{
|
||||
List<PtbPros> prospect = [];
|
||||
whereCond ??= new WhereCondContact();
|
||||
whereCond.OnlyContact = true;
|
||||
|
||||
if (networkService.ConnectionAvailable)
|
||||
{
|
||||
var response = await integryApiService.RetrieveProspect(
|
||||
new CRMProspectRequestDTO
|
||||
{
|
||||
CodPpro = whereCond.CodAnag,
|
||||
PartIva = whereCond.PartIva,
|
||||
ReturnPersRif = !whereCond.OnlyContact
|
||||
}
|
||||
);
|
||||
|
||||
prospect = response.PtbPros ?? [];
|
||||
}
|
||||
else
|
||||
{
|
||||
prospect = await localDb.Get<PtbPros>(x =>
|
||||
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||
(whereCond.PartIva == null)
|
||||
);
|
||||
}
|
||||
|
||||
return prospect;
|
||||
}
|
||||
|
||||
public async Task<List<ContactDTO>> GetContact(WhereCondContact? whereCond, DateTime? lastSync)
|
||||
{
|
||||
List<AnagClie>? contactList;
|
||||
List<PtbPros>? prospectList;
|
||||
whereCond ??= new WhereCondContact();
|
||||
|
||||
if (networkService.ConnectionAvailable)
|
||||
{
|
||||
var response = new UsersSyncResponseDTO();
|
||||
|
||||
var clienti = await integryApiService.RetrieveAnagClie(
|
||||
new CRMAnagRequestDTO
|
||||
{
|
||||
CodAnag = whereCond.CodAnag,
|
||||
FlagStato = whereCond.FlagStato,
|
||||
PartIva = whereCond.PartIva,
|
||||
ReturnPersRif = !whereCond.OnlyContact,
|
||||
FilterDate = lastSync
|
||||
}
|
||||
);
|
||||
|
||||
response.AnagClie = clienti.AnagClie;
|
||||
response.VtbDest = clienti.VtbDest;
|
||||
response.VtbCliePersRif = clienti.VtbCliePersRif;
|
||||
|
||||
var prospect = await integryApiService.RetrieveProspect(
|
||||
new CRMProspectRequestDTO
|
||||
{
|
||||
CodPpro = whereCond.CodAnag,
|
||||
PartIva = whereCond.PartIva,
|
||||
ReturnPersRif = !whereCond.OnlyContact,
|
||||
FilterDate = lastSync
|
||||
}
|
||||
);
|
||||
|
||||
response.PtbPros = prospect.PtbPros;
|
||||
response.PtbProsRif = prospect.PtbProsRif;
|
||||
|
||||
_ = UpdateDbUsers(response);
|
||||
|
||||
contactList = clienti.AnagClie;
|
||||
prospectList = prospect.PtbPros;
|
||||
}
|
||||
else
|
||||
{
|
||||
contactList = await localDb.Get<AnagClie>(x =>
|
||||
(whereCond.FlagStato != null && x.FlagStato.Equals(whereCond.FlagStato)) ||
|
||||
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||
(whereCond.PartIva == null && whereCond.FlagStato == null)
|
||||
);
|
||||
prospectList = await localDb.Get<PtbPros>(x =>
|
||||
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||
(whereCond.PartIva == null)
|
||||
);
|
||||
}
|
||||
|
||||
// Mappa i contatti
|
||||
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
||||
|
||||
// Mappa i prospects
|
||||
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
|
||||
|
||||
contactMapper.AddRange(prospectMapper);
|
||||
|
||||
return contactMapper;
|
||||
}
|
||||
|
||||
public async Task<ContactDTO?> GetSpecificContact(string codAnag, bool isContact)
|
||||
{
|
||||
if (isContact)
|
||||
{
|
||||
var contact = (await localDb.Get<AnagClie>(x => x.CodAnag != null && x.CodAnag.Equals(codAnag)))
|
||||
.LastOrDefault();
|
||||
|
||||
return contact == null ? null : mapper.Map<ContactDTO>(contact);
|
||||
}
|
||||
else
|
||||
{
|
||||
var contact = (await localDb.Get<PtbPros>(x => x.CodPpro != null && x.CodPpro.Equals(codAnag)))
|
||||
.LastOrDefault();
|
||||
|
||||
return contact == null ? null : mapper.Map<ContactDTO>(contact);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<ActivityDTO>> GetActivityTryLocalDb(WhereCondActivity whereCond)
|
||||
{
|
||||
List<StbActivity>? activities;
|
||||
|
||||
activities = await localDb.Get<StbActivity>(x =>
|
||||
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null &&
|
||||
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) ||
|
||||
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) ||
|
||||
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
|
||||
);
|
||||
|
||||
if (activities.IsNullOrEmpty() && networkService.ConnectionAvailable)
|
||||
{
|
||||
activities = await integryApiService.RetrieveActivity(
|
||||
new CRMRetrieveActivityRequestDTO
|
||||
{
|
||||
StarDate = whereCond.Start,
|
||||
EndDate = whereCond.End,
|
||||
ActivityId = whereCond.ActivityId
|
||||
}
|
||||
);
|
||||
|
||||
_ = UpdateDb(activities);
|
||||
}
|
||||
|
||||
return await MapActivity(activities);
|
||||
}
|
||||
|
||||
public async Task<List<ActivityDTO>> GetActivity(WhereCondActivity whereCond, bool useLocalDb)
|
||||
{
|
||||
List<StbActivity>? activities;
|
||||
|
||||
if (networkService.ConnectionAvailable && !useLocalDb)
|
||||
{
|
||||
activities = await integryApiService.RetrieveActivity(
|
||||
new CRMRetrieveActivityRequestDTO
|
||||
{
|
||||
StarDate = whereCond.Start,
|
||||
EndDate = whereCond.End,
|
||||
ActivityId = whereCond.ActivityId
|
||||
}
|
||||
);
|
||||
|
||||
_ = UpdateDb(activities);
|
||||
}
|
||||
else
|
||||
{
|
||||
activities = await localDb.Get<StbActivity>(x =>
|
||||
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null &&
|
||||
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) ||
|
||||
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) ||
|
||||
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
|
||||
);
|
||||
}
|
||||
|
||||
return await MapActivity(activities);
|
||||
}
|
||||
|
||||
public async Task<List<ActivityDTO>> MapActivity(List<StbActivity>? activities)
|
||||
{
|
||||
if (activities == null) return [];
|
||||
|
||||
var codJcomList = activities
|
||||
.Select(x => x.CodJcom)
|
||||
.Where(x => !string.IsNullOrEmpty(x))
|
||||
.Distinct().ToList();
|
||||
|
||||
var jtbComtList = await localDb.Get<JtbComt>(x => codJcomList.Contains(x.CodJcom));
|
||||
|
||||
var codAnagList = activities
|
||||
.Select(x => x.CodAnag)
|
||||
.Where(x => !string.IsNullOrEmpty(x))
|
||||
.Distinct().ToList();
|
||||
|
||||
IDictionary<string, string?>? distinctUser = null;
|
||||
|
||||
if (userListState.AllUsers != null)
|
||||
{
|
||||
distinctUser = userListState.AllUsers
|
||||
.Where(x => codAnagList.Contains(x.CodContact))
|
||||
.ToDictionary(x => x.CodContact, x => x.RagSoc);
|
||||
}
|
||||
|
||||
var returnDto = activities
|
||||
.Select(activity =>
|
||||
{
|
||||
var dto = mapper.Map<ActivityDTO>(activity);
|
||||
|
||||
if (activity is { AlarmTime: not null, EstimatedTime: not null })
|
||||
{
|
||||
var minuteBefore = activity.EstimatedTime.Value - activity.AlarmTime.Value;
|
||||
dto.MinuteBefore = (int)Math.Abs(minuteBefore.TotalMinutes);
|
||||
|
||||
dto.NotificationDate = dto.MinuteBefore == 0 ?
|
||||
activity.EstimatedTime : activity.AlarmTime;
|
||||
}
|
||||
|
||||
if (activity.CodJcom != null)
|
||||
{
|
||||
dto.Category = ActivityCategoryEnum.Commessa;
|
||||
}
|
||||
else
|
||||
{
|
||||
dto.Category = activity.CodAnag != null ? ActivityCategoryEnum.Interna : ActivityCategoryEnum.Memo;
|
||||
}
|
||||
|
||||
if (dto.Category != ActivityCategoryEnum.Memo && activity.CodAnag != null)
|
||||
{
|
||||
string? ragSoc;
|
||||
|
||||
if (distinctUser != null && (distinctUser.TryGetValue(activity.CodAnag, out ragSoc) ||
|
||||
distinctUser.TryGetValue(activity.CodAnag, out ragSoc)))
|
||||
{
|
||||
dto.Cliente = ragSoc;
|
||||
}
|
||||
}
|
||||
|
||||
dto.Commessa = jtbComtList.Find(x => x.CodJcom.Equals(dto.CodJcom));
|
||||
return dto;
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return returnDto;
|
||||
}
|
||||
|
||||
private Task UpdateDbUsers(UsersSyncResponseDTO response)
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
if (response.AnagClie != null)
|
||||
{
|
||||
await localDb.InsertOrUpdate(response.AnagClie);
|
||||
|
||||
if (response.VtbDest != null) await localDb.InsertOrUpdate(response.VtbDest);
|
||||
if (response.VtbCliePersRif != null) await localDb.InsertOrUpdate(response.VtbCliePersRif);
|
||||
}
|
||||
|
||||
if (response.PtbPros != null)
|
||||
{
|
||||
await localDb.InsertOrUpdate(response.PtbPros);
|
||||
|
||||
if (response.PtbProsRif != null) await localDb.InsertOrUpdate(response.PtbProsRif);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Task UpdateDb<T>(List<T>? entityList)
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
if (entityList == null) return;
|
||||
_ = localDb.InsertOrUpdate(entityList);
|
||||
});
|
||||
}
|
||||
|
||||
public Task InsertOrUpdate<T>(List<T> listToSave) =>
|
||||
localDb.InsertOrUpdate(listToSave);
|
||||
|
||||
public Task InsertOrUpdate<T>(T objectToSave) =>
|
||||
localDb.InsertOrUpdate<T>([objectToSave]);
|
||||
|
||||
public async Task DeleteProspect(string codPpro)
|
||||
{
|
||||
var persRifList = await GetTable<PtbProsRif>(x => x.CodPpro!.Equals(codPpro));
|
||||
|
||||
if (!persRifList.IsNullOrEmpty())
|
||||
{
|
||||
foreach (var persRif in persRifList)
|
||||
{
|
||||
await localDb.Delete(persRif);
|
||||
}
|
||||
}
|
||||
|
||||
var ptbPros = (await GetTable<PtbPros>(x => x.CodPpro!.Equals(codPpro))).FirstOrDefault();
|
||||
|
||||
if (ptbPros != null)
|
||||
{
|
||||
await localDb.Delete(ptbPros);
|
||||
}
|
||||
}
|
||||
|
||||
public Task Delete<T>(T objectToDelete) =>
|
||||
localDb.Delete(objectToDelete);
|
||||
|
||||
public async Task DeleteActivity(ActivityDTO activity)
|
||||
{
|
||||
await localDb.Delete(
|
||||
(await GetTable<StbActivity>(x => x.ActivityId.Equals(activity.ActivityId))).Last()
|
||||
);
|
||||
}
|
||||
|
||||
public Task ClearDb() =>
|
||||
localDb.ResetDb();
|
||||
}
|
||||
45
salesbook.Maui/Core/Services/SyncDbService.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using salesbook.Shared.Core.Helpers;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class SyncDbService(IIntegryApiService integryApiService, LocalDbService localDb) : ISyncDbService
|
||||
{
|
||||
public async Task GetAndSaveCommesse(string? dateFilter)
|
||||
{
|
||||
var allCommesse = await integryApiService.RetrieveAllCommesse(dateFilter);
|
||||
|
||||
if (!allCommesse.IsNullOrEmpty())
|
||||
if (dateFilter is null)
|
||||
await localDb.InsertAll(allCommesse!);
|
||||
else
|
||||
await localDb.InsertOrUpdate(allCommesse!);
|
||||
}
|
||||
|
||||
public async Task GetAndSaveSettings(string? dateFilter)
|
||||
{
|
||||
if (dateFilter is not null)
|
||||
await localDb.ResetSettingsDb();
|
||||
|
||||
var settingsResponse = await integryApiService.RetrieveSettings();
|
||||
|
||||
if (!settingsResponse.ActivityResults.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.ActivityResults!);
|
||||
|
||||
if (!settingsResponse.ActivityTypes.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.ActivityTypes!);
|
||||
|
||||
if (!settingsResponse.ActivityTypeUsers.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.ActivityTypeUsers!);
|
||||
|
||||
if (!settingsResponse.StbUsers.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.StbUsers!);
|
||||
|
||||
if (!settingsResponse.VtbTipi.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.VtbTipi!);
|
||||
|
||||
if (!settingsResponse.Nazioni.IsNullOrEmpty())
|
||||
await localDb.InsertAll(settingsResponse.Nazioni!);
|
||||
}
|
||||
}
|
||||
16
salesbook.Maui/Core/System/Network/NetworkService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using salesbook.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface.System.Network;
|
||||
|
||||
namespace salesbook.Maui.Core.System.Network;
|
||||
|
||||
public class NetworkService : INetworkService
|
||||
{
|
||||
public bool ConnectionAvailable { get; set; }
|
||||
|
||||
public bool IsNetworkAvailable()
|
||||
{
|
||||
//return false;
|
||||
return Connectivity.Current.NetworkAccess == NetworkAccess.Internet;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using salesbook.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
using Shiny;
|
||||
using Shiny.Notifications;
|
||||
using Shiny.Push;
|
||||
|
||||
namespace salesbook.Maui.Core.System.Notification;
|
||||
|
||||
public class FirebaseNotificationService(
|
||||
IPushManager pushManager,
|
||||
IIntegryRegisterNotificationRestClient integryRegisterNotificationRestClient,
|
||||
INotificationManager notificationManager
|
||||
) : IFirebaseNotificationService
|
||||
{
|
||||
public async Task InitFirebase()
|
||||
{
|
||||
CreateNotificationChannel();
|
||||
|
||||
var (accessState, token) = await pushManager.RequestAccess();
|
||||
|
||||
if (accessState == AccessState.Denied || token is null) return;
|
||||
await integryRegisterNotificationRestClient.Register(token);
|
||||
}
|
||||
|
||||
private void CreateNotificationChannel()
|
||||
{
|
||||
var channel = new Channel
|
||||
{
|
||||
Identifier = "salesbook_push",
|
||||
Description = "Notifiche push di SalesBook",
|
||||
Importance = ChannelImportance.High,
|
||||
Actions = []
|
||||
};
|
||||
|
||||
notificationManager.AddChannel(channel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using salesbook.Shared.Core.Helpers;
|
||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
using salesbook.Shared.Core.Messages.Notification.NewPush;
|
||||
using Shiny.Push;
|
||||
using System.Text.Json;
|
||||
|
||||
namespace salesbook.Maui.Core.System.Notification.Push;
|
||||
|
||||
public class PushNotificationDelegate(
|
||||
IIntegryRegisterNotificationRestClient integryRegisterNotificationRestClient,
|
||||
IMessenger messenger
|
||||
) : IPushDelegate
|
||||
{
|
||||
public Task OnEntry(PushNotification notification)
|
||||
{
|
||||
// fires when the user taps on a push notification
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnReceived(PushNotification notification)
|
||||
{
|
||||
if (notification.Notification is null) return Task.CompletedTask;
|
||||
var data = notification.Data;
|
||||
|
||||
NotificationDataDTO? notificationDataDto = null;
|
||||
|
||||
if (!data.IsNullOrEmpty())
|
||||
{
|
||||
var json = JsonSerializer.Serialize(data);
|
||||
notificationDataDto = JsonSerializer.Deserialize<NotificationDataDTO>(json);
|
||||
}
|
||||
|
||||
if (notificationDataDto?.NotificationId == null) return Task.CompletedTask;
|
||||
var notificationId = long.Parse(notificationDataDto.NotificationId);
|
||||
|
||||
var pushNotification = new WtbNotification
|
||||
{
|
||||
Id = notificationId,
|
||||
Title = notification.Notification.Title,
|
||||
Body = notification.Notification.Message,
|
||||
NotificationData = notificationDataDto
|
||||
};
|
||||
|
||||
messenger.Send(new NewPushNotificationMessage(pushNotification));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnNewToken(string token)
|
||||
{
|
||||
integryRegisterNotificationRestClient.Register(token);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task OnUnRegistered(string token)
|
||||
{
|
||||
// fires when a push notification change is set by the operating system or provider
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using salesbook.Shared.Core.Interface.System.Notification;
|
||||
using Shiny.Notifications;
|
||||
|
||||
namespace salesbook.Maui.Core.System.Notification;
|
||||
|
||||
public class ShinyNotificationManager(INotificationManager notificationManager) : IShinyNotificationManager
|
||||
{
|
||||
public Task RequestAccess() => notificationManager.RequestAccess();
|
||||
}
|
||||
30
salesbook.Maui/GoogleService-Info.plist
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>API_KEY</key>
|
||||
<string>AIzaSyC_QtQpsVortjzgl-B7__IQZ-85lOct55E</string>
|
||||
<key>GCM_SENDER_ID</key>
|
||||
<string>830771692001</string>
|
||||
<key>PLIST_VERSION</key>
|
||||
<string>1</string>
|
||||
<key>BUNDLE_ID</key>
|
||||
<string>it.integry.salesbook</string>
|
||||
<key>PROJECT_ID</key>
|
||||
<string>salesbook-smetar</string>
|
||||
<key>STORAGE_BUCKET</key>
|
||||
<string>salesbook-smetar.firebasestorage.app</string>
|
||||
<key>IS_ADS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_ANALYTICS_ENABLED</key>
|
||||
<false></false>
|
||||
<key>IS_APPINVITE_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_GCM_ENABLED</key>
|
||||
<true></true>
|
||||
<key>IS_SIGNIN_ENABLED</key>
|
||||
<true></true>
|
||||
<key>GOOGLE_APP_ID</key>
|
||||
<string>1:830771692001:ios:59d8b1d8570ac81f3752a0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
4
salesbook.Maui/ILLink.Descriptors.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="salesbook.Shared" preserve="all" />
|
||||
</linker>
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:local="clr-namespace:Template.Maui"
|
||||
xmlns:shared="clr-namespace:Template.Shared;assembly=Template.Shared"
|
||||
x:Class="Template.Maui.MainPage"
|
||||
xmlns:local="clr-namespace:salesbook.Maui"
|
||||
xmlns:shared="clr-namespace:salesbook.Shared;assembly=salesbook.Shared"
|
||||
x:Class="salesbook.Maui.MainPage"
|
||||
BackgroundColor="{DynamicResource PageBackgroundColor}">
|
||||
|
||||
<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
|
||||
10
salesbook.Maui/MainPage.xaml.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
110
salesbook.Maui/MauiProgram.cs
Normal file
@@ -0,0 +1,110 @@
|
||||
using CommunityToolkit.Maui;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using IntegryApiClient.MAUI;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MudBlazor.Services;
|
||||
using MudExtensions.Services;
|
||||
using salesbook.Maui.Core.RestClient.IntegryApi;
|
||||
using salesbook.Maui.Core.Services;
|
||||
using salesbook.Maui.Core.System.Network;
|
||||
using salesbook.Maui.Core.System.Notification;
|
||||
using salesbook.Maui.Core.System.Notification.Push;
|
||||
using salesbook.Shared;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Dto.PageState;
|
||||
using salesbook.Shared.Core.Helpers;
|
||||
using salesbook.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||
using salesbook.Shared.Core.Interface.System.Network;
|
||||
using salesbook.Shared.Core.Interface.System.Notification;
|
||||
using salesbook.Shared.Core.Messages.Activity.Copy;
|
||||
using salesbook.Shared.Core.Messages.Activity.New;
|
||||
using salesbook.Shared.Core.Messages.Back;
|
||||
using salesbook.Shared.Core.Messages.Contact;
|
||||
using salesbook.Shared.Core.Messages.Notification.Loaded;
|
||||
using salesbook.Shared.Core.Messages.Notification.NewPush;
|
||||
using salesbook.Shared.Core.Services;
|
||||
using Shiny;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public static class MauiProgram
|
||||
{
|
||||
private const string AppToken = "f0484398-1f8b-42f5-ab79-5282c164e1d8";
|
||||
|
||||
public static MauiAppBuilder CreateMauiAppBuilder()
|
||||
{
|
||||
InteractiveRenderSettings.ConfigureBlazorHybridRenderModes();
|
||||
|
||||
var builder = MauiApp.CreateBuilder();
|
||||
builder
|
||||
.UseMauiApp<App>()
|
||||
.UseIntegry(appToken: AppToken, useLoginAzienda: true)
|
||||
.UseMauiCommunityToolkit()
|
||||
.UseShiny()
|
||||
.UseSentry(options =>
|
||||
{
|
||||
options.Dsn = "https://453b6b38f94fd67e40e0d5306d6caff8@o4508499810254848.ingest.de.sentry.io/4509605099667536";
|
||||
#if DEBUG
|
||||
options.Debug = true;
|
||||
#endif
|
||||
options.TracesSampleRate = 1.0;
|
||||
})
|
||||
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); });
|
||||
|
||||
builder.Services.AddMauiBlazorWebView();
|
||||
builder.Services.AddMudServices();
|
||||
builder.Services.AddMudExtensions();
|
||||
|
||||
builder.Services.AddAutoMapper(typeof(MappingProfile));
|
||||
|
||||
builder.Services.AddAuthorizationCore();
|
||||
builder.Services.AddScoped<AppAuthenticationStateProvider>();
|
||||
builder.Services.AddScoped<AuthenticationStateProvider>(provider =>
|
||||
provider.GetRequiredService<AppAuthenticationStateProvider>());
|
||||
|
||||
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
|
||||
builder.Services.AddScoped<ISyncDbService, SyncDbService>();
|
||||
builder.Services.AddScoped<IManageDataService, ManageDataService>();
|
||||
builder.Services.AddScoped<PreloadService>();
|
||||
|
||||
//SessionData
|
||||
builder.Services.AddSingleton<JobSteps>();
|
||||
builder.Services.AddSingleton<UserPageState>();
|
||||
builder.Services.AddSingleton<UserListState>();
|
||||
builder.Services.AddSingleton<NotificationState>();
|
||||
builder.Services.AddSingleton<FilterUserDTO>();
|
||||
|
||||
//Message
|
||||
builder.Services.AddSingleton<IMessenger, WeakReferenceMessenger>();
|
||||
builder.Services.AddSingleton<NewActivityService>();
|
||||
builder.Services.AddSingleton<BackNavigationService>();
|
||||
builder.Services.AddSingleton<CopyActivityService>();
|
||||
builder.Services.AddSingleton<NewContactService>();
|
||||
builder.Services.AddSingleton<NotificationsLoadedService>();
|
||||
builder.Services.AddSingleton<NewPushNotificationService>();
|
||||
|
||||
//Notification
|
||||
builder.Services.AddNotifications();
|
||||
builder.Services.AddPush<PushNotificationDelegate>();
|
||||
builder.Services.AddSingleton<IIntegryRegisterNotificationRestClient, IntegryRegisterNotificationRestClient>();
|
||||
builder.Services.AddSingleton<IIntegryNotificationRestClient, IntegryNotificationRestClient>();
|
||||
builder.Services.AddSingleton<IFirebaseNotificationService, FirebaseNotificationService>();
|
||||
builder.Services.AddSingleton<IShinyNotificationManager, ShinyNotificationManager>();
|
||||
builder.Services.AddSingleton<INotificationService, NotificationService>();
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
builder.Logging.AddDebug();
|
||||
#endif
|
||||
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
||||
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
||||
builder.Services.AddSingleton<LocalDbService>();
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
salesbook.Maui/Platforms/Android/AndroidManifest.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="it.integry.salesbook">
|
||||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true">
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
|
||||
<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
<category android:name="${applicationId}" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.BATTERY_STATS" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
</manifest>
|
||||
13
salesbook.Maui/Platforms/Android/AndroidModule.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using salesbook.Maui.Core;
|
||||
using salesbook.Shared.Core.Interface.System.Battery;
|
||||
|
||||
namespace salesbook.Maui;
|
||||
|
||||
public static class AndroidModule
|
||||
{
|
||||
public static MauiAppBuilder RegisterAndroidAppServices(this MauiAppBuilder mauiAppBuilder)
|
||||
{
|
||||
mauiAppBuilder.Services.AddSingleton<IBatteryOptimizationManagerService, BatteryOptimizationManagerService>();
|
||||
return mauiAppBuilder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Provider;
|
||||
using salesbook.Shared.Core.Interface.System.Battery;
|
||||
using Application = Android.App.Application;
|
||||
|
||||
namespace salesbook.Maui.Core;
|
||||
|
||||
public class BatteryOptimizationManagerService : IBatteryOptimizationManagerService
|
||||
{
|
||||
public bool IsBatteryOptimizationEnabled()
|
||||
{
|
||||
var packageName = AppInfo.PackageName;
|
||||
|
||||
var pm = (PowerManager)Application.Context.GetSystemService(Context.PowerService)!;
|
||||
return !pm.IsIgnoringBatteryOptimizations(packageName);
|
||||
}
|
||||
|
||||
public void OpenBatteryOptimizationSettings(Action<bool> onCompleted)
|
||||
{
|
||||
var packageName = AppInfo.PackageName;
|
||||
|
||||
var intent = new Intent(Settings.ActionRequestIgnoreBatteryOptimizations);
|
||||
intent.SetData(Android.Net.Uri.Parse("package:" + packageName));
|
||||
((MainActivity)Platform.CurrentActivity!).StartActivityForResult(intent, (result, _) => { onCompleted(result == Result.Ok); });
|
||||
}
|
||||
}
|
||||
42
salesbook.Maui/Platforms/Android/MainActivity.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Activity(
|
||||
Theme = "@style/Maui.SplashTheme",
|
||||
MainLauncher = true,
|
||||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode |
|
||||
ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
||||
|
||||
[IntentFilter(
|
||||
[
|
||||
Shiny.ShinyPushIntents.NotificationClickAction
|
||||
],
|
||||
Categories =
|
||||
[
|
||||
"android.intent.category.DEFAULT"
|
||||
]
|
||||
)]
|
||||
public class MainActivity : MauiAppCompatActivity
|
||||
{
|
||||
private readonly IDictionary<int, Action<Result, Intent>> _onActivityResultSubscriber =
|
||||
new Dictionary<int, Action<Result, Intent>>();
|
||||
|
||||
public void StartActivityForResult(Intent intent, Action<Result, Intent> onResultAction)
|
||||
{
|
||||
var requestCode = new Random(DateTime.Now.Millisecond).Next();
|
||||
_onActivityResultSubscriber.Add(requestCode, onResultAction);
|
||||
StartActivityForResult(intent, requestCode);
|
||||
}
|
||||
|
||||
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
|
||||
{
|
||||
if (_onActivityResultSubscriber.TryGetValue(requestCode, out var value))
|
||||
value(resultCode, data);
|
||||
|
||||
base.OnActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
16
salesbook.Maui/Platforms/Android/MainApplication.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace salesbook.Maui;
|
||||
|
||||
[Application(HardwareAccelerated = true)]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
{
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiAppBuilder()
|
||||
.RegisterAndroidAppServices().Build();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#dff2ff</color>
|
||||
<color name="colorPrimaryDark">#00a0de</color>
|
||||
<color name="colorAccent">#00a0de</color>
|
||||
</resources>
|
||||
@@ -1,6 +1,7 @@
|
||||
using Foundation;
|
||||
using salesbook.Maui;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
@@ -1,7 +1,7 @@
|
||||
using ObjCRuntime;
|
||||
using UIKit;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
24
salesbook.Maui/Platforms/iOS/AppDelegate.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Foundation;
|
||||
using UIKit;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
{
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiAppBuilder()
|
||||
.RegisterIosAppServices().Build();
|
||||
|
||||
[Export("application:didRegisterForRemoteNotificationsWithDeviceToken:")]
|
||||
public void RegisteredForRemoteNotifications(UIApplication application, NSData deviceToken)
|
||||
=> global::Shiny.Hosting.Host.Lifecycle.OnRegisteredForRemoteNotifications(deviceToken);
|
||||
|
||||
[Export("application:didFailToRegisterForRemoteNotificationsWithError:")]
|
||||
public void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
|
||||
=> global::Shiny.Hosting.Host.Lifecycle.OnFailedToRegisterForRemoteNotifications(error);
|
||||
|
||||
[Export("application:didReceiveRemoteNotification:fetchCompletionHandler:")]
|
||||
public void DidReceiveRemoteNotification(UIApplication application, NSDictionary userInfo, Action<UIBackgroundFetchResult> completionHandler)
|
||||
=> global::Shiny.Hosting.Host.Lifecycle.OnDidReceiveRemoteNotification(userInfo, completionHandler);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using salesbook.Shared.Core.Interface.System.Battery;
|
||||
|
||||
namespace salesbook.Maui.Core;
|
||||
|
||||
public class BatteryOptimizationManagerService : IBatteryOptimizationManagerService
|
||||
{
|
||||
public bool IsBatteryOptimizationEnabled() => true;
|
||||
|
||||
public void OpenBatteryOptimizationSettings(Action<bool> onCompleted)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -35,5 +35,22 @@
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>L'app utilizza la tua posizione per allegarla alle attività.</string>
|
||||
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Questa app necessita di accedere alla fotocamera per scattare foto.</string>
|
||||
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
<string>Questa app necessita di accedere alla libreria foto.</string>
|
||||
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>Permette all'app di salvare file o immagini nella tua libreria fotografica se necessario.</string>
|
||||
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
110
salesbook.Maui/Platforms/iOS/PrivacyInfo.xcprivacy
Normal file
@@ -0,0 +1,110 @@
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPITypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>C617.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>35F9.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>E174.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyAccessedAPIType</key>
|
||||
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array>
|
||||
<!--user info-->
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataTypeUserID</key>
|
||||
<string>NSPrivacyCollectedDataTypeLocation</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataTypeEmailAddress</key>
|
||||
<string>NSPrivacyCollectedDataTypeLocation</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataTypePhoneNumber</key>
|
||||
<string>NSPrivacyCollectedDataTypeLocation</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
|
||||
<!--crashlytics/analytics-->
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeOtherDiagnosticData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeCrashData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<true />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using UIKit;
|
||||
|
||||
namespace Template.Maui
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
13
salesbook.Maui/Platforms/iOS/iOSModule.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using salesbook.Maui.Core;
|
||||
using salesbook.Shared.Core.Interface.System.Battery;
|
||||
|
||||
namespace salesbook.Maui;
|
||||
|
||||
public static class iOSModule
|
||||
{
|
||||
public static MauiAppBuilder RegisterIosAppServices(this MauiAppBuilder mauiAppBuilder)
|
||||
{
|
||||
mauiAppBuilder.Services.AddSingleton<IBatteryOptimizationManagerService, BatteryOptimizationManagerService>();
|
||||
return mauiAppBuilder;
|
||||
}
|
||||
}
|
||||
1
salesbook.Maui/Resources/AppIcon/appicon.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 230" width="230" height="230"><style>.a{fill:#dff2ff}</style><path fill-rule="evenodd" class="a" d="m230 0v230h-230v-230z"/></svg>
|
||||
|
After Width: | Height: | Size: 201 B |
1
salesbook.Maui/Resources/AppIcon/appiconfg.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 230 230" width="230" height="230"><style>.a{fill:none;stroke:#002339;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}.b{fill:none;stroke:#00a0de;stroke-linecap:round;stroke-linejoin:round;stroke-width:16}</style><path fill-rule="evenodd" class="a" d="m119.9 71.4h34.4c20.3 0 36.8 16.5 36.8 36.9v28.3c0 20.4-16.5 36.9-36.8 36.9h-5.1l0.1 32.2-34.7-32.2h-72.2"/><path fill-rule="evenodd" class="b" d="m117.3 24l-77.1 47.4v102.1l77.1-47.4v-102.1z"/></svg>
|
||||
|
After Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
40
salesbook.Maui/Resources/Splash/splash.svg
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Livello_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 570.53 425.62">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
stroke: #002339;
|
||||
}
|
||||
|
||||
.cls-1, .cls-2 {
|
||||
fill: none;
|
||||
stroke-linecap: round;
|
||||
stroke-linejoin: round;
|
||||
stroke-width: 17px;
|
||||
}
|
||||
|
||||
.cls-3 {
|
||||
fill: #002339;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
stroke: #00a0de;
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<g>
|
||||
<path class="cls-3" d="M71.66,322.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
|
||||
<path class="cls-3" d="M137.34,316.75c-1.29-1.34-2.78-2.47-4.51-3.36-2.63-1.34-5.57-2.02-8.83-2.02-4.29,0-8.11,1.06-11.48,3.17s-6,4.99-7.92,8.64c-1.92,3.65-2.88,7.78-2.88,12.39s.96,8.64,2.88,12.29c1.92,3.65,4.56,6.53,7.92,8.64,3.36,2.11,7.15,3.17,11.38,3.17,3.33,0,6.32-.67,8.98-2.02,1.73-.87,3.2-1.99,4.46-3.31v4.37h12.68v-46.38h-12.68v4.42ZM134.85,344.5c-2.18,2.37-5.03,3.55-8.55,3.55-2.24,0-4.26-.54-6.05-1.63-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4.03-1.49-6.53s.5-4.58,1.49-6.43c.99-1.86,2.37-3.33,4.13-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.42.53,6.15,1.58c1.73,1.06,3.1,2.54,4.13,4.46,1.02,1.92,1.54,4.1,1.54,6.53,0,3.59-1.09,6.56-3.27,8.93Z"/>
|
||||
<rect class="cls-3" x="164.81" y="289.28" width="12.58" height="69.43"/>
|
||||
<path class="cls-3" d="M225.49,314.25c-3.46-1.98-7.36-2.98-11.71-2.98-4.61,0-8.77,1.06-12.48,3.17-3.71,2.11-6.64,4.99-8.79,8.64-2.15,3.65-3.22,7.78-3.22,12.39s1.09,8.83,3.27,12.48c2.18,3.65,5.17,6.53,8.98,8.64,3.81,2.11,8.15,3.17,13.01,3.17,3.78,0,7.26-.67,10.47-2.02,3.2-1.34,5.98-3.36,8.35-6.05l-7.49-7.49c-1.41,1.67-3.07,2.88-4.99,3.65-1.92.77-4.07,1.15-6.43,1.15-2.63,0-4.93-.54-6.91-1.63-1.99-1.09-3.5-2.67-4.56-4.75-.42-.82-.73-1.72-.98-2.65l33.87-.08c.26-1.02.42-1.97.48-2.83.06-.86.1-1.71.1-2.54,0-4.48-.96-8.48-2.88-12-1.92-3.52-4.61-6.27-8.07-8.26ZM207.15,323.47c1.86-1.09,4.03-1.63,6.53-1.63,2.37,0,4.35.48,5.95,1.44,1.6.96,2.85,2.37,3.75,4.23.43.89.76,1.89,1,2.99l-22.38.06c.23-.86.51-1.68.88-2.43.99-2.02,2.42-3.57,4.27-4.66Z"/>
|
||||
<path class="cls-3" d="M260.64,322.8c.96-.58,2.4-.86,4.32-.86s3.86.4,5.62,1.2c1.76.8,3.34,2.03,4.75,3.7l7.59-7.68c-2.05-2.69-4.63-4.69-7.73-6-3.11-1.31-6.58-1.97-10.42-1.97s-6.82.59-9.51,1.78c-2.69,1.18-4.77,2.88-6.24,5.09-1.47,2.21-2.21,4.79-2.21,7.73s.58,5.12,1.73,6.91c1.15,1.79,2.61,3.18,4.37,4.18,1.76.99,3.63,1.78,5.62,2.35,1.98.58,3.86,1.12,5.62,1.63,1.76.51,3.22,1.1,4.37,1.78,1.15.67,1.73,1.65,1.73,2.93,0,1.09-.54,1.94-1.63,2.54-1.09.61-2.66.91-4.71.91-2.5,0-4.8-.45-6.91-1.34-2.11-.9-3.94-2.27-5.47-4.13l-7.59,7.59c1.54,1.79,3.36,3.35,5.47,4.66,2.11,1.31,4.43,2.3,6.96,2.98,2.53.67,5.14,1.01,7.83,1.01,5.57,0,9.99-1.33,13.25-3.99,3.26-2.66,4.9-6.26,4.9-10.8,0-2.82-.56-5.12-1.68-6.91-1.12-1.79-2.56-3.23-4.32-4.32-1.76-1.09-3.62-1.94-5.57-2.54-1.95-.61-3.83-1.17-5.62-1.68-1.79-.51-3.23-1.07-4.32-1.68-1.09-.61-1.63-1.49-1.63-2.64,0-1.02.48-1.82,1.44-2.4Z"/>
|
||||
<path class="cls-3" d="M331.93,314.54c-3.43-2.11-7.28-3.17-11.57-3.17-3.26,0-6.26.69-8.98,2.06-1.58.8-2.96,1.79-4.18,2.93v-27.08h-12.58v69.43h12.48v-4.15c1.23,1.2,2.62,2.23,4.23,3.05,2.69,1.38,5.7,2.06,9.03,2.06,4.29,0,8.13-1.06,11.52-3.17,3.39-2.11,6.06-4.99,8.02-8.64,1.95-3.65,2.93-7.75,2.93-12.29s-.96-8.74-2.88-12.39c-1.92-3.65-4.59-6.53-8.02-8.64ZM328.38,342c-.99,1.86-2.35,3.33-4.08,4.42-1.73,1.09-3.74,1.63-6.05,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.17-2.56-4.13-4.42-.96-1.86-1.44-4-1.44-6.43s.48-4.67,1.44-6.53c.96-1.86,2.32-3.33,4.08-4.42,1.76-1.09,3.79-1.63,6.1-1.63s4.34.54,6.1,1.63c1.76,1.09,3.14,2.58,4.13,4.46.99,1.89,1.49,4.02,1.49,6.39,0,2.5-.5,4.67-1.49,6.53Z"/>
|
||||
<path class="cls-3" d="M389.26,314.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM387.05,341.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
|
||||
<path class="cls-3" d="M447.74,314.44c-3.75-2.11-7.99-3.17-12.72-3.17s-8.88,1.07-12.63,3.22c-3.75,2.15-6.71,5.03-8.88,8.64-2.18,3.62-3.27,7.7-3.27,12.24s1.09,8.75,3.27,12.44c2.18,3.68,5.14,6.59,8.88,8.74,3.74,2.15,7.95,3.22,12.63,3.22s8.99-1.07,12.77-3.22c3.78-2.14,6.75-5.07,8.93-8.79,2.18-3.71,3.26-7.84,3.26-12.39s-1.1-8.64-3.31-12.29c-2.21-3.65-5.19-6.53-8.93-8.64ZM445.53,341.9c-.99,1.86-2.4,3.33-4.23,4.42-1.82,1.09-3.92,1.63-6.29,1.63s-4.35-.54-6.15-1.63c-1.79-1.09-3.19-2.56-4.18-4.42-.99-1.86-1.49-4-1.49-6.43s.5-4.58,1.49-6.43c.99-1.86,2.38-3.31,4.18-4.37,1.79-1.06,3.84-1.58,6.15-1.58s4.43.53,6.19,1.58c1.76,1.06,3.17,2.51,4.23,4.37,1.06,1.86,1.58,4,1.58,6.43s-.5,4.58-1.49,6.43Z"/>
|
||||
<polygon class="cls-3" points="516.64 358.71 497.56 334.39 515.77 312.33 501.18 312.33 484.37 333.58 484.37 289.28 471.79 289.28 471.79 358.71 484.37 358.71 484.37 336.08 501.27 358.71 516.64 358.71"/>
|
||||
</g>
|
||||
<g>
|
||||
<path class="cls-1" d="M288.72,101.41h36.59c21.62,0,39.14,17.52,39.14,39.14v30.15c0,21.62-17.52,39.14-39.14,39.14h-5.37l.07,34.31-36.88-34.31h-77.99"/>
|
||||
<polygon class="cls-2" points="285.99 51.02 204.08 101.41 204.08 209.84 285.99 159.45 285.99 51.02"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.1 KiB |
29
salesbook.Maui/google-services.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "830771692001",
|
||||
"project_id": "salesbook-smetar",
|
||||
"storage_bucket": "salesbook-smetar.firebasestorage.app"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:830771692001:android:06bc5a9706bc9bef3752a0",
|
||||
"android_client_info": {
|
||||
"package_name": "it.integry.salesbook"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyB43ai_Ph0phO_OkBC1wAOazKZUV9KsLaM"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
|
||||
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Template.Maui</RootNamespace>
|
||||
<RootNamespace>salesbook.Maui</RootNamespace>
|
||||
<UseMaui>true</UseMaui>
|
||||
<SingleProject>true</SingleProject>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
@@ -23,14 +23,14 @@
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<!-- Display name -->
|
||||
<ApplicationTitle>Template.Maui</ApplicationTitle>
|
||||
<ApplicationTitle>salesbook</ApplicationTitle>
|
||||
|
||||
<!-- App Identifier -->
|
||||
<ApplicationId>it.integry.template.maui</ApplicationId>
|
||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>1</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>2.0.1</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>7</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
@@ -79,25 +79,49 @@
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
|
||||
<CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey>
|
||||
<CodesignProvision>VS: WildCard Development</CodesignProvision>
|
||||
<CodesignProvision>VS: it.integry.salesbook Development</CodesignProvision>
|
||||
<ProvisioningType>manual</ProvisioningType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
<ItemGroup Condition="$(TargetFramework.Contains('-ios'))">
|
||||
<!--
|
||||
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
||||
|
||||
<CustomEntitlements Include="keychain-access-groups" Type="StringArray" Value="%24(AppIdentifierPrefix)$(ApplicationId)" Visible="false" />
|
||||
// For scheduled notifications, you need to setup "Time Sensitive Notifications" in the Apple Developer Portal for your app provisioning and uncomment below
|
||||
// <CustomEntitlements Include="com.apple.developer.usernotifications.time-sensitive" Type="Boolean" Value="true" Visible="false" />
|
||||
-->
|
||||
<CustomEntitlements Include="aps-environment" Type="string" Value="development" Condition="'$(Configuration)' == 'Debug'" Visible="false" />
|
||||
<CustomEntitlements Include="aps-environment" Type="string" Value="production" Condition="'$(Configuration)' == 'Release'" Visible="false" />
|
||||
-->
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
||||
<!-- Android App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
|
||||
<!-- ios App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- App Icon -->
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
|
||||
<BlazorWebAssemblyLazyLoad Include="salesbook.Shared.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<RunAOTCompilation>true</RunAOTCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="salesbook.Shared" RootMode="All" />
|
||||
<TrimmerRootDescriptor Include="ILLink.Descriptors.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Splash Screen -->
|
||||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
|
||||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#dff2ff" BaseSize="128,128" />
|
||||
|
||||
<!-- Images -->
|
||||
<MauiImage Include="Resources\Images\*" />
|
||||
@@ -110,20 +134,34 @@
|
||||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
||||
<GoogleServicesJson Include="google-services.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</GoogleServicesJson>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
|
||||
<BundleResource Include="GoogleService-Info.plist" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="11.2.0" />
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.1.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.70" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.70" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.70" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.5" />
|
||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.2.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.110" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.110" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.110" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
|
||||
<PackageReference Include="Sentry.Maui" Version="5.15.0" />
|
||||
<PackageReference Include="Shiny.Hosting.Maui" Version="3.3.4" />
|
||||
<PackageReference Include="Shiny.Notifications" Version="3.3.4" />
|
||||
<PackageReference Include="Shiny.Push" Version="3.3.4" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Template.Shared\Template.Shared.csproj" />
|
||||
<ProjectReference Include="..\salesbook.Shared\salesbook.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
60
salesbook.Maui/wwwroot/index.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"/>
|
||||
<title>salesbook.Maui</title>
|
||||
<base href="/"/>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
|
||||
|
||||
<link href="_content/salesbook.Shared/css/bootstrap/bootstrap.min.css" rel="stylesheet">
|
||||
<link href="_content/salesbook.Shared/css/bootstrap/bootstrap-icons.min.css" rel="stylesheet"/>
|
||||
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet"/>
|
||||
<link href="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.css" rel="stylesheet"/>
|
||||
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/remixicon/remixicon.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/app.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/form.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/bottomSheet.css"/>
|
||||
<link rel="stylesheet" href="_content/salesbook.Shared/css/default-theme.css"/>
|
||||
<link rel="stylesheet" href="salesbook.Maui.styles.css"/>
|
||||
<link rel="icon" type="image/png" href="favicon.png"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="status-bar-safe-area"></div>
|
||||
|
||||
<div id="app">
|
||||
<div class="spinner-container">
|
||||
<span class="loader"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="blazor-error-ui">
|
||||
An unhandled error has occurred.
|
||||
<a href="" class="reload">Reload</a>
|
||||
<a class="dismiss">🗙</a>
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.webview.js" autostart="false"></script>
|
||||
<script src="_content/salesbook.Shared/js/bootstrap/bootstrap.bundle.min.js"></script>
|
||||
<!-- Add chart.js reference if chart components are used in your application. -->
|
||||
<!--<script src="_content/salesbook.Shared/js/bootstrap/chart.umd.js" integrity="sha512-gQhCDsnnnUfaRzD8k1L5llCCV6O9HN09zClIzzeJ8OJ9MpGmIlCxm+pdCkqTwqJ4JcjbojFr79rl2F1mzcoLMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add chartjs-plugin-datalabels.min.js reference if chart components with data label feature is used in your application. -->
|
||||
<!--<script src="_content/salesbook.Shared/js/bootstrap/chartjs-plugin-datalabels.min.js" integrity="sha512-JPcRR8yFa8mmCsfrw4TNte1ZvF1e3+1SdGMslZvmrzDYxS69J7J49vkFL8u6u8PlPJK+H3voElBtUCzaXj+6ig==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>-->
|
||||
<!-- Add sortable.js reference if SortableList component is used in your application. -->
|
||||
<!--<script src="_content/salesbook.Shared/js/bootstrap/Sortable.min.js"></script>-->
|
||||
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
|
||||
<script src="_content/CodeBeam.MudBlazor.Extensions/MudExtensions.min.js"></script>
|
||||
<script src="_content/salesbook.Shared/js/main.js"></script>
|
||||
<script src="_content/salesbook.Shared/js/calendar.js"></script>
|
||||
<script src="_content/salesbook.Shared/js/alphaScroll.js"></script>
|
||||
<script src="_content/salesbook.Shared/js/notifications.js"></script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
26
salesbook.Shared/Components/Layout/ConnectionState.razor
Normal file
@@ -0,0 +1,26 @@
|
||||
<div class="Connection @(ShowWarning ? "Show" : "Hide") @(IsNetworkAvailable? ServicesIsDown ? "ServicesIsDown" : "SystemOk" : "NetworkKo")">
|
||||
@if (IsNetworkAvailable)
|
||||
{
|
||||
if(ServicesIsDown)
|
||||
{
|
||||
<i class="ri-cloud-off-fill"></i>
|
||||
<span>Servizi offline</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="ri-cloud-fill"></i>
|
||||
<span>Online</span>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="ri-wifi-off-line"></i>
|
||||
<span>Nessuna connessione</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code{
|
||||
[Parameter] public bool IsNetworkAvailable { get; set; }
|
||||
[Parameter] public bool ServicesIsDown { get; set; }
|
||||
[Parameter] public bool ShowWarning { get; set; }
|
||||
}
|
||||
103
salesbook.Shared/Components/Layout/HeaderLayout.razor
Normal file
@@ -0,0 +1,103 @@
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<div class="@(Back ? "" : "container") header">
|
||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||
@if (!SmallHeader)
|
||||
{
|
||||
@if (Back)
|
||||
{
|
||||
<div class="left-section">
|
||||
<MudButton StartIcon="@(!Cancel ? Icons.Material.Outlined.ArrowBackIosNew : "")"
|
||||
OnClick="GoBack"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@BackTo
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
|
||||
<h3 class="page-title">@Title</h3>
|
||||
|
||||
<div class="right-section">
|
||||
@if (LabelSave.IsNullOrEmpty())
|
||||
{
|
||||
@if (ShowFilter)
|
||||
{
|
||||
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
|
||||
}
|
||||
|
||||
@* @if (ShowCalendarToggle)
|
||||
{
|
||||
<MudIconButton OnClick="OnCalendarToggle" Icon="@Icons.Material.Filled.CalendarMonth" Color="Color.Dark"/>
|
||||
} *@
|
||||
|
||||
@if (ShowProfile)
|
||||
{
|
||||
<MudIconButton Class="user" OnClick="OpenPersonalInfo" Icon="@Icons.Material.Filled.Person"/>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudButton OnClick="OnSave"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@LabelSave
|
||||
</MudButton>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>@Title</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => GoBack()" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code{
|
||||
[Parameter] public string? Title { get; set; }
|
||||
[Parameter] public bool ShowFilter { get; set; }
|
||||
[Parameter] public bool ShowProfile { get; set; } = true;
|
||||
[Parameter] public bool Back { get; set; }
|
||||
[Parameter] public bool BackOnTop { get; set; }
|
||||
[Parameter] public string BackTo { get; set; } = "";
|
||||
|
||||
[Parameter] public EventCallback OnFilterToggle { get; set; }
|
||||
|
||||
[Parameter] public bool Cancel { get; set; }
|
||||
[Parameter] public EventCallback OnCancel { get; set; }
|
||||
[Parameter] public string? LabelSave { get; set; }
|
||||
[Parameter] public EventCallback OnSave { get; set; }
|
||||
|
||||
[Parameter] public bool ShowCalendarToggle { get; set; }
|
||||
[Parameter] public EventCallback OnCalendarToggle { get; set; }
|
||||
|
||||
[Parameter] public bool SmallHeader { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
Back = !Back ? !Back && Cancel : Back;
|
||||
BackTo = Cancel ? "Annulla" : BackTo;
|
||||
}
|
||||
|
||||
private async Task GoBack()
|
||||
{
|
||||
if (Cancel)
|
||||
{
|
||||
await OnCancel.InvokeAsync();
|
||||
return;
|
||||
}
|
||||
|
||||
await JS.InvokeVoidAsync("goBack");
|
||||
}
|
||||
|
||||
private void OpenPersonalInfo() =>
|
||||
NavigationManager.NavigateTo("/PersonalInfo");
|
||||
|
||||
}
|
||||
@@ -1,4 +1,12 @@
|
||||
.header {
|
||||
min-height: var(--mh-header);
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
width: 100%;
|
||||
line-height: normal;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -6,6 +14,8 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-content > .title { width: 100%; }
|
||||
|
||||
.header-content.with-back .page-title {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
@@ -14,8 +24,6 @@
|
||||
font-size: larger;
|
||||
}
|
||||
|
||||
.right-section { min-height: 45px; }
|
||||
|
||||
.left-section ::deep button, .right-section ::deep button { font-size: 1.1rem; }
|
||||
|
||||
.left-section ::deep .mud-button-icon-start { margin-right: 3px !important; }
|
||||
177
salesbook.Shared/Components/Layout/MainLayout.razor
Normal file
@@ -0,0 +1,177 @@
|
||||
@using System.Globalization
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Core.Messages.Back
|
||||
@inherits LayoutComponentBase
|
||||
@inject IJSRuntime JS
|
||||
@inject BackNavigationService BackService
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
|
||||
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
|
||||
<MudPopoverProvider/>
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
|
||||
<ConnectionState IsNetworkAvailable="IsNetworkAvailable" ServicesIsDown="ServicesIsDown" ShowWarning="ShowWarning" />
|
||||
|
||||
<div class="page">
|
||||
<NavMenu/>
|
||||
|
||||
<main>
|
||||
<article>
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private MudThemeProvider? _mudThemeProvider;
|
||||
private bool IsDarkMode { get; set; }
|
||||
private string _mainContentClass = "";
|
||||
|
||||
//Connection state
|
||||
private bool _isNetworkAvailable;
|
||||
private bool _servicesIsDown;
|
||||
private bool _showWarning;
|
||||
|
||||
private DateTime _lastApiCheck = DateTime.MinValue;
|
||||
private const int DelaySeconds = 90;
|
||||
|
||||
private CancellationTokenSource? _cts;
|
||||
|
||||
private bool ServicesIsDown
|
||||
{
|
||||
get => _servicesIsDown;
|
||||
set
|
||||
{
|
||||
if (_servicesIsDown == value) return;
|
||||
_servicesIsDown = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsNetworkAvailable
|
||||
{
|
||||
get => _isNetworkAvailable;
|
||||
set
|
||||
{
|
||||
if (_isNetworkAvailable == value) return;
|
||||
_isNetworkAvailable = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShowWarning
|
||||
{
|
||||
get => _showWarning;
|
||||
set
|
||||
{
|
||||
if (_showWarning == value) return;
|
||||
_showWarning = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly MudTheme _currentTheme = new()
|
||||
{
|
||||
PaletteLight = new PaletteLight()
|
||||
{
|
||||
Primary = "#00a0de",
|
||||
Secondary = "#002339",
|
||||
Tertiary = "#dff2ff",
|
||||
TextPrimary = "#000"
|
||||
},
|
||||
PaletteDark = new PaletteDark
|
||||
{
|
||||
Primary = "#00a0de",
|
||||
Secondary = "#002339",
|
||||
Tertiary = "#dff2ff",
|
||||
Surface = "#000406",
|
||||
Background = "#000406",
|
||||
TextPrimary = "#fff",
|
||||
GrayDark = "#E0E0E0"
|
||||
}
|
||||
};
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
// if (firstRender)
|
||||
// {
|
||||
// var isDarkMode = LocalStorage.GetString("isDarkMode");
|
||||
|
||||
// if (isDarkMode == null && _mudThemeProvider != null)
|
||||
// {
|
||||
// IsDarkMode = await _mudThemeProvider.GetSystemPreference();
|
||||
// await _mudThemeProvider.WatchSystemPreference(OnSystemPreferenceChanged);
|
||||
// LocalStorage.SetString("isDarkMode", IsDarkMode.ToString());
|
||||
// StateHasChanged();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// IsDarkMode = bool.Parse(isDarkMode!);
|
||||
// }
|
||||
|
||||
// if (IsDarkMode)
|
||||
// {
|
||||
// _mainContentClass += "is-dark";
|
||||
// StateHasChanged();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
private async Task OnSystemPreferenceChanged(bool newValue)
|
||||
{
|
||||
IsDarkMode = newValue;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_cts = new CancellationTokenSource();
|
||||
_ = CheckConnectionState(_cts.Token);
|
||||
|
||||
BackService.OnHardwareBack += async () => { await JS.InvokeVoidAsync("goBack"); };
|
||||
|
||||
var culture = new CultureInfo("it-IT", false);
|
||||
|
||||
CultureInfo.CurrentCulture = culture;
|
||||
CultureInfo.CurrentUICulture = culture;
|
||||
}
|
||||
|
||||
private Task CheckConnectionState(CancellationToken token)
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
while (!token.IsCancellationRequested)
|
||||
{
|
||||
var isNetworkAvailable = NetworkService.IsNetworkAvailable();
|
||||
var servicesDown = ServicesIsDown;
|
||||
|
||||
if (isNetworkAvailable && (DateTime.UtcNow - _lastApiCheck).TotalSeconds >= DelaySeconds)
|
||||
{
|
||||
servicesDown = !await IntegryApiService.SystemOk();
|
||||
_lastApiCheck = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
await InvokeAsync(async () =>
|
||||
{
|
||||
IsNetworkAvailable = isNetworkAvailable;
|
||||
ServicesIsDown = servicesDown;
|
||||
|
||||
await Task.Delay(1500, token);
|
||||
ShowWarning = !(IsNetworkAvailable && !ServicesIsDown);
|
||||
NetworkService.ConnectionAvailable = !ShowWarning;
|
||||
});
|
||||
|
||||
await Task.Delay(500, token);
|
||||
}
|
||||
}, token);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_cts?.Cancel();
|
||||
_cts?.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
130
salesbook.Shared/Components/Layout/NavMenu.razor
Normal file
@@ -0,0 +1,130 @@
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Core.Messages.Activity.Copy
|
||||
@using salesbook.Shared.Core.Messages.Activity.New
|
||||
@using salesbook.Shared.Core.Messages.Contact
|
||||
@using salesbook.Shared.Core.Messages.Notification.Loaded
|
||||
@using salesbook.Shared.Core.Messages.Notification.NewPush
|
||||
@inject IDialogService Dialog
|
||||
@inject IMessenger Messenger
|
||||
@inject CopyActivityService CopyActivityService
|
||||
@inject NewPushNotificationService NewPushNotificationService
|
||||
@inject NotificationState Notification
|
||||
@inject INetworkService NetworkService
|
||||
@inject NotificationsLoadedService NotificationsLoadedService
|
||||
|
||||
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
<nav class="navbar @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||
<div class="container-navbar">
|
||||
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Users" Match="NavLinkMatch.All">
|
||||
<div class="d-flex flex-column">
|
||||
<i class="ri-group-line"></i>
|
||||
<span>Contatti</span>
|
||||
</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Calendar" Match="NavLinkMatch.All">
|
||||
<div class="d-flex flex-column">
|
||||
<i class="ri-calendar-todo-line"></i>
|
||||
<span>Agenda</span>
|
||||
</div>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<MudBadge Content="Notification.Count" Visible="Notification.Count > 0" Color="Color.Error" Overlap="true">
|
||||
<NavLink class="nav-link" href="Notifications" Match="NavLinkMatch.All">
|
||||
<div class="d-flex flex-column">
|
||||
<i class="ri-notification-4-line"></i>
|
||||
<span>Notifiche</span>
|
||||
</div>
|
||||
</NavLink>
|
||||
</MudBadge>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@if (PlusVisible)
|
||||
{
|
||||
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
||||
<ActivatorContent>
|
||||
<MudFab Class="custom-plus-button" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium" IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add"/>
|
||||
</ActivatorContent>
|
||||
<ChildContent>
|
||||
<MudMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
|
||||
<MudMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
|
||||
</ChildContent>
|
||||
</MudMenu>
|
||||
}
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@code
|
||||
{
|
||||
private bool IsVisible { get; set; } = true;
|
||||
private bool PlusVisible { get; set; } = true;
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
InitMessage();
|
||||
|
||||
NavigationManager.LocationChanged += (_, args) =>
|
||||
{
|
||||
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
||||
|
||||
var newIsVisible = new List<string> { "Calendar", "Users", "Notifications", "Commessa" }
|
||||
.Contains(location);
|
||||
|
||||
var newPlusVisible = new List<string> { "Calendar", "Users", "Commessa" }
|
||||
.Contains(location);
|
||||
|
||||
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
|
||||
|
||||
IsVisible = newIsVisible;
|
||||
PlusVisible = newPlusVisible;
|
||||
StateHasChanged();
|
||||
};
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task CreateActivity() => CreateActivity(null);
|
||||
|
||||
private async Task CreateActivity(ActivityDTO? activity)
|
||||
{
|
||||
var result = await ModalHelpers.OpenActivityForm(Dialog, activity, null);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(StbActivity))
|
||||
{
|
||||
Messenger.Send(new NewActivityMessage(((StbActivity)result.Data).ActivityId));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CreateUser()
|
||||
{
|
||||
var result = await ModalHelpers.OpenUserForm(Dialog, null);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(CRMCreateContactResponseDTO))
|
||||
{
|
||||
Messenger.Send(new NewContactMessage((CRMCreateContactResponseDTO)result.Data));
|
||||
}
|
||||
}
|
||||
|
||||
private void NewNotificationReceived(WtbNotification notification)
|
||||
{
|
||||
Notification.ReceivedNotifications.Add(notification);
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void InitMessage()
|
||||
{
|
||||
CopyActivityService.OnCopyActivity += async dto => await CreateActivity(dto);
|
||||
NewPushNotificationService.OnNotificationReceived += NewNotificationReceived;
|
||||
NotificationsLoadedService.OnNotificationsLoaded += () => InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
.animated-navbar.show-nav { transform: translateY(0); }
|
||||
|
||||
.animated-navbar.hide-nav { transform: translateY(100%); }
|
||||
.animated-navbar.hide-nav { transform: translateY(150%); }
|
||||
|
||||
.animated-navbar.with-plus { margin-left: 30px; }
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
bottom: 15px;
|
||||
}
|
||||
|
||||
.nav-item ::deep .custom-plus-button .mud-icon-root {
|
||||
.navbar ::deep .custom-plus-button .mud-icon-root {
|
||||
transition: .5s;
|
||||
transform: rotate(0);
|
||||
font-size: 2rem;
|
||||
@@ -57,7 +57,7 @@
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.nav-item ::deep .custom-plus-button:focus .mud-icon-root { transform: rotate(225deg); }
|
||||
.navbar ::deep .custom-plus-button:focus .mud-icon-root { transform: rotate(225deg); }
|
||||
|
||||
.nav-item ::deep a {
|
||||
display: flex;
|
||||
@@ -83,7 +83,9 @@
|
||||
|
||||
.nav-item ::deep a.active > div > span { font-weight: 800; }
|
||||
|
||||
.nav-item ::deep a:not(.active) > div { color: var(--mud-palette-text-primary); }
|
||||
.nav-item ::deep a:not(.active) > div {
|
||||
color: var(--mud-palette-text-primary);
|
||||
}
|
||||
|
||||
.nav-item ::deep a i { font-size: 1.65rem; }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@using Template.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
<MudOverlay Visible="VisibleOverlay" LightBackground="true">
|
||||
@if (SuccessAnimation)
|
||||
{
|
||||