generated from Integry/Template_NetMauiBlazorHybrid
Fix e migliorati caricamenti
This commit is contained in:
@@ -1,20 +1,15 @@
|
|||||||
using CommunityToolkit.Mvvm.Messaging;
|
|
||||||
|
|
||||||
namespace salesbook.Maui
|
namespace salesbook.Maui
|
||||||
{
|
{
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
private readonly IMessenger _messenger;
|
public App()
|
||||||
|
|
||||||
public App(IMessenger messenger)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_messenger = messenger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Window CreateWindow(IActivationState? activationState)
|
protected override Window CreateWindow(IActivationState? activationState)
|
||||||
{
|
{
|
||||||
return new Window(new MainPage(_messenger));
|
return new Window(new MainPage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,14 +7,39 @@ public class AttachedService : IAttachedService
|
|||||||
{
|
{
|
||||||
public async Task<AttachedDTO?> SelectImage()
|
public async Task<AttachedDTO?> SelectImage()
|
||||||
{
|
{
|
||||||
var perm = await Permissions.RequestAsync<Permissions.Photos>();
|
// Richiesta permessi base
|
||||||
if (perm != PermissionStatus.Granted) return null;
|
var cameraPerm = await Permissions.RequestAsync<Permissions.Camera>();
|
||||||
|
var storagePerm = await Permissions.RequestAsync<Permissions.StorageRead>();
|
||||||
|
|
||||||
var result = await FilePicker.PickAsync(new PickOptions
|
if (cameraPerm != PermissionStatus.Granted && storagePerm != PermissionStatus.Granted)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
// Mostro all'utente un popup di scelta
|
||||||
|
var action = await Application.Current.MainPage.DisplayActionSheet(
|
||||||
|
"Aggiungi immagine",
|
||||||
|
"Annulla",
|
||||||
|
null,
|
||||||
|
"Scatta foto",
|
||||||
|
"Scegli dalla galleria");
|
||||||
|
|
||||||
|
FileResult? result = null;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
PickerTitle = "Scegli un'immagine",
|
if (action == "Scatta foto")
|
||||||
FileTypes = FilePickerFileType.Images
|
{
|
||||||
});
|
result = await MediaPicker.Default.CapturePhotoAsync();
|
||||||
|
}
|
||||||
|
else if (action == "Scegli dalla galleria")
|
||||||
|
{
|
||||||
|
result = await MediaPicker.Default.PickPhotoAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Errore selezione immagine: {ex.Message}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image);
|
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,23 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using MudBlazor.Extensions;
|
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Storage;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto;
|
||||||
using salesbook.Shared.Core.Dto.Activity;
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
using salesbook.Shared.Core.Dto.Contact;
|
using salesbook.Shared.Core.Dto.Contact;
|
||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
|
using salesbook.Shared.Core.Helpers;
|
||||||
using salesbook.Shared.Core.Helpers.Enum;
|
using salesbook.Shared.Core.Helpers.Enum;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
using salesbook.Shared.Core.Interface.IntegryApi;
|
using salesbook.Shared.Core.Interface.IntegryApi;
|
||||||
using salesbook.Shared.Core.Interface.System.Network;
|
using salesbook.Shared.Core.Interface.System.Network;
|
||||||
using Sentry.Protocol;
|
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
using salesbook.Shared.Core.Helpers;
|
using salesbook.Shared.Core.Dto.PageState;
|
||||||
|
|
||||||
namespace salesbook.Maui.Core.Services;
|
namespace salesbook.Maui.Core.Services;
|
||||||
|
|
||||||
public class ManageDataService(
|
public class ManageDataService(
|
||||||
LocalDbService localDb,
|
LocalDbService localDb,
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
|
UserListState userListState,
|
||||||
IIntegryApiService integryApiService,
|
IIntegryApiService integryApiService,
|
||||||
INetworkService networkService
|
INetworkService networkService
|
||||||
) : IManageDataService
|
) : IManageDataService
|
||||||
@@ -86,7 +87,7 @@ public class ManageDataService(
|
|||||||
return prospect;
|
return prospect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ContactDTO>> GetContact(WhereCondContact? whereCond)
|
public async Task<List<ContactDTO>> GetContact(WhereCondContact? whereCond, DateTime? lastSync)
|
||||||
{
|
{
|
||||||
List<AnagClie>? contactList;
|
List<AnagClie>? contactList;
|
||||||
List<PtbPros>? prospectList;
|
List<PtbPros>? prospectList;
|
||||||
@@ -94,26 +95,37 @@ public class ManageDataService(
|
|||||||
|
|
||||||
if (networkService.ConnectionAvailable)
|
if (networkService.ConnectionAvailable)
|
||||||
{
|
{
|
||||||
|
var response = new UsersSyncResponseDTO();
|
||||||
|
|
||||||
var clienti = await integryApiService.RetrieveAnagClie(
|
var clienti = await integryApiService.RetrieveAnagClie(
|
||||||
new CRMAnagRequestDTO
|
new CRMAnagRequestDTO
|
||||||
{
|
{
|
||||||
CodAnag = whereCond.CodAnag,
|
CodAnag = whereCond.CodAnag,
|
||||||
FlagStato = whereCond.FlagStato,
|
FlagStato = whereCond.FlagStato,
|
||||||
PartIva = whereCond.PartIva,
|
PartIva = whereCond.PartIva,
|
||||||
ReturnPersRif = !whereCond.OnlyContact
|
ReturnPersRif = !whereCond.OnlyContact,
|
||||||
|
FilterDate = lastSync
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
_ = UpdateDbUsers(clienti);
|
|
||||||
|
response.AnagClie = clienti.AnagClie;
|
||||||
|
response.VtbDest = clienti.VtbDest;
|
||||||
|
response.VtbCliePersRif = clienti.VtbCliePersRif;
|
||||||
|
|
||||||
var prospect = await integryApiService.RetrieveProspect(
|
var prospect = await integryApiService.RetrieveProspect(
|
||||||
new CRMProspectRequestDTO
|
new CRMProspectRequestDTO
|
||||||
{
|
{
|
||||||
CodPpro = whereCond.CodAnag,
|
CodPpro = whereCond.CodAnag,
|
||||||
PartIva = whereCond.PartIva,
|
PartIva = whereCond.PartIva,
|
||||||
ReturnPersRif = !whereCond.OnlyContact
|
ReturnPersRif = !whereCond.OnlyContact,
|
||||||
|
FilterDate = lastSync
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
_ = UpdateDbUsers(prospect);
|
|
||||||
|
response.PtbPros = prospect.PtbPros;
|
||||||
|
response.PtbProsRif = prospect.PtbProsRif;
|
||||||
|
|
||||||
|
_ = UpdateDbUsers(response);
|
||||||
|
|
||||||
contactList = clienti.AnagClie;
|
contactList = clienti.AnagClie;
|
||||||
prospectList = prospect.PtbPros;
|
prospectList = prospect.PtbPros;
|
||||||
@@ -230,17 +242,20 @@ public class ManageDataService(
|
|||||||
.Distinct().ToList();
|
.Distinct().ToList();
|
||||||
|
|
||||||
var jtbComtList = await localDb.Get<JtbComt>(x => codJcomList.Contains(x.CodJcom));
|
var jtbComtList = await localDb.Get<JtbComt>(x => codJcomList.Contains(x.CodJcom));
|
||||||
var commesseDict = jtbComtList.ToDictionary(x => x.CodJcom, x => x.Descrizione);
|
|
||||||
|
|
||||||
var codAnagList = activities
|
var codAnagList = activities
|
||||||
.Select(x => x.CodAnag)
|
.Select(x => x.CodAnag)
|
||||||
.Where(x => !string.IsNullOrEmpty(x))
|
.Where(x => !string.IsNullOrEmpty(x))
|
||||||
.Distinct().ToList();
|
.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));
|
IDictionary<string, string?>? distinctUser = null;
|
||||||
var distinctProspect = prospectList.ToDictionary(x => x.CodPpro, x => x.RagSoc);
|
|
||||||
|
if (userListState.AllUsers != null)
|
||||||
|
{
|
||||||
|
distinctUser = userListState.AllUsers
|
||||||
|
.Where(x => codAnagList.Contains(x.CodContact))
|
||||||
|
.ToDictionary(x => x.CodContact, x => x.RagSoc);
|
||||||
|
}
|
||||||
|
|
||||||
var returnDto = activities
|
var returnDto = activities
|
||||||
.Select(activity =>
|
.Select(activity =>
|
||||||
@@ -269,16 +284,14 @@ public class ManageDataService(
|
|||||||
{
|
{
|
||||||
string? ragSoc;
|
string? ragSoc;
|
||||||
|
|
||||||
if (distinctClient.TryGetValue(activity.CodAnag, out ragSoc) ||
|
if (distinctUser != null && (distinctUser.TryGetValue(activity.CodAnag, out ragSoc) ||
|
||||||
distinctProspect.TryGetValue(activity.CodAnag, out ragSoc))
|
distinctUser.TryGetValue(activity.CodAnag, out ragSoc)))
|
||||||
{
|
{
|
||||||
dto.Cliente = ragSoc;
|
dto.Cliente = ragSoc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.Commessa = activity.CodJcom != null && commesseDict.TryGetValue(activity.CodJcom, out var descr)
|
dto.Commessa = jtbComtList.LastOrDefault();
|
||||||
? descr
|
|
||||||
: null;
|
|
||||||
return dto;
|
return dto;
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -322,6 +335,26 @@ public class ManageDataService(
|
|||||||
public Task InsertOrUpdate<T>(T objectToSave) =>
|
public Task InsertOrUpdate<T>(T objectToSave) =>
|
||||||
localDb.InsertOrUpdate<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) =>
|
public Task Delete<T>(T objectToDelete) =>
|
||||||
localDb.Delete(objectToDelete);
|
localDb.Delete(objectToDelete);
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,10 @@
|
|||||||
using CommunityToolkit.Mvvm.Messaging;
|
|
||||||
using salesbook.Shared.Core.Messages.Back;
|
|
||||||
|
|
||||||
namespace salesbook.Maui
|
namespace salesbook.Maui
|
||||||
{
|
{
|
||||||
public partial class MainPage : ContentPage
|
public partial class MainPage : ContentPage
|
||||||
{
|
{
|
||||||
private readonly IMessenger _messenger;
|
public MainPage()
|
||||||
|
|
||||||
public MainPage(IMessenger messenger)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_messenger = messenger;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnBackButtonPressed()
|
|
||||||
{
|
|
||||||
_messenger.Send(new HardwareBackMessage("back"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,10 @@
|
|||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_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.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.BATTERY_STATS" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<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.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
|||||||
@@ -39,8 +39,11 @@
|
|||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
<string>L'app utilizza la tua posizione per allegarla alle attività.</string>
|
<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>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<string>Consente di selezionare immagini da allegare alle attività.</string>
|
<string>Questa app necessita di accedere alla libreria foto.</string>
|
||||||
|
|
||||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
<string>Permette all'app di salvare file o immagini nella tua libreria fotografica se necessario.</string>
|
<string>Permette all'app di salvare file o immagini nella tua libreria fotografica se necessario.</string>
|
||||||
|
|||||||
@@ -78,8 +78,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
|
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
|
||||||
<CodesignKey>Apple Distribution: Integry S.r.l. (UNP26J4R89)</CodesignKey>
|
<CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey>
|
||||||
<CodesignProvision></CodesignProvision>
|
<CodesignProvision>VS: it.integry.salesbook Development</CodesignProvision>
|
||||||
<ProvisioningType>manual</ProvisioningType>
|
<ProvisioningType>manual</ProvisioningType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -95,16 +95,6 @@
|
|||||||
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-android'">
|
|
||||||
<GoogleServicesJson Include="google-services.json">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</GoogleServicesJson>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0-ios'">
|
|
||||||
<BundleResource Include="GoogleService-Info.plist" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
||||||
<!-- Android App Icon -->
|
<!-- Android App Icon -->
|
||||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
|
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
|
||||||
@@ -130,16 +120,26 @@
|
|||||||
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
|
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
|
||||||
</ItemGroup>
|
</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>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.Maui" Version="12.0.0" />
|
<PackageReference Include="CommunityToolkit.Maui" Version="12.2.0" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.2.1" />
|
<PackageReference Include="IntegryApiClient.MAUI" Version="1.2.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.6" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.9" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.81" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.110" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.81" />
|
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.110" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.81" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.110" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.6" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.9" />
|
||||||
<PackageReference Include="Sentry.Maui" Version="5.11.2" />
|
<PackageReference Include="Sentry.Maui" Version="5.15.0" />
|
||||||
<PackageReference Include="Shiny.Hosting.Maui" Version="3.3.4" />
|
<PackageReference Include="Shiny.Hosting.Maui" Version="3.3.4" />
|
||||||
<PackageReference Include="Shiny.Notifications" Version="3.3.4" />
|
<PackageReference Include="Shiny.Notifications" Version="3.3.4" />
|
||||||
<PackageReference Include="Shiny.Push" Version="3.3.4" />
|
<PackageReference Include="Shiny.Push" Version="3.3.4" />
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header-content > .title { width: 100%; }
|
||||||
|
|
||||||
.header-content.with-back .page-title {
|
.header-content.with-back .page-title {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
@using salesbook.Shared.Core.Dto.Activity
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
@using salesbook.Shared.Core.Dto.PageState
|
@using salesbook.Shared.Core.Dto.PageState
|
||||||
@using salesbook.Shared.Core.Entity
|
@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.Copy
|
||||||
@using salesbook.Shared.Core.Messages.Activity.New
|
@using salesbook.Shared.Core.Messages.Activity.New
|
||||||
@using salesbook.Shared.Core.Messages.Contact
|
@using salesbook.Shared.Core.Messages.Contact
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
@inject CopyActivityService CopyActivityService
|
@inject CopyActivityService CopyActivityService
|
||||||
@inject NewPushNotificationService NewPushNotificationService
|
@inject NewPushNotificationService NewPushNotificationService
|
||||||
@inject NotificationState Notification
|
@inject NotificationState Notification
|
||||||
|
@inject INetworkService NetworkService
|
||||||
@inject NotificationsLoadedService NotificationsLoadedService
|
@inject NotificationsLoadedService NotificationsLoadedService
|
||||||
|
|
||||||
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||||
@@ -55,8 +57,8 @@
|
|||||||
<MudFab Class="custom-plus-button" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium" IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add"/>
|
<MudFab Class="custom-plus-button" Color="Color.Surface" Size="Size.Medium" IconSize="Size.Medium" IconColor="Color.Primary" StartIcon="@Icons.Material.Filled.Add"/>
|
||||||
</ActivatorContent>
|
</ActivatorContent>
|
||||||
<ChildContent>
|
<ChildContent>
|
||||||
<MudMenuItem OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
|
<MudMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
|
||||||
<MudMenuItem OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
|
<MudMenuItem Disabled="!NetworkService.IsNetworkAvailable()" OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
|
||||||
</ChildContent>
|
</ChildContent>
|
||||||
</MudMenu>
|
</MudMenu>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
.animated-navbar.show-nav { transform: translateY(0); }
|
.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; }
|
.animated-navbar.with-plus { margin-left: 30px; }
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,13 @@
|
|||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
@using salesbook.Shared.Core.Dto.Activity
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
|
@using salesbook.Shared.Core.Dto.PageState
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Messages.Activity.New
|
@using salesbook.Shared.Core.Messages.Activity.New
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
@inject NewActivityService NewActivity
|
@inject NewActivityService NewActivity
|
||||||
|
@inject UserListState UserState
|
||||||
|
|
||||||
<HeaderLayout Title="@_headerTitle"
|
<HeaderLayout Title="@_headerTitle"
|
||||||
ShowFilter="true"
|
ShowFilter="true"
|
||||||
@@ -168,7 +170,6 @@
|
|||||||
<FilterActivity @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
|
<FilterActivity @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
// Modelli per ottimizzazione rendering
|
// Modelli per ottimizzazione rendering
|
||||||
private record DayData(DateTime Date, string CssClass, bool HasEvents, CategoryData[] EventCategories, string DayName = "");
|
private record DayData(DateTime Date, string CssClass, bool HasEvents, CategoryData[] EventCategories, string DayName = "");
|
||||||
|
|
||||||
@@ -221,11 +222,20 @@
|
|||||||
PrepareRenderingData();
|
PrepareRenderingData();
|
||||||
|
|
||||||
NewActivity.OnActivityCreated += async activityId => await OnActivityCreated(activityId);
|
NewActivity.OnActivityCreated += async activityId => await OnActivityCreated(activityId);
|
||||||
|
UserState.OnUsersLoaded += async () => await InvokeAsync(LoadData);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender && UserState.IsLoaded)
|
||||||
|
{
|
||||||
|
await LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadData()
|
||||||
|
{
|
||||||
|
if (!_isInitialized)
|
||||||
{
|
{
|
||||||
Filter.User = new HashSet<string> { UserSession.User.Username };
|
Filter.User = new HashSet<string> { UserSession.User.Username };
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
{
|
{
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
NetworkService.ConnectionAvailable = NetworkService.IsNetworkAvailable();
|
||||||
|
|
||||||
await LoadNotification();
|
await LoadNotification();
|
||||||
await CheckAndRequestPermissions();
|
await CheckAndRequestPermissions();
|
||||||
|
|
||||||
@@ -54,9 +56,6 @@
|
|||||||
private async Task CheckAndRequestPermissions()
|
private async Task CheckAndRequestPermissions()
|
||||||
{
|
{
|
||||||
await NotificationManager.RequestAccess();
|
await NotificationManager.RequestAccess();
|
||||||
|
|
||||||
// if (BatteryOptimizationManagerService.IsBatteryOptimizationEnabled())
|
|
||||||
// BatteryOptimizationManagerService.OpenBatteryOptimizationSettings(_ => { });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task StartSyncUser()
|
private Task StartSyncUser()
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ else
|
|||||||
<div class="container content" style="overflow: auto;" id="topPage">
|
<div class="container content" style="overflow: auto;" id="topPage">
|
||||||
<div class="container-primary-info">
|
<div class="container-primary-info">
|
||||||
<div class="section-primary-info">
|
<div class="section-primary-info">
|
||||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Variant="@(IsContact ? Variant.Filled : Variant.Outlined)" Color="Color.Secondary">
|
||||||
@UtilityString.ExtractInitials(Anag.RagSoc)
|
@UtilityString.ExtractInitials(Anag.RagSoc)
|
||||||
</MudAvatar>
|
</MudAvatar>
|
||||||
|
|
||||||
@@ -55,41 +55,45 @@ else
|
|||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="section-info">
|
<div class="section-info">
|
||||||
<div class="section-personal-info">
|
@if (Agente != null)
|
||||||
@if (!string.IsNullOrEmpty(Anag.Telefono))
|
{
|
||||||
{
|
<div class="section-personal-info">
|
||||||
<div>
|
|
||||||
<span class="info-title">Telefono</span>
|
|
||||||
<span class="info-text">@Anag.Telefono</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(Anag.PartIva))
|
|
||||||
{
|
|
||||||
<div>
|
|
||||||
<span class="info-title">P. IVA</span>
|
|
||||||
<span class="info-text">@Anag.PartIva</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section-personal-info">
|
|
||||||
@if (!string.IsNullOrEmpty(Anag.EMail))
|
|
||||||
{
|
|
||||||
<div>
|
|
||||||
<span class="info-title">E-mail</span>
|
|
||||||
<span class="info-text">@Anag.EMail</span>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@if (Agente != null)
|
|
||||||
{
|
|
||||||
<div>
|
<div>
|
||||||
<span class="info-title">Agente</span>
|
<span class="info-title">Agente</span>
|
||||||
<span class="info-text">@Agente.FullName</span>
|
<span class="info-text">@Agente.FullName</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
</div>
|
||||||
</div>
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(Anag.Telefono))
|
||||||
|
{
|
||||||
|
<div class="section-personal-info">
|
||||||
|
<div>
|
||||||
|
<span class="info-title">Telefono</span>
|
||||||
|
<span class="info-text">@Anag.Telefono</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(Anag.PartIva))
|
||||||
|
{
|
||||||
|
<div class="section-personal-info">
|
||||||
|
<div>
|
||||||
|
<span class="info-title">P. IVA</span>
|
||||||
|
<span class="info-text">@Anag.PartIva</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(Anag.EMail))
|
||||||
|
{
|
||||||
|
<div class="section-personal-info">
|
||||||
|
<div>
|
||||||
|
<span class="info-title">E-mail</span>
|
||||||
|
<span class="info-text">@Anag.EMail</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -773,7 +777,16 @@ else
|
|||||||
{
|
{
|
||||||
var result = await ModalHelpers.OpenUserForm(Dialog, anag);
|
var result = await ModalHelpers.OpenUserForm(Dialog, anag);
|
||||||
|
|
||||||
if (result is { Canceled: false })
|
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(AnagClie))
|
||||||
|
{
|
||||||
|
var clie = (AnagClie)result.Data;
|
||||||
|
IsContact = true;
|
||||||
|
CodContact = clie.CodAnag!;
|
||||||
|
|
||||||
|
await LoadAnagAsync();
|
||||||
|
SaveDataToSession();
|
||||||
|
}
|
||||||
|
else if (result is { Canceled: false })
|
||||||
{
|
{
|
||||||
await LoadAnagAsync();
|
await LoadAnagAsync();
|
||||||
SaveDataToSession();
|
SaveDataToSession();
|
||||||
|
|||||||
@@ -39,9 +39,10 @@
|
|||||||
|
|
||||||
.section-info {
|
.section-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
padding: .4rem 1.2rem .8rem;
|
padding: .4rem 1.2rem .8rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-personal-info {
|
.section-personal-info {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@using salesbook.Shared.Core.Dto
|
|
||||||
@using salesbook.Shared.Core.Dto.Activity
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Helpers.Enum
|
@using salesbook.Shared.Core.Helpers.Enum
|
||||||
@@ -12,7 +11,7 @@
|
|||||||
@switch (Activity.Category)
|
@switch (Activity.Category)
|
||||||
{
|
{
|
||||||
case ActivityCategoryEnum.Commessa:
|
case ActivityCategoryEnum.Commessa:
|
||||||
@Activity.Commessa
|
@Activity.Commessa?.Descrizione
|
||||||
break;
|
break;
|
||||||
case ActivityCategoryEnum.Interna:
|
case ActivityCategoryEnum.Interna:
|
||||||
@Activity.Cliente
|
@Activity.Cliente
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<MudAutocomplete
|
<MudAutocomplete
|
||||||
Disabled="ActivityModel.Cliente.IsNullOrEmpty()"
|
Disabled="ActivityModel.Cliente.IsNullOrEmpty()"
|
||||||
T="JtbComt?"
|
T="JtbComt?" ReadOnly="IsView"
|
||||||
@bind-Value="SelectedComessa"
|
@bind-Value="SelectedComessa"
|
||||||
@bind-Value:after="OnCommessaSelectedAfter"
|
@bind-Value:after="OnCommessaSelectedAfter"
|
||||||
SearchFunc="SearchCommesseAsync"
|
SearchFunc="SearchCommesseAsync"
|
||||||
@@ -89,8 +89,9 @@
|
|||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Assegnata a</span>
|
<span class="disable-full-width">Assegnata a</span>
|
||||||
|
|
||||||
<MudAutocomplete
|
<MudAutocomplete
|
||||||
Disabled="Users.IsNullOrEmpty()"
|
Disabled="Users.IsNullOrEmpty()" ReadOnly="IsView"
|
||||||
T="StbUser"
|
T="StbUser"
|
||||||
@bind-Value="SelectedUser"
|
@bind-Value="SelectedUser"
|
||||||
@bind-Value:after="OnUserSelectedAfter"
|
@bind-Value:after="OnUserSelectedAfter"
|
||||||
@@ -166,41 +167,44 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container-button">
|
@if (!IsView)
|
||||||
<MudButton Class="button-settings green-icon"
|
{
|
||||||
FullWidth="true"
|
<div class="container-button">
|
||||||
StartIcon="@Icons.Material.Rounded.AttachFile"
|
<MudButton Class="button-settings green-icon"
|
||||||
Size="Size.Medium"
|
|
||||||
OnClick="OpenAddAttached"
|
|
||||||
Variant="Variant.Outlined">
|
|
||||||
Aggiungi allegati
|
|
||||||
</MudButton>
|
|
||||||
|
|
||||||
@if (!IsNew)
|
|
||||||
{
|
|
||||||
<div class="divider"></div>
|
|
||||||
|
|
||||||
<MudButton Class="button-settings gray-icon"
|
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Filled.ContentCopy"
|
StartIcon="@Icons.Material.Rounded.AttachFile"
|
||||||
Size="Size.Medium"
|
Size="Size.Medium"
|
||||||
OnClick="Duplica"
|
OnClick="OpenAddAttached"
|
||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Duplica
|
Aggiungi allegati
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
|
||||||
<div class="divider"></div>
|
@if (!IsNew)
|
||||||
|
{
|
||||||
|
<div class="divider"></div>
|
||||||
|
|
||||||
<MudButton Class="button-settings red-icon"
|
<MudButton Class="button-settings gray-icon"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Outlined.Delete"
|
StartIcon="@Icons.Material.Filled.ContentCopy"
|
||||||
Size="Size.Medium"
|
Size="Size.Medium"
|
||||||
OnClick="DeleteActivity"
|
OnClick="Duplica"
|
||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Elimina
|
Duplica
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
|
||||||
</div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
|
<MudButton Class="button-settings red-icon"
|
||||||
|
FullWidth="true"
|
||||||
|
StartIcon="@Icons.Material.Outlined.Delete"
|
||||||
|
Size="Size.Medium"
|
||||||
|
OnClick="DeleteActivity"
|
||||||
|
Variant="Variant.Outlined">
|
||||||
|
Elimina
|
||||||
|
</MudButton>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
||||||
@@ -400,6 +404,8 @@
|
|||||||
if (!ActivityModel.UserName.IsNullOrEmpty())
|
if (!ActivityModel.UserName.IsNullOrEmpty())
|
||||||
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
|
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
|
||||||
|
|
||||||
|
SelectedComessa = ActivityModel.Commessa;
|
||||||
|
|
||||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||||
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
|
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
|
||||||
Pros = await ManageData.GetProspect();
|
Pros = await ManageData.GetProspect();
|
||||||
@@ -513,7 +519,7 @@
|
|||||||
if (com != null)
|
if (com != null)
|
||||||
{
|
{
|
||||||
ActivityModel.CodJcom = com.CodJcom;
|
ActivityModel.CodJcom = com.CodJcom;
|
||||||
ActivityModel.Commessa = com.Descrizione;
|
ActivityModel.Commessa = com;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -568,6 +574,8 @@
|
|||||||
|
|
||||||
private void OpenSelectEsito()
|
private void OpenSelectEsito()
|
||||||
{
|
{
|
||||||
|
if (IsView) return;
|
||||||
|
|
||||||
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username)))
|
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username)))
|
||||||
{
|
{
|
||||||
Snackbar.Add("Non puoi inserire un esito per un'attività che non ti è stata assegnata.", Severity.Info);
|
Snackbar.Add("Non puoi inserire un esito per un'attività che non ti è stata assegnata.", Severity.Info);
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
|
|
||||||
private AttachedDTO? Attached { get; set; }
|
private AttachedDTO? Attached { get; set; }
|
||||||
|
|
||||||
|
private bool SelectTypePicture { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
.content.attached {
|
.content.attached {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
|
||||||
gap: 2rem;
|
gap: 2rem;
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
height: unset;
|
height: unset;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,19 +87,18 @@
|
|||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Tipo cliente</span>
|
<span class="disable-full-width">Tipo cliente</span>
|
||||||
|
|
||||||
@if (VtbTipi.IsNullOrEmpty())
|
<MudAutocomplete Disabled="VtbTipi.IsNullOrEmpty()" ReadOnly="IsView"
|
||||||
{
|
T="VtbTipi"
|
||||||
<span class="warning-text">Nessun tipo cliente trovato</span>
|
@bind-Value="SelectedType"
|
||||||
}
|
@bind-Value:after="OnTypeSelectedAfter"
|
||||||
else
|
SearchFunc="SearchTypeAsync"
|
||||||
{
|
ToStringFunc="@(u => u == null ? string.Empty : $"{u.CodVtip} - {u.Descrizione}")"
|
||||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || VtbTipi.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="ContactModel.CodVtip" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
Clearable="true"
|
||||||
@foreach (var tipo in VtbTipi)
|
ShowProgressIndicator="true"
|
||||||
{
|
DebounceInterval="300"
|
||||||
<MudSelectItemExtended Class="custom-item-select" Value="@tipo.CodVtip">@($"{tipo.CodVtip} - {tipo.Descrizione}")</MudSelectItemExtended>
|
MaxItems="50"
|
||||||
}
|
Class="customIcon-select"
|
||||||
</MudSelectExtended>
|
AdornmentIcon="@Icons.Material.Filled.Code" />
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -242,14 +241,18 @@
|
|||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Agente</span>
|
<span class="disable-full-width">Agente</span>
|
||||||
|
|
||||||
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
|
<MudAutocomplete Disabled="Users.IsNullOrEmpty()" ReadOnly="IsView"
|
||||||
@bind-Value="ContactModel.CodVage" @bind-Value:after="OnAfterChangeValue"
|
T="StbUser"
|
||||||
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
@bind-Value="SelectedUser"
|
||||||
@foreach (var user in Users)
|
@bind-Value:after="OnUserSelectedAfter"
|
||||||
{
|
SearchFunc="SearchUtentiAsync"
|
||||||
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
|
ToStringFunc="@(u => u == null ? string.Empty : u.FullName)"
|
||||||
}
|
Clearable="true"
|
||||||
</MudSelectExtended>
|
ShowProgressIndicator="true"
|
||||||
|
DebounceInterval="300"
|
||||||
|
MaxItems="50"
|
||||||
|
Class="customIcon-select"
|
||||||
|
AdornmentIcon="@Icons.Material.Filled.Code" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -268,9 +271,9 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="container-button">
|
@if (IsNew)
|
||||||
@if (IsNew)
|
{
|
||||||
{
|
<div class="container-button">
|
||||||
<MudButton Class="button-settings gray-icon"
|
<MudButton Class="button-settings gray-icon"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
||||||
@@ -279,11 +282,13 @@
|
|||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Persona di riferimento
|
Persona di riferimento
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
</div>
|
||||||
else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@if (NetworkService.ConnectionAvailable && !ContactModel.IsContact)
|
||||||
{
|
{
|
||||||
@if (NetworkService.ConnectionAvailable && !ContactModel.IsContact)
|
<div class="container-button">
|
||||||
{
|
|
||||||
<MudButton Class="button-settings blue-icon"
|
<MudButton Class="button-settings blue-icon"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Rounded.Sync"
|
StartIcon="@Icons.Material.Rounded.Sync"
|
||||||
@@ -292,9 +297,9 @@
|
|||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Converti in cliente
|
Converti in cliente
|
||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MudMessageBox MarkupMessage="new MarkupString(VatMessage)" @ref="CheckVat" Class="c-messageBox" Title="Verifica partita iva" CancelText="@(VatAlreadyRegistered ? "" : "Annulla")">
|
<MudMessageBox MarkupMessage="new MarkupString(VatMessage)" @ref="CheckVat" Class="c-messageBox" Title="Verifica partita iva" CancelText="@(VatAlreadyRegistered ? "" : "Annulla")">
|
||||||
@@ -351,11 +356,17 @@
|
|||||||
private bool OpenSearchAddress { get; set; }
|
private bool OpenSearchAddress { get; set; }
|
||||||
private IndirizzoDTO Address { get; set; }
|
private IndirizzoDTO Address { get; set; }
|
||||||
|
|
||||||
|
//Agente
|
||||||
|
private StbUser? SelectedUser { get; set; }
|
||||||
|
|
||||||
|
//Type
|
||||||
|
private VtbTipi? SelectedType { get; set; }
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
|
|
||||||
await LoadData();
|
_ = LoadData();
|
||||||
|
|
||||||
LabelSave = IsNew ? "Aggiungi" : null;
|
LabelSave = IsNew ? "Aggiungi" : null;
|
||||||
}
|
}
|
||||||
@@ -403,24 +414,27 @@
|
|||||||
MudDialog.Close(response);
|
MudDialog.Close(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadData()
|
private Task LoadData()
|
||||||
{
|
{
|
||||||
if (IsNew)
|
return Task.Run(async () =>
|
||||||
{
|
{
|
||||||
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
if (IsNew)
|
||||||
|
{
|
||||||
|
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||||
|
|
||||||
ContactModel.IsContact = false;
|
ContactModel.IsContact = false;
|
||||||
ContactModel.Nazione = "IT";
|
ContactModel.Nazione = "IT";
|
||||||
ContactModel.CodVage = loggedUser.UserCode;
|
ContactModel.CodVage = loggedUser.UserCode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ContactModel = OriginalModel!.Clone();
|
ContactModel = OriginalModel!.Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
Users = await ManageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
Users = await ManageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||||
Nazioni = await ManageData.GetTable<Nazioni>();
|
Nazioni = await ManageData.GetTable<Nazioni>();
|
||||||
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAfterChangeValue()
|
private void OnAfterChangeValue()
|
||||||
@@ -562,9 +576,83 @@
|
|||||||
|
|
||||||
private async Task ConvertProspectToContact()
|
private async Task ConvertProspectToContact()
|
||||||
{
|
{
|
||||||
await IntegryApiService.TransferProspect(new CRMTransferProspectRequestDTO
|
VisibleOverlay = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
var response = await IntegryApiService.TransferProspect(new CRMTransferProspectRequestDTO
|
||||||
{
|
{
|
||||||
CodPpro = ContactModel.CodContact
|
CodPpro = ContactModel.CodContact
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await ManageData.DeleteProspect(ContactModel.CodContact);
|
||||||
|
|
||||||
|
if (response.AnagClie != null)
|
||||||
|
await ManageData.InsertOrUpdate(response.AnagClie);
|
||||||
|
|
||||||
|
if (response.VtbCliePersRif != null)
|
||||||
|
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
|
||||||
|
|
||||||
|
if (response.VtbDest != null)
|
||||||
|
await ManageData.InsertOrUpdate(response.VtbDest);
|
||||||
|
|
||||||
|
SuccessAnimation = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
await Task.Delay(1250);
|
||||||
|
MudDialog.Close(response.AnagClie);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnUserSelectedAfter()
|
||||||
|
{
|
||||||
|
ContactModel.CodVage = SelectedUser?.UserCode;
|
||||||
|
OnAfterChangeValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task<IEnumerable<StbUser>> SearchUtentiAsync(string value, CancellationToken token)
|
||||||
|
{
|
||||||
|
IEnumerable<StbUser> list;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
{
|
||||||
|
list = Users.OrderBy(u => u.FullName).Take(50);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list = Users
|
||||||
|
.Where(x => x.UserName.Contains(value, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| x.FullName.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.OrderBy(u => u.FullName)
|
||||||
|
.Take(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.FromResult(token.IsCancellationRequested ? [] : list);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnTypeSelectedAfter()
|
||||||
|
{
|
||||||
|
ContactModel.CodVtip = SelectedType?.CodVtip;
|
||||||
|
OnAfterChangeValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task<IEnumerable<VtbTipi>> SearchTypeAsync(string value, CancellationToken token)
|
||||||
|
{
|
||||||
|
IEnumerable<VtbTipi> list = [];
|
||||||
|
|
||||||
|
if (VtbTipi == null) return Task.FromResult(token.IsCancellationRequested ? [] : list);
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(value))
|
||||||
|
{
|
||||||
|
list = VtbTipi.OrderBy(u => u.CodVtip);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list = VtbTipi
|
||||||
|
.Where(x => x.CodVtip.Contains(value, StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| x.Descrizione.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.OrderBy(u => u.CodVtip)
|
||||||
|
.Take(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.FromResult(token.IsCancellationRequested ? [] : list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,7 @@ namespace salesbook.Shared.Core.Dto.Activity;
|
|||||||
|
|
||||||
public class ActivityDTO : StbActivity
|
public class ActivityDTO : StbActivity
|
||||||
{
|
{
|
||||||
public string? Commessa { get; set; }
|
public JtbComt? Commessa { get; set; }
|
||||||
public string? Cliente { get; set; }
|
public string? Cliente { get; set; }
|
||||||
public ActivityCategoryEnum Category { get; set; }
|
public ActivityCategoryEnum Category { get; set; }
|
||||||
public bool Complete { get; set; }
|
public bool Complete { get; set; }
|
||||||
|
|||||||
@@ -7,4 +7,10 @@ public class CRMTransferProspectResponseDTO
|
|||||||
{
|
{
|
||||||
[JsonPropertyName("anagClie")]
|
[JsonPropertyName("anagClie")]
|
||||||
public AnagClie? AnagClie { get; set; }
|
public AnagClie? AnagClie { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("vtbDest")]
|
||||||
|
public List<VtbDest>? VtbDest { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("vtbCliePersRif")]
|
||||||
|
public List<VtbCliePersRif>? VtbCliePersRif { get; set; }
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,8 @@ public class UserListState
|
|||||||
public List<UserDisplayItem>? GroupedUserList { get; set; }
|
public List<UserDisplayItem>? GroupedUserList { get; set; }
|
||||||
public List<UserDisplayItem>? FilteredGroupedUserList { get; set; }
|
public List<UserDisplayItem>? FilteredGroupedUserList { get; set; }
|
||||||
|
|
||||||
|
public List<ContactDTO>? AllUsers { get; set; }
|
||||||
|
|
||||||
public bool IsLoaded { get; set; }
|
public bool IsLoaded { get; set; }
|
||||||
public bool IsLoading { get; set; }
|
public bool IsLoading { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public interface IManageDataService
|
|||||||
|
|
||||||
Task<List<AnagClie>> GetClienti(WhereCondContact? whereCond = null);
|
Task<List<AnagClie>> GetClienti(WhereCondContact? whereCond = null);
|
||||||
Task<List<PtbPros>> GetProspect(WhereCondContact? whereCond = null);
|
Task<List<PtbPros>> GetProspect(WhereCondContact? whereCond = null);
|
||||||
Task<List<ContactDTO>> GetContact(WhereCondContact whereCond);
|
Task<List<ContactDTO>> GetContact(WhereCondContact whereCond, DateTime? lastSync = null);
|
||||||
Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact);
|
Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact);
|
||||||
|
|
||||||
Task<List<ActivityDTO>> GetActivityTryLocalDb(WhereCondActivity whereCond);
|
Task<List<ActivityDTO>> GetActivityTryLocalDb(WhereCondActivity whereCond);
|
||||||
@@ -21,6 +21,7 @@ public interface IManageDataService
|
|||||||
Task InsertOrUpdate<T>(T objectToSave);
|
Task InsertOrUpdate<T>(T objectToSave);
|
||||||
Task InsertOrUpdate<T>(List<T> listToSave);
|
Task InsertOrUpdate<T>(List<T> listToSave);
|
||||||
|
|
||||||
|
Task DeleteProspect(string codPpro);
|
||||||
Task Delete<T>(T objectToDelete);
|
Task Delete<T>(T objectToDelete);
|
||||||
Task DeleteActivity(ActivityDTO activity);
|
Task DeleteActivity(ActivityDTO activity);
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public class PreloadService(IManageDataService manageData, UserListState userSta
|
|||||||
|
|
||||||
userState.GroupedUserList = BuildGroupedList(sorted);
|
userState.GroupedUserList = BuildGroupedList(sorted);
|
||||||
userState.FilteredGroupedUserList = userState.GroupedUserList;
|
userState.FilteredGroupedUserList = userState.GroupedUserList;
|
||||||
|
userState.AllUsers = users;
|
||||||
|
|
||||||
userState.NotifyUsersLoaded();
|
userState.NotifyUsersLoaded();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,12 @@
|
|||||||
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
|
<PackageReference Include="CodeBeam.MudBlazor.Extensions" Version="8.2.2" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="IntegryApiClient.Core" Version="1.2.1" />
|
<PackageReference Include="IntegryApiClient.Core" Version="1.2.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.9" />
|
||||||
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.81" />
|
<PackageReference Include="Microsoft.Maui.Essentials" Version="9.0.110" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.12.1" />
|
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.14.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.9" />
|
||||||
<PackageReference Include="MudBlazor" Version="8.6.0" />
|
<PackageReference Include="MudBlazor" Version="8.12.0" />
|
||||||
<PackageReference Include="MudBlazor.ThemeManager" Version="3.0.0" />
|
<PackageReference Include="MudBlazor.ThemeManager" Version="3.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ public class ManageDataService : IManageDataService
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<List<ContactDTO>> GetContact(WhereCondContact whereCond, DateTime? lastSync = null)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public Task<List<ContactDTO>> GetContact(WhereCondContact whereCond)
|
public Task<List<ContactDTO>> GetContact(WhereCondContact whereCond)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@@ -54,6 +59,11 @@ public class ManageDataService : IManageDataService
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task DeleteProspect(string codPpro)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public Task Delete<T>(T objectToDelete)
|
public Task Delete<T>(T objectToDelete)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="IntegryApiClient.Blazor" Version="1.2.1" />
|
<PackageReference Include="IntegryApiClient.Blazor" Version="1.2.1" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.Authorization" Version="9.0.9" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.9" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.6" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.9" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user