generated from Integry/Template_NetMauiBlazorHybrid
Compare commits
1 Commits
master
...
feature/Na
| Author | SHA1 | Date | |
|---|---|---|---|
| ddc596ef58 |
@@ -1,15 +1,15 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
public App(IMessenger messenger)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
protected override Window CreateWindow(IActivationState? activationState)
|
||||
{
|
||||
return new Window(new MainPage());
|
||||
MainPage = new NavigationPage(new MainPage(messenger));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Maui.Core.RestClient.IntegryApi.Dto;
|
||||
|
||||
public class RegisterDeviceDTO
|
||||
{
|
||||
[JsonPropertyName("userDeviceToken")]
|
||||
public WtbUserDeviceTokenDTO UserDeviceToken { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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; }
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
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>();
|
||||
var storagePerm = await Permissions.RequestAsync<Permissions.StorageWrite>();
|
||||
|
||||
if (cameraPerm != PermissionStatus.Granted || storagePerm != PermissionStatus.Granted)
|
||||
return null;
|
||||
|
||||
FileResult? result = null;
|
||||
|
||||
try
|
||||
{
|
||||
result = await MediaPicker.Default.CapturePhotoAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore cattura foto: {ex.Message}");
|
||||
SentrySdk.CaptureException(ex);
|
||||
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}");
|
||||
SentrySdk.CaptureException(ex);
|
||||
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}");
|
||||
SentrySdk.CaptureException(e);
|
||||
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)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,7 @@ 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()
|
||||
@@ -34,17 +31,11 @@ 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)
|
||||
{
|
||||
|
||||
@@ -1,259 +1,20 @@
|
||||
using AutoMapper;
|
||||
using System.Linq.Expressions;
|
||||
using salesbook.Shared.Core.Dto;
|
||||
using salesbook.Shared.Core.Dto.Activity;
|
||||
using salesbook.Shared.Core.Dto.Contact;
|
||||
using salesbook.Shared.Core.Dto.PageState;
|
||||
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 IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class ManageDataService(
|
||||
LocalDbService localDb,
|
||||
IMapper mapper,
|
||||
UserListState userListState,
|
||||
IIntegryApiService integryApiService,
|
||||
INetworkService networkService,
|
||||
IUserSession userSession
|
||||
) : IManageDataService
|
||||
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<AnagClie>> GetClienti(WhereCondContact? whereCond)
|
||||
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
||||
{
|
||||
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)
|
||||
{
|
||||
whereCond ??= new WhereCondContact();
|
||||
|
||||
// Ottengo liste locali
|
||||
var contactList = await localDb.Get<AnagClie>(x =>
|
||||
(whereCond.FlagStato != null && x.FlagStato == whereCond.FlagStato) ||
|
||||
(whereCond.PartIva != null && x.PartIva == whereCond.PartIva) ||
|
||||
(whereCond.PartIva == null && whereCond.FlagStato == null)
|
||||
);
|
||||
|
||||
var prospectList = await localDb.Get<PtbPros>(x =>
|
||||
(whereCond.PartIva != null && x.PartIva == whereCond.PartIva) ||
|
||||
(whereCond.PartIva == null)
|
||||
);
|
||||
|
||||
if (networkService.ConnectionAvailable)
|
||||
{
|
||||
var clienti = await integryApiService.RetrieveAnagClie(
|
||||
new CRMAnagRequestDTO
|
||||
{
|
||||
CodAnag = whereCond.CodAnag,
|
||||
FlagStato = whereCond.FlagStato,
|
||||
PartIva = whereCond.PartIva,
|
||||
ReturnPersRif = !whereCond.OnlyContact,
|
||||
FilterDate = lastSync
|
||||
}
|
||||
);
|
||||
|
||||
var prospect = await integryApiService.RetrieveProspect(
|
||||
new CRMProspectRequestDTO
|
||||
{
|
||||
CodPpro = whereCond.CodAnag,
|
||||
PartIva = whereCond.PartIva,
|
||||
ReturnPersRif = !whereCond.OnlyContact,
|
||||
FilterDate = lastSync
|
||||
}
|
||||
);
|
||||
|
||||
_ = UpdateDbUsers(new UsersSyncResponseDTO
|
||||
{
|
||||
AnagClie = clienti.AnagClie,
|
||||
VtbDest = clienti.VtbDest,
|
||||
VtbCliePersRif = clienti.VtbCliePersRif,
|
||||
PtbPros = prospect.PtbPros,
|
||||
PtbProsRif = prospect.PtbProsRif
|
||||
});
|
||||
|
||||
if (lastSync != null)
|
||||
{
|
||||
contactList = MergeLists(
|
||||
contactList,
|
||||
clienti.AnagClie,
|
||||
x => x.CodAnag
|
||||
);
|
||||
|
||||
prospectList = MergeLists(
|
||||
prospectList,
|
||||
prospect.PtbPros,
|
||||
x => x.CodPpro
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
contactList = clienti.AnagClie;
|
||||
prospectList = prospect.PtbPros;
|
||||
}
|
||||
}
|
||||
|
||||
// Mappa i contatti
|
||||
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
||||
|
||||
// Mappa i prospect
|
||||
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
|
||||
|
||||
contactMapper.AddRange(prospectMapper);
|
||||
|
||||
return contactMapper;
|
||||
}
|
||||
|
||||
private static List<T>? MergeLists<T, TKey>(List<T>? localList, List<T>? apiList, Func<T, TKey> keySelector)
|
||||
{
|
||||
if (localList == null || apiList == null) return null;
|
||||
|
||||
var dictionary = localList.ToDictionary(keySelector);
|
||||
|
||||
foreach (var apiItem in apiList)
|
||||
{
|
||||
var key = keySelector(apiItem);
|
||||
dictionary[key] = apiItem;
|
||||
}
|
||||
|
||||
return dictionary.Values.ToList();
|
||||
}
|
||||
|
||||
public async Task<ContactDTO?> GetSpecificContact(string codAnag, bool isContact)
|
||||
{
|
||||
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)
|
||||
{
|
||||
var activities = await localDb.Get<StbActivity>(x =>
|
||||
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
|
||||
(whereCond.Start != null && whereCond.End != null && x.EffectiveTime == null &&
|
||||
x.EstimatedTime >= whereCond.Start && x.EstimatedTime <= whereCond.End) ||
|
||||
(x.EffectiveTime >= whereCond.Start && x.EffectiveTime <= 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);
|
||||
}
|
||||
else return [];
|
||||
|
||||
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 return await GetActivityTryLocalDb(whereCond);
|
||||
|
||||
return await MapActivity(activities);
|
||||
}
|
||||
|
||||
public async Task<List<ActivityDTO>> MapActivity(List<StbActivity>? activities)
|
||||
{
|
||||
if (activities == null) return [];
|
||||
var activities = await localDb.Get(whereCond);
|
||||
|
||||
var codJcomList = activities
|
||||
.Select(x => x.CodJcom)
|
||||
@@ -261,40 +22,23 @@ public class ManageDataService(
|
||||
.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);
|
||||
|
||||
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 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 =>
|
||||
{
|
||||
if (activity.CodJcom is "0000" && userSession.ProfileDb != null &&
|
||||
userSession.ProfileDb.Equals("smetar", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
activity.CodJcom = null;
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -308,14 +52,16 @@ public class ManageDataService(
|
||||
{
|
||||
string? ragSoc;
|
||||
|
||||
if (distinctUser != null && (distinctUser.TryGetValue(activity.CodAnag, out ragSoc) ||
|
||||
distinctUser.TryGetValue(activity.CodAnag, out ragSoc)))
|
||||
if (distinctClient.TryGetValue(activity.CodAnag, out ragSoc) ||
|
||||
distinctProspect.TryGetValue(activity.CodAnag, out ragSoc))
|
||||
{
|
||||
dto.Cliente = ragSoc;
|
||||
}
|
||||
}
|
||||
|
||||
dto.Commessa = jtbComtList.Find(x => x.CodJcom.Equals(dto.CodJcom));
|
||||
dto.Commessa = activity.CodJcom != null && commesseDict.TryGetValue(activity.CodJcom, out var descr)
|
||||
? descr
|
||||
: null;
|
||||
return dto;
|
||||
})
|
||||
.ToList();
|
||||
@@ -323,71 +69,9 @@ public class ManageDataService(
|
||||
return returnDto;
|
||||
}
|
||||
|
||||
private Task UpdateDbUsers(UsersSyncResponseDTO response)
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.Message);
|
||||
SentrySdk.CaptureException(e);
|
||||
throw;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
||||
15
salesbook.Maui/Core/Services/NavigationService.cs
Normal file
15
salesbook.Maui/Core/Services/NavigationService.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class NavigationService(IServiceProvider serviceProvider) : INavigationService
|
||||
{
|
||||
public async Task NavigateToDetailsAsync()
|
||||
{
|
||||
var detailsPage = serviceProvider.GetService<PersonalInfo>();
|
||||
if (Application.Current.MainPage is NavigationPage nav && detailsPage != null)
|
||||
{
|
||||
await nav.Navigation.PushAsync(detailsPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,11 @@
|
||||
using salesbook.Shared.Core.Interface;
|
||||
using salesbook.Shared.Core.Interface.System.Network;
|
||||
|
||||
namespace salesbook.Maui.Core.System.Network;
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class NetworkService : INetworkService
|
||||
{
|
||||
public bool ConnectionAvailable { get; set; }
|
||||
|
||||
public bool IsNetworkAvailable()
|
||||
{
|
||||
//return false;
|
||||
return Connectivity.Current.NetworkAccess == NetworkAccess.Internet;
|
||||
}
|
||||
|
||||
18
salesbook.Maui/Core/Services/PageTitleService.cs
Normal file
18
salesbook.Maui/Core/Services/PageTitleService.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using salesbook.Shared.Core.Interface;
|
||||
|
||||
namespace salesbook.Maui.Core.Services;
|
||||
|
||||
public class PageTitleService(IDispatcher dispatcher) : IPageTitleService
|
||||
{
|
||||
public void SetTitle(string title)
|
||||
{
|
||||
dispatcher.Dispatch(() =>
|
||||
{
|
||||
if (Application.Current?.MainPage is NavigationPage nav &&
|
||||
nav.CurrentPage is ContentPage cp)
|
||||
{
|
||||
cp.Title = title;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,21 @@
|
||||
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 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);
|
||||
@@ -17,6 +27,46 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
||||
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)
|
||||
@@ -30,16 +80,7 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
||||
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!);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using salesbook.Shared.Core.Interface.System;
|
||||
|
||||
namespace salesbook.Maui.Core.System;
|
||||
|
||||
public class GenericSystemService : IGenericSystemService
|
||||
{
|
||||
public string GetCurrentAppVersion() => AppInfo.VersionString;
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
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();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<linker>
|
||||
<assembly fullname="salesbook.Shared" preserve="all" />
|
||||
|
||||
<assembly fullname="System.Private.CoreLib">
|
||||
<type fullname="System.Runtime.InteropServices.SafeHandle" preserve="all" />
|
||||
<type fullname="System.IO.FileStream" preserve="all" />
|
||||
</assembly>
|
||||
|
||||
<assembly fullname="SourceGear.sqlite3" preserve="all"/>
|
||||
<assembly fullname="sqlite-net-e" preserve="all"/>
|
||||
|
||||
<assembly fullname="Sentry.Maui" preserve="all"/>
|
||||
<assembly fullname="Shiny.Hosting.Maui" preserve="all"/>
|
||||
<assembly fullname="Shiny.Notifications" preserve="all"/>
|
||||
<assembly fullname="Shiny.Push" preserve="all"/>
|
||||
</linker>
|
||||
@@ -1,12 +1,11 @@
|
||||
<?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: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">
|
||||
<BlazorWebView HostPage="wwwroot/index.html">
|
||||
<BlazorWebView.RootComponents>
|
||||
<RootComponent Selector="#app" ComponentType="{x:Type shared:Components.Routes}" />
|
||||
</BlazorWebView.RootComponents>
|
||||
|
||||
@@ -1,10 +1,25 @@
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using salesbook.Shared.Core.Messages.Back;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public partial class MainPage : ContentPage
|
||||
{
|
||||
public MainPage()
|
||||
private readonly IMessenger _messenger;
|
||||
|
||||
public MainPage(IMessenger messenger)
|
||||
{
|
||||
InitializeComponent();
|
||||
_messenger = messenger;
|
||||
|
||||
Title = "Home";
|
||||
}
|
||||
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
_messenger.Send(new HardwareBackMessage("back"));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,29 +5,15 @@ 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;
|
||||
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;
|
||||
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;
|
||||
using System.Globalization;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
@@ -35,25 +21,19 @@ namespace salesbook.Maui
|
||||
{
|
||||
private const string AppToken = "f0484398-1f8b-42f5-ab79-5282c164e1d8";
|
||||
|
||||
public static MauiAppBuilder CreateMauiAppBuilder()
|
||||
public static MauiApp CreateMauiApp()
|
||||
{
|
||||
InteractiveRenderSettings.ConfigureBlazorHybridRenderModes();
|
||||
|
||||
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("it-IT");
|
||||
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("it-IT");
|
||||
|
||||
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"); });
|
||||
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); })
|
||||
.UseLoginAzienda(AppToken);
|
||||
|
||||
builder.Services.AddMauiBlazorWebView();
|
||||
builder.Services.AddMudServices();
|
||||
@@ -66,35 +46,16 @@ namespace salesbook.Maui
|
||||
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<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>();
|
||||
builder.Services.AddScoped<IMessenger, WeakReferenceMessenger>();
|
||||
builder.Services.AddScoped<NewActivityService>();
|
||||
builder.Services.AddScoped<BackNavigationService>();
|
||||
builder.Services.AddScoped<CopyActivityService>();
|
||||
|
||||
#if DEBUG
|
||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||
@@ -102,15 +63,13 @@ namespace salesbook.Maui
|
||||
#endif
|
||||
|
||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
||||
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
||||
builder.Services.AddSingleton<IGenericSystemService, GenericSystemService>();
|
||||
builder.Services.AddSingleton<LocalDbService>();
|
||||
|
||||
_ = typeof(System.Runtime.InteropServices.SafeHandle);
|
||||
_ = typeof(System.IO.FileStream);
|
||||
builder.Services.AddSingleton<INavigationService, NavigationService>();
|
||||
builder.Services.AddSingleton<IPageTitleService, PageTitleService>();
|
||||
builder.Services.AddTransient<PersonalInfo>();
|
||||
|
||||
return builder;
|
||||
return builder.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
salesbook.Maui/PersonalInfo.xaml
Normal file
14
salesbook.Maui/PersonalInfo.xaml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?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:components="clr-namespace:salesbook.Shared.Components;assembly=salesbook.Shared"
|
||||
x:Class="salesbook.Maui.PersonalInfo"
|
||||
BackgroundColor="{DynamicResource PageBackgroundColor}">
|
||||
|
||||
<BlazorWebView HostPage="wwwroot/index.html" StartPath="/PersonalInfo">
|
||||
<BlazorWebView.RootComponents>
|
||||
<RootComponent Selector="#app" ComponentType="{x:Type components:Routes}" />
|
||||
</BlazorWebView.RootComponents>
|
||||
</BlazorWebView>
|
||||
|
||||
</ContentPage>
|
||||
11
salesbook.Maui/PersonalInfo.xaml.cs
Normal file
11
salesbook.Maui/PersonalInfo.xaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace salesbook.Maui;
|
||||
|
||||
public partial class PersonalInfo : ContentPage
|
||||
{
|
||||
public PersonalInfo()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
Title = "Profilo";
|
||||
}
|
||||
}
|
||||
@@ -1,57 +1,6 @@
|
||||
<?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">
|
||||
|
||||
<!-- Firebase push -->
|
||||
<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>
|
||||
|
||||
<!-- Rete -->
|
||||
<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" />
|
||||
|
||||
<!-- Geolocalizzazione -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
|
||||
<!-- Fotocamera -->
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<!-- Storage / Media -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- Android 10+ -->
|
||||
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||
|
||||
<!-- Android 13+ -->
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
|
||||
<!-- Background / Notifiche -->
|
||||
<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>
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
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); });
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,18 @@
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using AndroidX.AppCompat.App;
|
||||
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
[Activity(
|
||||
Theme = "@style/Maui.SplashTheme",
|
||||
[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)
|
||||
public MainActivity()
|
||||
{
|
||||
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);
|
||||
AppCompatDelegate.DefaultNightMode = AppCompatDelegate.ModeNightNo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
using Android.App;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace salesbook.Maui;
|
||||
|
||||
[Application(HardwareAccelerated = true)]
|
||||
public class MainApplication : MauiApplication
|
||||
namespace salesbook.Maui
|
||||
{
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
[Application]
|
||||
public class MainApplication : MauiApplication
|
||||
{
|
||||
}
|
||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||
: base(handle, ownership)
|
||||
{
|
||||
}
|
||||
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiAppBuilder()
|
||||
.RegisterAndroidAppServices().Build();
|
||||
}
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,10 @@
|
||||
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);
|
||||
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
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)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -36,27 +36,7 @@
|
||||
<true/>
|
||||
</dict>
|
||||
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
<string>Questa app utilizza la tua posizione per migliorare alcune funzionalità basate sulla localizzazione.</string>
|
||||
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Questa app utilizza la tua posizione solo mentre è in uso 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>NSBluetoothAlwaysUsageDescription</key>
|
||||
<string>Alcune librerie di sistema potrebbero accedere al Bluetooth. L’app non utilizza direttamente il Bluetooth.</string>
|
||||
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UIUserInterfaceStyle</key>
|
||||
<string>Light</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
<?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>NSPrivacyAccessedAPICategoryUserDefaults</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>CA92.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>NSPrivacyAccessedAPICategoryFileTimestamp</string>
|
||||
<key>NSPrivacyAccessedAPITypeReasons</key>
|
||||
<array>
|
||||
<string>C617.1</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>NSPrivacyCollectedDataTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeCrashData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypePerformanceData</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<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>NSPrivacyCollectedDataTypePreciseLocation</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypeCoarseLocation</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>NSPrivacyCollectedDataType</key>
|
||||
<string>NSPrivacyCollectedDataTypePhotosorVideos</string>
|
||||
<key>NSPrivacyCollectedDataTypeLinked</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypeTracking</key>
|
||||
<false />
|
||||
<key>NSPrivacyCollectedDataTypePurposes</key>
|
||||
<array>
|
||||
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,13 +0,0 @@
|
||||
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,8 +1 @@
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 456 456" width="456" height="456">
|
||||
<defs>
|
||||
<image width="456" height="456" id="img1" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcgAAAHIAQMAAADwb+ipAAAAAXNSR0IB2cksfwAAAANQTFRF3/L/KicjZQAAAGhJREFUeJztyzENAAAMA6DVv+l5aHrCT64V0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN0zRN05zNB6OcAcm2KNubAAAAAElFTkSuQmCC"/>
|
||||
</defs>
|
||||
<style>
|
||||
</style>
|
||||
<use id="Background" href="#img1" x="0" y="0"/>
|
||||
</svg>
|
||||
<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>
|
||||
|
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 201 B |
@@ -1,10 +1 @@
|
||||
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="1024" height="1024">
|
||||
<defs>
|
||||
<image width="920" height="920" id="img1" href="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDIzMCAyMzAiIHdpZHRoPSIyMzAiIGhlaWdodD0iMjMwIj48c3R5bGU+LmF7ZmlsbDpub25lO3N0cm9rZTojMDAyMzM5O3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6MTZ9LmJ7ZmlsbDpub25lO3N0cm9rZTojMDBhMGRlO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6MTZ9PC9zdHlsZT48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJhIiBkPSJtMTE5LjkgNzEuNGgzNC40YzIwLjMgMCAzNi44IDE2LjUgMzYuOCAzNi45djI4LjNjMCAyMC40LTE2LjUgMzYuOS0zNi44IDM2LjloLTUuMWwwLjEgMzIuMi0zNC43LTMyLjJoLTcyLjIiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsYXNzPSJiIiBkPSJtMTE3LjMgMjRsLTc3LjEgNDcuNHYxMDIuMWw3Ny4xLTQ3LjR2LTEwMi4xeiIvPjwvc3ZnPg=="/>
|
||||
</defs>
|
||||
<style>
|
||||
</style>
|
||||
<g>
|
||||
<use id="appiconfg" href="#img1" transform="matrix(1.113,0,0,1.113,0,0)"/>
|
||||
</g>
|
||||
</svg>
|
||||
<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>
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 529 B |
@@ -1,29 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
||||
@@ -29,8 +29,8 @@
|
||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||
|
||||
<!-- Versions -->
|
||||
<ApplicationDisplayVersion>2.2.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>24</ApplicationVersion>
|
||||
<ApplicationDisplayVersion>1.0.0</ApplicationDisplayVersion>
|
||||
<ApplicationVersion>3</ApplicationVersion>
|
||||
|
||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
@@ -78,21 +78,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
|
||||
<CodesignKey>Apple Distribution: Integry S.r.l. (UNP26J4R89)</CodesignKey>
|
||||
<CodesignProvision>salesbook</CodesignProvision>
|
||||
<ProvisioningType>manual</ProvisioningType>
|
||||
<CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey>
|
||||
<CodesignProvision>VS: WildCard Development</CodesignProvision>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="$(TargetFramework.Contains('-ios'))">
|
||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||
<!--
|
||||
// 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" />
|
||||
-->
|
||||
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
||||
|
||||
<CustomEntitlements Include="keychain-access-groups" Type="StringArray" Value="%24(AppIdentifierPrefix)$(ApplicationId)" 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'">
|
||||
@@ -105,29 +102,6 @@
|
||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BlazorWebAssemblyLazyLoad Include="salesbook.Shared.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<RunAOTCompilation>true</RunAOTCompilation>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios' and '$(Configuration)'=='Release'">
|
||||
<UseInterpreter>true</UseInterpreter>
|
||||
<RunAOTCompilation>true</RunAOTCompilation>
|
||||
<PublishTrimmed>true</PublishTrimmed>
|
||||
<PublishAot>true</PublishAot>
|
||||
<MonoAotMode>Hybrid</MonoAotMode>
|
||||
<MtouchLink>None</MtouchLink>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<TrimmerRootAssembly Include="salesbook.Shared" RootMode="All" />
|
||||
<TrimmerRootDescriptor Include="ILLink.Descriptors.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Splash Screen -->
|
||||
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#dff2ff" BaseSize="128,128" />
|
||||
@@ -143,35 +117,32 @@
|
||||
<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="12.2.0" />
|
||||
<PackageReference Include="CommunityToolkit.Maui" Version="11.2.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.2.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.10" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.120" />
|
||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.120" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.120" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.10" />
|
||||
<PackageReference Include="Sentry.Maui" Version="5.16.1" />
|
||||
<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="SourceGear.sqlite3" Version="3.50.4.2" />
|
||||
<PackageReference Include="sqlite-net-e" Version="1.10.0-beta2" />
|
||||
<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="sqlite-net-pcl" Version="1.9.172" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\salesbook.Shared\salesbook.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="PersonalInfo.xaml.cs">
|
||||
<DependentUpon>PersonalInfo.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<MauiXaml Update="PersonalInfo.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -53,7 +53,6 @@
|
||||
<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>
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<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; }
|
||||
}
|
||||
@@ -1,62 +1,53 @@
|
||||
@using Microsoft.Maui.Controls
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IJSRuntime JS
|
||||
@inject INavigationService NavigationService
|
||||
|
||||
<div class="@(Back ? "" : "container") header">
|
||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||
@if (!SmallHeader)
|
||||
@if (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())
|
||||
{
|
||||
<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)
|
||||
{
|
||||
@if (ShowFilter)
|
||||
{
|
||||
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
|
||||
}
|
||||
<MudIconButton OnClick="OnFilterToggle" Icon="@Icons.Material.Outlined.FilterAlt"/>
|
||||
}
|
||||
|
||||
@* @if (ShowCalendarToggle)
|
||||
@* @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
|
||||
@if (ShowProfile)
|
||||
{
|
||||
<MudButton OnClick="OnSave"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@LabelSave
|
||||
</MudButton>
|
||||
<MudIconButton Class="user" OnClick="OpenPersonalInfo" Icon="@Icons.Material.Filled.Person"/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>@Title</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => GoBack()" />
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudButton OnClick="OnSave"
|
||||
Color="Color.Info"
|
||||
Style="text-transform: none"
|
||||
Variant="Variant.Text">
|
||||
@LabelSave
|
||||
</MudButton>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -78,8 +69,6 @@
|
||||
[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;
|
||||
@@ -97,7 +86,9 @@
|
||||
await JS.InvokeVoidAsync("goBack");
|
||||
}
|
||||
|
||||
private void OpenPersonalInfo() =>
|
||||
NavigationManager.NavigateTo("/PersonalInfo");
|
||||
private async Task OpenPersonalInfo()
|
||||
{
|
||||
await NavigationService.NavigateToDetailsAsync();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,4 @@
|
||||
.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;
|
||||
@@ -14,8 +6,6 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.header-content > .title { width: 100%; }
|
||||
|
||||
.header-content.with-back .page-title {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
|
||||
@@ -1,20 +1,16 @@
|
||||
@using System.Globalization
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Messages.Back
|
||||
@inherits LayoutComponentBase
|
||||
@inject IJSRuntime JS
|
||||
@inject BackNavigationService BackService
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject INavigationService NavigationService
|
||||
|
||||
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
|
||||
<MudPopoverProvider/>
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
|
||||
<ConnectionState IsNetworkAvailable="IsNetworkAvailable" ServicesIsDown="ServicesIsDown" ShowWarning="ShowWarning" />
|
||||
|
||||
<div class="page">
|
||||
<NavMenu/>
|
||||
|
||||
@@ -23,6 +19,7 @@
|
||||
@Body
|
||||
</article>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
@@ -30,49 +27,6 @@
|
||||
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()
|
||||
@@ -127,9 +81,6 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_cts = new CancellationTokenSource();
|
||||
_ = CheckConnectionState(_cts.Token);
|
||||
|
||||
BackService.OnHardwareBack += async () => { await JS.InvokeVoidAsync("goBack"); };
|
||||
|
||||
var culture = new CultureInfo("it-IT", false);
|
||||
@@ -138,40 +89,4 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +1,14 @@
|
||||
@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 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">
|
||||
@@ -38,14 +28,12 @@
|
||||
</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>
|
||||
<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>
|
||||
@@ -54,11 +42,11 @@
|
||||
{
|
||||
<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"/>
|
||||
<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>
|
||||
<MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem>
|
||||
<MudMenuItem OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
|
||||
</ChildContent>
|
||||
</MudMenu>
|
||||
}
|
||||
@@ -72,16 +60,16 @@
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
InitMessage();
|
||||
CopyActivityService.OnCopyActivity += async dto => await CreateActivity(dto);
|
||||
|
||||
NavigationManager.LocationChanged += (_, args) =>
|
||||
NavigationManager.LocationChanged += (_, args) =>
|
||||
{
|
||||
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
||||
|
||||
var newIsVisible = new List<string> { "Calendar", "Users", "Notifications", "Commessa" }
|
||||
var newIsVisible = new List<string> { "Calendar", "Users", "Notifications" }
|
||||
.Contains(location);
|
||||
|
||||
var newPlusVisible = new List<string> { "Calendar", "Users", "Commessa" }
|
||||
var newPlusVisible = new List<string> { "Calendar", "Users" }
|
||||
.Contains(location);
|
||||
|
||||
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
|
||||
@@ -104,27 +92,5 @@
|
||||
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(150%); }
|
||||
.animated-navbar.hide-nav { transform: translateY(100%); }
|
||||
|
||||
.animated-navbar.with-plus { margin-left: 30px; }
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<MudOverlay Visible="Visible" DarkBackground="false">
|
||||
<div class="overlay-container">
|
||||
<span>Caricamento</span>
|
||||
|
||||
<MudProgressLinear Color="Color.Primary" Rounded="true" Size="Size.Medium" Indeterminate="true" />
|
||||
</div>
|
||||
</MudOverlay>
|
||||
|
||||
@code
|
||||
{
|
||||
[Parameter] public bool Visible { get; set; }
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
.overlay-container {
|
||||
background: var(--mud-palette-background);
|
||||
width: 20rem;
|
||||
height: 6rem;
|
||||
padding: 0 1rem;
|
||||
display: flex;
|
||||
gap: .5rem;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
border-radius: 20px;
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
}
|
||||
|
||||
.overlay-container > span {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
}
|
||||
@@ -1,22 +1,20 @@
|
||||
@page "/Calendar"
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Messages.Activity.New
|
||||
@inject IManageDataService ManageData
|
||||
@inject IJSRuntime JS
|
||||
@inject NewActivityService NewActivity
|
||||
@inject UserListState UserState
|
||||
@inject IPageTitleService PageTitleService
|
||||
|
||||
<HeaderLayout Title="@_headerTitle"
|
||||
@* <HeaderLayout Title="@_headerTitle"
|
||||
ShowFilter="true"
|
||||
ShowCalendarToggle="true"
|
||||
OnFilterToggle="ToggleFilter"
|
||||
OnCalendarToggle="ToggleExpanded"/>
|
||||
OnCalendarToggle="ToggleExpanded"/> *@
|
||||
|
||||
<div @ref="_weekSliderRef" class="container week-slider @(Expanded ? "expanded" : "") @(SliderAnimation)">
|
||||
@if (Expanded)
|
||||
@@ -170,6 +168,7 @@
|
||||
<FilterActivity @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="ApplyFilter"/>
|
||||
|
||||
@code {
|
||||
|
||||
// Modelli per ottimizzazione rendering
|
||||
private record DayData(DateTime Date, string CssClass, bool HasEvents, CategoryData[] EventCategories, string DayName = "");
|
||||
|
||||
@@ -181,7 +180,7 @@
|
||||
private string _headerTitle = string.Empty;
|
||||
private readonly Dictionary<DateTime, List<ActivityDTO>> _eventsCache = new();
|
||||
private readonly Dictionary<DateTime, CategoryData[]> _categoriesCache = new();
|
||||
private bool _isInitialized;
|
||||
private bool _isInitialized = false;
|
||||
|
||||
// Stato UI
|
||||
private bool Expanded { get; set; }
|
||||
@@ -222,20 +221,11 @@
|
||||
PrepareRenderingData();
|
||||
|
||||
NewActivity.OnActivityCreated += async activityId => await OnActivityCreated(activityId);
|
||||
UserState.OnUsersLoaded += async () => await InvokeAsync(LoadData);
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender && UserState.IsLoaded)
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (!_isInitialized)
|
||||
if (firstRender)
|
||||
{
|
||||
Filter.User = new HashSet<string> { UserSession.User.Username };
|
||||
|
||||
@@ -269,6 +259,8 @@
|
||||
private void PrepareHeaderTitle()
|
||||
{
|
||||
_headerTitle = CurrentMonth.ToString("MMMM yyyy", new System.Globalization.CultureInfo("it-IT")).FirstCharToUpper();
|
||||
PageTitleService?.SetTitle(_headerTitle);
|
||||
|
||||
}
|
||||
|
||||
private void PrepareEventsCache()
|
||||
@@ -278,7 +270,7 @@
|
||||
|
||||
// Raggruppa le attività per data
|
||||
var activitiesByDate = MonthActivities
|
||||
.GroupBy(x => (x.EffectiveTime ?? x.EstimatedTime!).Value.Date)
|
||||
.GroupBy(x => (x.EffectiveDate ?? x.EstimatedDate!).Value.Date)
|
||||
.ToDictionary(g => g.Key, g => g.ToList());
|
||||
|
||||
foreach (var (date, activities) in activitiesByDate)
|
||||
@@ -381,9 +373,7 @@
|
||||
filteredActivity = filteredActivity
|
||||
.Where(x => Filter.Category == null || x.Category.Equals(Filter.Category));
|
||||
|
||||
return filteredActivity
|
||||
.OrderBy(x => x.EffectiveTime ?? x.EstimatedTime)
|
||||
.ToList();
|
||||
return filteredActivity.ToList();
|
||||
}
|
||||
|
||||
[JSInvokable]
|
||||
@@ -481,8 +471,10 @@
|
||||
|
||||
var start = CurrentMonth;
|
||||
var end = start.AddDays(DaysInMonth - 1);
|
||||
var activities = await ManageData.GetActivity(new WhereCondActivity{Start = start, End = end});
|
||||
MonthActivities = activities.OrderBy(x => x.EffectiveTime ?? x.EstimatedTime).ToList();
|
||||
var activities = await ManageData.GetActivity(x =>
|
||||
(x.EffectiveDate == null && x.EstimatedDate >= start && x.EstimatedDate <= end) ||
|
||||
(x.EffectiveDate >= start && x.EffectiveDate <= end));
|
||||
MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList();
|
||||
|
||||
PrepareRenderingData();
|
||||
IsLoading = false;
|
||||
@@ -492,8 +484,6 @@
|
||||
// Selezione giorno in settimana
|
||||
private async Task SelezionaData(DateTime day)
|
||||
{
|
||||
if (IsLoading) return;
|
||||
|
||||
SelectedDate = day;
|
||||
|
||||
var cacheInternalMonth = _internalMonth;
|
||||
@@ -515,8 +505,6 @@
|
||||
// Selezione giorno dal mese (chiude la vista mese!)
|
||||
private async Task SelezionaDataDalMese(DateTime day)
|
||||
{
|
||||
if (IsLoading) return;
|
||||
|
||||
SelectedDate = day;
|
||||
SliderAnimation = "collapse-animation";
|
||||
Expanded = false;
|
||||
@@ -553,7 +541,7 @@
|
||||
|
||||
await ManageData.DeleteActivity(activity);
|
||||
|
||||
var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId!.Equals(activity.ActivityId));
|
||||
var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId.Equals(activity.ActivityId));
|
||||
|
||||
if (indexActivity != null)
|
||||
{
|
||||
@@ -570,7 +558,7 @@
|
||||
{
|
||||
IsLoading = true;
|
||||
|
||||
var activity = (await ManageData.GetActivity(new WhereCondActivity {ActivityId = activityId}, true)).LastOrDefault();
|
||||
var activity = (await ManageData.GetActivity(x => x.ActivityId.Equals(activityId))).LastOrDefault();
|
||||
|
||||
if (activity == null)
|
||||
{
|
||||
@@ -578,7 +566,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var date = activity.EffectiveTime ?? activity.EstimatedTime;
|
||||
var date = activity.EffectiveDate ?? activity.EstimatedDate;
|
||||
|
||||
if (CurrentMonth.Month != date!.Value.Month)
|
||||
{
|
||||
@@ -595,7 +583,7 @@
|
||||
|
||||
private async Task OnActivityChanged(string activityId)
|
||||
{
|
||||
var newActivity = await ManageData.GetActivity(new WhereCondActivity { ActivityId = activityId }, true);
|
||||
var newActivity = await ManageData.GetActivity(x => x.ActivityId.Equals(activityId));
|
||||
var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId.Equals(activityId));
|
||||
|
||||
if (indexActivity != null && !newActivity.IsNullOrEmpty())
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
padding-bottom: 1rem;
|
||||
overflow-x: hidden;
|
||||
overflow-y: visible;
|
||||
min-height: 7rem;
|
||||
}
|
||||
|
||||
.week-slider.expanded {
|
||||
@@ -32,7 +31,7 @@
|
||||
grid-template-columns: repeat(7, 1fr);
|
||||
gap: 0.4rem;
|
||||
padding: 1rem;
|
||||
overflow-y: hidden;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.week-slider.expand-animation { animation: expandFromCenter 0.3s ease forwards; }
|
||||
@@ -80,12 +79,13 @@
|
||||
}
|
||||
|
||||
.day {
|
||||
background: var(--mud-palette-surface);
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease, transform 0.2s ease;
|
||||
font-size: 0.95rem;
|
||||
background: var(--mud-palette-background-gray);
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
display: flex;
|
||||
@@ -93,7 +93,7 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: var(--mud-palette-text-primary);
|
||||
border: 1px solid var(--mud-palette-background-gray);
|
||||
border: 1px solid var(--mud-palette-surface);
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,8 @@
|
||||
flex-direction: column;
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
padding-bottom: 9vh;
|
||||
padding-bottom: 70px;
|
||||
height: calc(100% - 130px);
|
||||
}
|
||||
|
||||
.appointments.ah-calendar-m { height: calc(100% - 315px) !important; }
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
@page "/commessa/{CodJcom}"
|
||||
@page "/commessa/{CodJcom}/{RagSoc}"
|
||||
@attribute [Authorize]
|
||||
@using AutoMapper
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Dto.JobProgress
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@inject JobSteps JobSteps
|
||||
@inject IManageDataService ManageData
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject IMapper Mapper
|
||||
|
||||
<HeaderLayout Title="@CodJcom" ShowProfile="false" Back="true" BackTo="Indietro"/>
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
<SpinnerLayout FullScreen="true"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="container content pb-safe-area">
|
||||
@if (CommessaModel == null)
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna commessa trovata"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab1" checked>
|
||||
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab2">
|
||||
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab3">
|
||||
|
||||
<div class="box">
|
||||
<ul class="tab-list">
|
||||
<li class="tab-item"><label class="tab-trigger" for="tab1">Avanzamento</label></li>
|
||||
<li class="tab-item"><label class="tab-trigger" for="tab2">Attività</label></li>
|
||||
<li class="tab-item"><label class="tab-trigger" for="tab3">Allegati</label></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- contenuti -->
|
||||
<div class="tab-container">
|
||||
<div class="tab-content">
|
||||
@if (Steps != null)
|
||||
{
|
||||
<div class="timeline-container">
|
||||
<div class="timeline">
|
||||
@foreach (var step in Steps)
|
||||
{
|
||||
<div class="step">
|
||||
<div class="@(step.Status!.Skip ? "circle skipped" : step.Status!.Progress ? "in-progress" : "circle completed")"></div>
|
||||
<div class="label">
|
||||
<div class="titleStep">@step.StepName</div>
|
||||
@if (step.Date is not null)
|
||||
{
|
||||
<div class="subtitleStep">@($"{step.Date.Value:D}") @(step.Status!.Progress ? "(In corso...)" : "")</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
@if (ActivityIsLoading)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (ActivityList is { Count: > 0 })
|
||||
{
|
||||
<div class="contentFlex">
|
||||
<Virtualize Items="ActivityList" Context="activity">
|
||||
<ActivityCard ShowDate="true" Activity="activity" />
|
||||
</Virtualize>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna attività trovata" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
@if (AttachedIsLoading)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7" />
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (ListAttached != null)
|
||||
{
|
||||
<div class="contentFlex">
|
||||
<Virtualize Items="ListAttached" Context="attached">
|
||||
<AttachCard Attached="attached" />
|
||||
</Virtualize>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessun allegato presente" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public string CodJcom { get; set; } = "";
|
||||
[Parameter] public string RagSoc { get; set; } = "";
|
||||
|
||||
private List<CRMJobStepDTO>? Steps { get; set; }
|
||||
private List<ActivityDTO> ActivityList { get; set; } = [];
|
||||
private List<CRMAttachedResponseDTO>? ListAttached { get; set; }
|
||||
private JtbComt? CommessaModel { get; set; }
|
||||
|
||||
private bool IsLoading { get; set; } = true;
|
||||
private bool ActivityIsLoading { get; set; } = true;
|
||||
private bool AttachedIsLoading { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
CommessaModel = (await ManageData.GetTable<JtbComt>(x => x.CodJcom.Equals(CodJcom))).LastOrDefault();
|
||||
Steps = JobSteps.Steps;
|
||||
|
||||
_ = LoadActivity();
|
||||
_ = LoadAttached();
|
||||
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
private async Task LoadActivity()
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var activities = await IntegryApiService.RetrieveActivity(new CRMRetrieveActivityRequestDTO { CodJcom = CodJcom });
|
||||
ActivityList = (await ManageData.MapActivity(activities)).OrderByDescending(x =>
|
||||
(x.EffectiveTime ?? x.EstimatedTime) ?? x.DataInsAct
|
||||
).ToList();
|
||||
});
|
||||
|
||||
ActivityIsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task LoadAttached()
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
ListAttached = await IntegryApiService.RetrieveAttached(CodJcom);
|
||||
});
|
||||
|
||||
AttachedIsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,229 +0,0 @@
|
||||
/* Container scrollabile */
|
||||
|
||||
.timeline-container {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.timeline {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.5rem;
|
||||
position: relative;
|
||||
padding-left: 40px; /* spazio per linea e cerchi */
|
||||
}
|
||||
|
||||
.step {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 15px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Linea sopra e sotto ogni step */
|
||||
|
||||
.step::before,
|
||||
.step::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: -31px;
|
||||
width: 2px;
|
||||
background: #ddd;
|
||||
}
|
||||
|
||||
.step::after {
|
||||
top: 30%;
|
||||
bottom: -1.5rem;
|
||||
}
|
||||
|
||||
.step:first-child::before { display: none; }
|
||||
|
||||
.step:last-child::after { display: none; }
|
||||
|
||||
/* Cerchio base */
|
||||
|
||||
.circle,
|
||||
.in-progress {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
z-index: 1;
|
||||
margin-left: -40px;
|
||||
background-color: var(--mud-palette-tertiary);
|
||||
}
|
||||
|
||||
/* Stato skippato */
|
||||
|
||||
.skipped { background: #ccc; }
|
||||
|
||||
/* Stato completato */
|
||||
|
||||
.completed {
|
||||
background: var(--mud-palette-primary);
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Stato in corso con spinner */
|
||||
|
||||
.in-progress {
|
||||
border: 2px solid var(--mud-palette-primary);
|
||||
border-top: 2px solid transparent;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Label con titolo + sottotitolo */
|
||||
|
||||
.label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.titleStep {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
color: #111;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.subtitleStep {
|
||||
font-size: .90rem;
|
||||
color: #666;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.timeline-container::-webkit-scrollbar { width: 6px; }
|
||||
|
||||
.timeline-container::-webkit-scrollbar-thumb {
|
||||
background: #bbb;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
/*--------------
|
||||
TabPanel
|
||||
----------------*/
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: -webkit-fill-available;
|
||||
background: var(--light-card-background);
|
||||
border-radius: 16px;
|
||||
overflow: clip;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
/* nascondo gli input */
|
||||
|
||||
.tab-toggle { display: none; }
|
||||
|
||||
.tab-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* la lineetta */
|
||||
|
||||
.tab-list::before {
|
||||
content: '';
|
||||
display: block;
|
||||
height: 3px;
|
||||
width: calc(100% / 3);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--mud-palette-primary);
|
||||
transition: transform .3s;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
transition: .3s;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.tab-trigger {
|
||||
display: block;
|
||||
padding: 10px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* tab attivo */
|
||||
|
||||
#tab1:checked ~ .box .tab-list .tab-item:nth-child(1),
|
||||
#tab2:checked ~ .box .tab-list .tab-item:nth-child(2),
|
||||
#tab3:checked ~ .box .tab-list .tab-item:nth-child(3) {
|
||||
opacity: 1;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* spostamento lineetta */
|
||||
|
||||
#tab1:checked ~ .box .tab-list::before { transform: translateX(0%); }
|
||||
|
||||
#tab2:checked ~ .box .tab-list::before { transform: translateX(100%); }
|
||||
|
||||
#tab3:checked ~ .box .tab-list::before { transform: translateX(200%); }
|
||||
|
||||
.tab-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
width: -webkit-fill-available;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
display: none;
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
animation: fade .3s ease;
|
||||
padding: .5rem;
|
||||
}
|
||||
|
||||
.contentFlex {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.tab-content::-webkit-scrollbar { width: 6px; }
|
||||
|
||||
.tab-content::-webkit-scrollbar-thumb {
|
||||
background: #bbb;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.contentFlex ::deep > div:first-child:not(.activity-card) { display: none; }
|
||||
|
||||
#tab1:checked ~ .tab-container .tab-content:nth-child(1),
|
||||
#tab2:checked ~ .tab-container .tab-content:nth-child(2),
|
||||
#tab3:checked ~ .tab-container .tab-content:nth-child(3) { display: block; }
|
||||
|
||||
@keyframes fade {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(5px);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
@@ -1,75 +1,22 @@
|
||||
@page "/"
|
||||
@attribute [Authorize]
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Core.Interface.System.Notification
|
||||
@using salesbook.Shared.Core.Messages.Notification.Loaded
|
||||
@using salesbook.Shared.Core.Services
|
||||
@attribute [Authorize]
|
||||
@inject IFormFactor FormFactor
|
||||
@inject INetworkService NetworkService
|
||||
@inject IFirebaseNotificationService FirebaseNotificationService
|
||||
@inject IShinyNotificationManager NotificationManager
|
||||
@inject INotificationService NotificationService
|
||||
@inject PreloadService PreloadService
|
||||
@inject IMessenger Messenger
|
||||
|
||||
<SpinnerLayout FullScreen="true"/>
|
||||
|
||||
@code
|
||||
{
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
||||
var syncAllData = lastSyncDate.Equals(DateTime.MinValue) || (DateTime.Now - lastSyncDate).TotalDays >= 7;
|
||||
var syncCodJcom = lastSyncDate.Day != DateTime.Now.Day;
|
||||
|
||||
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && syncAllData)
|
||||
|
||||
if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
|
||||
{
|
||||
var returnPath = System.Web.HttpUtility.UrlEncode("/");
|
||||
NavigationManager.NavigateTo($"/sync?path={returnPath}");
|
||||
return;
|
||||
NavigationManager.NavigateTo("/sync");
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
if (syncCodJcom && !syncAllData)
|
||||
{
|
||||
var returnPath = System.Web.HttpUtility.UrlEncode("/");
|
||||
NavigationManager.NavigateTo($"/sync/{DateTime.Today:yyyy-MM-dd}?path={returnPath}");
|
||||
return;
|
||||
}
|
||||
|
||||
NetworkService.ConnectionAvailable = NetworkService.IsNetworkAvailable();
|
||||
|
||||
await LoadNotification();
|
||||
await CheckAndRequestPermissions();
|
||||
|
||||
try
|
||||
{
|
||||
await FirebaseNotificationService.InitFirebase();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine($"Firebase init: {e.Message}");
|
||||
}
|
||||
|
||||
_ = StartSyncUser();
|
||||
NavigationManager.NavigateTo("/Calendar");
|
||||
}
|
||||
|
||||
private async Task LoadNotification()
|
||||
{
|
||||
await NotificationService.LoadNotification();
|
||||
Messenger.Send(new NotificationsLoadedMessage());
|
||||
}
|
||||
|
||||
private async Task CheckAndRequestPermissions()
|
||||
{
|
||||
await NotificationManager.RequestAccess();
|
||||
}
|
||||
|
||||
private Task StartSyncUser()
|
||||
{
|
||||
return Task.Run(() => { _ = PreloadService.PreloadUsersAsync(); });
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
@page "/login"
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Interface.System
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject IUserAccountService UserAccountService
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject IGenericSystemService GenericSystemService
|
||||
|
||||
@if (Spinner)
|
||||
{
|
||||
@@ -36,7 +34,7 @@ else
|
||||
</div>
|
||||
|
||||
<div class="my-4 login-footer">
|
||||
<span>@($"v{GenericSystemService.GetCurrentAppVersion()} | Powered by")</span>
|
||||
<span>Powered by</span>
|
||||
<img src="_content/salesbook.Shared/images/logoIntegry.svg" class="img-fluid" alt="Integry">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,146 +1,19 @@
|
||||
@page "/Notifications"
|
||||
@attribute [Authorize]
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@using salesbook.Shared.Core.Messages.Notification.Loaded
|
||||
@using salesbook.Shared.Core.Messages.Notification.NewPush
|
||||
@inject NotificationState Notification
|
||||
@inject NewPushNotificationService NewPushNotificationService
|
||||
@inject IJSRuntime JS
|
||||
@inject IIntegryNotificationRestClient IntegryNotificationRestClient
|
||||
@inject INotificationService NotificationService
|
||||
@inject IMessenger Messenger
|
||||
@inject IPageTitleService PageTitleService
|
||||
|
||||
<HeaderLayout Title="Notifiche" />
|
||||
@* <HeaderLayout Title="Notifiche" /> *@
|
||||
|
||||
<div class="container container-notifications">
|
||||
@if (Loading)
|
||||
{
|
||||
<SpinnerLayout FullScreen="true" />
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Notification.ReceivedNotifications.IsNullOrEmpty() && Notification.UnreadNotifications.IsNullOrEmpty() && Notification.NotificationsRead.IsNullOrEmpty())
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna notifica meno recente" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="list" id="list">
|
||||
@foreach(var notification in Notification.ReceivedNotifications)
|
||||
{
|
||||
<NotificationCard Unread="true" Notification="notification" />
|
||||
}
|
||||
|
||||
@foreach(var notification in Notification.UnreadNotifications)
|
||||
{
|
||||
<NotificationCard Unread="true" Notification="notification" />
|
||||
}
|
||||
|
||||
@foreach (var notification in Notification.NotificationsRead)
|
||||
{
|
||||
<NotificationCard Notification="notification" />
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<div class="container">
|
||||
<NoDataAvailable Text="Nessuna notifica meno recente" />
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private DotNetObjectReference<Notifications>? _objectReference;
|
||||
private bool Loading { get; set; }
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
_objectReference = DotNetObjectReference.Create(this);
|
||||
NewPushNotificationService.OnNotificationReceived += NewNotificationReceived;
|
||||
return Task.CompletedTask;
|
||||
PageTitleService?.SetTitle("Notifiche");
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
await JS.InvokeVoidAsync("initNotifications", _objectReference);
|
||||
}
|
||||
|
||||
private void NewNotificationReceived(WtbNotification notification)
|
||||
{
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
[JSInvokable]
|
||||
public async Task Delete(string id)
|
||||
{
|
||||
if (!long.TryParse(id, out var notificationId)) return;
|
||||
|
||||
Loading = true;
|
||||
StateHasChanged();
|
||||
|
||||
var removed = false;
|
||||
|
||||
if (Notification.ReceivedNotifications.RemoveAll(x => x.Id == notificationId) > 0)
|
||||
removed = true;
|
||||
else if (Notification.UnreadNotifications.RemoveAll(x => x.Id == notificationId) > 0)
|
||||
removed = true;
|
||||
else if (Notification.NotificationsRead.RemoveAll(x => x.Id == notificationId) > 0)
|
||||
removed = true;
|
||||
|
||||
if (!removed)
|
||||
{
|
||||
Loading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
await IntegryNotificationRestClient.Delete(notificationId);
|
||||
|
||||
NotificationService.OrderNotificationList();
|
||||
Loading = false;
|
||||
StateHasChanged();
|
||||
|
||||
Messenger.Send(new NotificationsLoadedMessage());
|
||||
}
|
||||
|
||||
[JSInvokable]
|
||||
public async Task MarkAsRead(string id)
|
||||
{
|
||||
Loading = true;
|
||||
StateHasChanged();
|
||||
|
||||
var notificationId = long.Parse(id);
|
||||
|
||||
var wtbNotification = Notification.ReceivedNotifications
|
||||
.FindLast(x => x.Id == notificationId);
|
||||
|
||||
if (wtbNotification == null)
|
||||
{
|
||||
wtbNotification = Notification.UnreadNotifications
|
||||
.FindLast(x => x.Id == notificationId);
|
||||
|
||||
Notification.UnreadNotifications.Remove(wtbNotification!);
|
||||
}
|
||||
else
|
||||
{
|
||||
Notification.ReceivedNotifications.Remove(wtbNotification);
|
||||
}
|
||||
|
||||
wtbNotification = await IntegryNotificationRestClient.MarkAsRead(notificationId);
|
||||
Notification.NotificationsRead.Add(wtbNotification);
|
||||
|
||||
NotificationService.OrderNotificationList();
|
||||
Messenger.Send(new NotificationsLoadedMessage());
|
||||
Loading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_objectReference?.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
.container-notifications {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
padding: .2rem 0 75px 0;
|
||||
}
|
||||
|
||||
.list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.container-notifications::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.container-notifications::-webkit-scrollbar-thumb {
|
||||
background: #bbb;
|
||||
border-radius: 3px;
|
||||
}
|
||||
@@ -1,24 +1,20 @@
|
||||
@page "/PersonalInfo"
|
||||
@attribute [Authorize]
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Authorization.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
@inject INetworkService NetworkService
|
||||
@inject IFormFactor FormFactor
|
||||
|
||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/>
|
||||
@* <HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="Profilo" ShowProfile="false"/> *@
|
||||
|
||||
@if (IsLoggedIn)
|
||||
{
|
||||
<div class="container content pb-safe-area">
|
||||
<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">
|
||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
||||
@UtilityString.ExtractInitials(UserSession.User.Fullname)
|
||||
</MudAvatar>
|
||||
|
||||
@@ -26,8 +22,7 @@
|
||||
<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>
|
||||
<span class="info-section">@(((KeyGroupEnum)UserSession.User.KeyGroup).ConvertToHumanReadable())</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -43,7 +38,7 @@
|
||||
|
||||
<div>
|
||||
<span class="info-title">Status</span>
|
||||
@if (NetworkService.ConnectionAvailable)
|
||||
@if (NetworkService.IsNetworkAvailable())
|
||||
{
|
||||
<div class="status online">
|
||||
<i class="ri-wifi-line"></i>
|
||||
@@ -88,21 +83,21 @@
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Sync"
|
||||
Size="Size.Medium"
|
||||
OnClick="@(() => UpdateDb())"
|
||||
OnClick="() => UpdateDb(true)"
|
||||
Variant="Variant.Outlined">
|
||||
Sincronizza
|
||||
</MudButton>
|
||||
|
||||
@* <div class="divider"></div> *@
|
||||
<div class="divider"></div>
|
||||
|
||||
@* <MudButton Class="button-settings red-icon"
|
||||
<MudButton Class="button-settings red-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Outlined.Sync"
|
||||
Size="Size.Medium"
|
||||
OnClick="() => UpdateDb()"
|
||||
Variant="Variant.Outlined">
|
||||
Ripristina dati
|
||||
</MudButton> *@
|
||||
</MudButton>
|
||||
</div>
|
||||
|
||||
<div class="container-button">
|
||||
@@ -116,8 +111,6 @@
|
||||
</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<AppVersion/>
|
||||
}
|
||||
|
||||
@code {
|
||||
@@ -135,7 +128,7 @@
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
Unavailable = FormFactor.IsWeb() || !NetworkService.ConnectionAvailable;
|
||||
Unavailable = FormFactor.IsWeb() || !NetworkService.IsNetworkAvailable();
|
||||
LastSync = LocalStorage.Get<DateTime>("last-sync");
|
||||
});
|
||||
|
||||
@@ -154,8 +147,6 @@
|
||||
|
||||
private void UpdateDb(bool withData = false)
|
||||
{
|
||||
LocalStorage.Remove("last-user-sync");
|
||||
|
||||
var absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
|
||||
var pathAndQuery = absoluteUri.Segments.Length > 1 ? absoluteUri.PathAndQuery : null;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.container-primary-info {
|
||||
background: var(--light-card-background);
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
width: 100%;
|
||||
margin-bottom: 2rem;
|
||||
border-radius: 12px;
|
||||
|
||||
@@ -1,29 +1,27 @@
|
||||
@page "/sync"
|
||||
@page "/sync/{DateFilter}"
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject ISyncDbService SyncDb
|
||||
@inject IManageDataService ManageData
|
||||
@inject ISyncDbService syncDb
|
||||
@inject IManageDataService manageData
|
||||
|
||||
<SyncSpinner Elements="@Elements"/>
|
||||
|
||||
<AppVersion/>
|
||||
|
||||
@code {
|
||||
[Parameter] public string? DateFilter { get; set; }
|
||||
|
||||
private Dictionary<string, bool> Elements { get; set; } = new();
|
||||
|
||||
private bool _hasStarted;
|
||||
private int _completedCount;
|
||||
private bool _hasStarted = false;
|
||||
private int _completedCount = 0;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Elements["Attività"] = false;
|
||||
Elements["Commesse"] = false;
|
||||
|
||||
if (DateFilter is null)
|
||||
Elements["Impostazioni"] = false;
|
||||
Elements["Clienti"] = false;
|
||||
Elements["Prospect"] = false;
|
||||
Elements["Impostazioni"] = false;
|
||||
}
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
@@ -33,9 +31,14 @@
|
||||
_hasStarted = true;
|
||||
|
||||
if (DateFilter is null)
|
||||
await ManageData.ClearDb();
|
||||
{
|
||||
await manageData.ClearDb();
|
||||
}
|
||||
|
||||
await Task.WhenAll(
|
||||
RunAndTrack(SetActivity),
|
||||
RunAndTrack(SetClienti),
|
||||
RunAndTrack(SetProspect),
|
||||
RunAndTrack(SetCommesse),
|
||||
RunAndTrack(SetSettings)
|
||||
);
|
||||
@@ -59,9 +62,33 @@
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetActivity()
|
||||
{
|
||||
await Task.Run(async () => { await syncDb.GetAndSaveActivity(DateFilter); });
|
||||
|
||||
Elements["Attività"] = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task SetClienti()
|
||||
{
|
||||
await Task.Run(async () => { await syncDb.GetAndSaveClienti(DateFilter); });
|
||||
|
||||
Elements["Clienti"] = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task SetProspect()
|
||||
{
|
||||
await Task.Run(async () => { await syncDb.GetAndSaveProspect(DateFilter); });
|
||||
|
||||
Elements["Prospect"] = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task SetCommesse()
|
||||
{
|
||||
await Task.Run(async () => { await SyncDb.GetAndSaveCommesse(DateFilter); });
|
||||
await Task.Run(async () => { await syncDb.GetAndSaveCommesse(DateFilter); });
|
||||
|
||||
Elements["Commesse"] = true;
|
||||
StateHasChanged();
|
||||
@@ -69,13 +96,10 @@
|
||||
|
||||
private async Task SetSettings()
|
||||
{
|
||||
if (DateFilter is null)
|
||||
{
|
||||
await Task.Run(async () => { await SyncDb.GetAndSaveSettings(DateFilter); });
|
||||
await Task.Run(async () => { await syncDb.GetAndSaveSettings(DateFilter); });
|
||||
|
||||
Elements["Impostazioni"] = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
Elements["Impostazioni"] = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +1,12 @@
|
||||
@page "/User/{CodContact}/{IsContact:bool}"
|
||||
@page "/User/{CodAnag}"
|
||||
@attribute [Authorize]
|
||||
@using AutoMapper
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Dto.JobProgress
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@implements IAsyncDisposable
|
||||
@inject IManageDataService ManageData
|
||||
@inject IMapper Mapper
|
||||
@inject IDialogService Dialog
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject UserPageState UserState
|
||||
|
||||
<HeaderLayout BackTo="Indietro"
|
||||
LabelSave="Modifica"
|
||||
OnSave="() => OpenUserForm(Anag)"
|
||||
Back="true"
|
||||
BackOnTop="true"
|
||||
Title=""
|
||||
ShowProfile="false"/>
|
||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="" ShowProfile="false"/>
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
@@ -32,21 +14,18 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="container content pb-safe-area" style="overflow: auto;" id="topPage">
|
||||
<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" Variant="@(IsContact ? Variant.Filled : Variant.Outlined)" Color="Color.Secondary">
|
||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
||||
@UtilityString.ExtractInitials(Anag.RagSoc)
|
||||
</MudAvatar>
|
||||
|
||||
<div class="personal-info">
|
||||
<span class="info-nome">@Anag.RagSoc</span>
|
||||
@if (!string.IsNullOrEmpty(Anag.Indirizzo))
|
||||
@if (UserSession.User.KeyGroup is not null)
|
||||
{
|
||||
<span class="info-section">@Anag.Indirizzo</span>
|
||||
}
|
||||
@if (!string.IsNullOrEmpty(Anag.Cap) && !string.IsNullOrEmpty(Anag.Citta) && !string.IsNullOrEmpty(Anag.Prov))
|
||||
{
|
||||
<span class="info-section">@($"{Anag.Cap} - {Anag.Citta} ({Anag.Prov})")</span>
|
||||
}
|
||||
</div>
|
||||
@@ -55,752 +34,88 @@ else
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="section-info">
|
||||
@if (Agente != null)
|
||||
{
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">Agente</span>
|
||||
<span class="info-text">@Agente.FullName</span>
|
||||
</div>
|
||||
<div class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">Telefono</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(Anag.Telefono))
|
||||
{
|
||||
@("Nessuna mail configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@Anag.Telefono
|
||||
}
|
||||
</span>
|
||||
</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 class="section-personal-info">
|
||||
<div>
|
||||
<span class="info-title">E-mail</span>
|
||||
<span class="info-text">
|
||||
@if (string.IsNullOrEmpty(Anag.EMail))
|
||||
{
|
||||
@("Nessuna mail configurata")
|
||||
}
|
||||
else
|
||||
{
|
||||
@Anag.EMail
|
||||
}
|
||||
</span>
|
||||
</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 class="tab-section">
|
||||
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab1" checked="@(ActiveTab == 0)">
|
||||
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab2" checked="@(ActiveTab == 1)">
|
||||
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab3" checked="@(ActiveTab == 2)">
|
||||
|
||||
<div class="box">
|
||||
<ul class="tab-list">
|
||||
<li class="tab-item">
|
||||
<label class="tab-trigger" for="tab1" @onclick="() => SwitchTab(0)">Contatti</label>
|
||||
</li>
|
||||
<li class="tab-item">
|
||||
<label class="tab-trigger" for="tab2" @onclick="() => SwitchTab(1)">Commesse</label>
|
||||
</li>
|
||||
<li class="tab-item">
|
||||
<label class="tab-trigger" for="tab3" @onclick="() => SwitchTab(2)">Attivit<69></label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="tab-container">
|
||||
<!-- Tab Contatti -->
|
||||
<div class="tab-content" style="display: @(ActiveTab == 0 ? "block" : "none")">
|
||||
@if (PersRif?.Count > 0)
|
||||
{
|
||||
<div class="container-pers-rif">
|
||||
@foreach (var person in PersRif)
|
||||
{
|
||||
<ContactCard Contact="person"/>
|
||||
@if (person != PersRif.Last())
|
||||
{
|
||||
<div class="divider"></div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@if (PersRif is { Count: > 0 })
|
||||
{
|
||||
<div class="container-pers-rif">
|
||||
<Virtualize Items="PersRif" Context="person">
|
||||
@{
|
||||
var index = PersRif.IndexOf(person);
|
||||
var isLast = index == PersRif.Count - 1;
|
||||
}
|
||||
|
||||
<div class="container-button">
|
||||
<ContactCard Contact="person" />
|
||||
@if (!isLast)
|
||||
{
|
||||
<div class="divider"></div>
|
||||
|
||||
<MudButton Class="button-settings infoText"
|
||||
FullWidth="true"
|
||||
Size="Size.Medium"
|
||||
StartIcon="@Icons.Material.Rounded.Add"
|
||||
OnClick="OpenPersRifForm"
|
||||
Variant="Variant.Outlined">
|
||||
Aggiungi contatto
|
||||
</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tab Commesse -->
|
||||
<div class="tab-content" style="display: @(ActiveTab == 1 ? "block" : "none")">
|
||||
@if (IsLoadingCommesse)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7"/>
|
||||
}
|
||||
else if (Commesse?.Count == 0)
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna commessa presente"/>
|
||||
}
|
||||
else if (Commesse != null)
|
||||
{
|
||||
<!-- Filtri e ricerca -->
|
||||
<div class="input-card clearButton custom-border-bottom">
|
||||
<MudTextField T="string?"
|
||||
Placeholder="Cerca..."
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="SearchTermCommesse"
|
||||
AdornmentIcon="@Icons.Material.Rounded.Search"
|
||||
Adornment="Adornment.Start"
|
||||
OnDebounceIntervalElapsed="() => ApplyFiltersCommesse()"
|
||||
DebounceInterval="500"/>
|
||||
</div>
|
||||
|
||||
<div class="commesse-container">
|
||||
@if (IsLoadingSteps)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-3"/>
|
||||
}
|
||||
|
||||
@foreach (var commessa in CurrentPageCommesse)
|
||||
{
|
||||
<div class="commessa-wrapper" style="@(IsLoadingStep(commessa.CodJcom) ? "opacity: 0.7;" : "")">
|
||||
@if (Steps.TryGetValue(commessa.CodJcom, out var steps))
|
||||
{
|
||||
<CommessaCard Steps="@steps" RagSoc="@Anag.RagSoc" Commessa="commessa"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<CommessaCard Steps="null" RagSoc="@Anag.RagSoc" Commessa="commessa"/>
|
||||
@if (IsLoadingStep(commessa.CodJcom))
|
||||
{
|
||||
<MudProgressLinear Indeterminate="true" Color="Color.Primary" Class="my-1" Style="height: 2px;"/>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (TotalPagesCommesse > 1)
|
||||
{
|
||||
<div class="custom-pagination">
|
||||
<MudPagination BoundaryCount="1" MiddleCount="1" Count="@TotalPagesCommesse"
|
||||
@bind-Selected="SelectedPageCommesse"
|
||||
Color="Color.Primary"/>
|
||||
</div>
|
||||
|
||||
<div class="SelectedPageSize">
|
||||
<MudSelect @bind-Value="SelectedPageSizeCommesse"
|
||||
Variant="Variant.Text"
|
||||
Label="Elementi per pagina"
|
||||
Dense="true"
|
||||
Style="width: 100%;">
|
||||
<MudSelectItem Value="5">5</MudSelectItem>
|
||||
<MudSelectItem Value="10">10</MudSelectItem>
|
||||
<MudSelectItem Value="15">15</MudSelectItem>
|
||||
</MudSelect>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Tab Attivit<69> -->
|
||||
<div class="tab-content" style="display: @(ActiveTab == 2 ? "block" : "none")">
|
||||
@if (ActivityIsLoading)
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7"/>
|
||||
}
|
||||
else if (ActivityList?.Count == 0)
|
||||
{
|
||||
<NoDataAvailable Text="Nessuna attivit<69> presente"/>
|
||||
}
|
||||
else if (ActivityList != null)
|
||||
{
|
||||
<!-- Filtri e ricerca -->
|
||||
<div class="input-card clearButton custom-border-bottom">
|
||||
<MudTextField T="string?"
|
||||
Placeholder="Cerca..."
|
||||
Variant="Variant.Text"
|
||||
AdornmentIcon="@Icons.Material.Rounded.Search"
|
||||
Adornment="Adornment.Start"
|
||||
@bind-Value="SearchTermActivity"
|
||||
OnDebounceIntervalElapsed="() => ApplyFiltersActivity()"
|
||||
DebounceInterval="500"/>
|
||||
</div>
|
||||
|
||||
<div class="attivita-container">
|
||||
@foreach (var activity in CurrentPageActivity)
|
||||
{
|
||||
<ActivityCard ShowDate="true" Activity="activity"/>
|
||||
}
|
||||
|
||||
@if (TotalPagesActivity > 1)
|
||||
{
|
||||
<div class="custom-pagination">
|
||||
<MudPagination BoundaryCount="1" MiddleCount="1" Count="@TotalPagesActivity"
|
||||
@bind-Selected="CurrentPageActivityIndex"
|
||||
Color="Color.Primary"/>
|
||||
</div>
|
||||
|
||||
<div class="SelectedPageSize">
|
||||
<MudSelect @bind-Value="SelectedPageSizeActivity"
|
||||
Variant="Variant.Text"
|
||||
Label="Elementi per pagina"
|
||||
Dense="true"
|
||||
Style="width: 100%;">
|
||||
<MudSelectItem Value="5">5</MudSelectItem>
|
||||
<MudSelectItem Value="15">15</MudSelectItem>
|
||||
<MudSelectItem Value="30">30</MudSelectItem>
|
||||
</MudSelect>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</Virtualize>
|
||||
</div>
|
||||
}
|
||||
|
||||
<MudScrollToTop Selector="#topPage" VisibleCssClass="visible absolute" TopOffset="100" HiddenCssClass="invisible">
|
||||
<MudFab Size="Size.Small" Color="Color.Primary" StartIcon="@Icons.Material.Rounded.KeyboardArrowUp"/>
|
||||
</MudScrollToTop>
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings infoText"
|
||||
FullWidth="true"
|
||||
Size="Size.Medium"
|
||||
Variant="Variant.Outlined">
|
||||
Aggiungi contatto
|
||||
</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter] public string CodContact { get; set; } = string.Empty;
|
||||
[Parameter] public bool IsContact { get; set; }
|
||||
[Parameter] public string CodAnag { get; set; }
|
||||
|
||||
// Dati principali
|
||||
private ContactDTO Anag { get; set; } = new();
|
||||
private List<PersRifDTO>? PersRif { get; set; }
|
||||
private List<JtbComt>? Commesse { get; set; }
|
||||
private List<ActivityDTO> ActivityList { get; set; } = [];
|
||||
private StbUser? Agente { get; set; }
|
||||
private Dictionary<string, List<CRMJobStepDTO>?> Steps { get; set; } = new();
|
||||
private AnagClie Anag { get; set; } = new();
|
||||
private List<VtbCliePersRif>? PersRif { get; set; }
|
||||
|
||||
// Stati di caricamento
|
||||
private bool IsLoading { get; set; } = true;
|
||||
private bool IsLoadingCommesse { get; set; } = true;
|
||||
private bool ActivityIsLoading { get; set; } = true;
|
||||
private bool IsLoadingSteps { get; set; }
|
||||
private readonly HashSet<string> _loadingSteps = [];
|
||||
|
||||
// Gestione tab
|
||||
private int ActiveTab { get; set; }
|
||||
|
||||
// Paginazione e filtri per COMMESSE
|
||||
private int _selectedPageCommesse = 1;
|
||||
private int _selectedPageSizeCommesse = 5;
|
||||
private string _searchTermCommesse = string.Empty;
|
||||
private List<JtbComt> _filteredCommesse = [];
|
||||
|
||||
// Paginazione e filtri per ATTIVIT<49>
|
||||
private int _currentPageActivity = 1;
|
||||
private int _selectedPageSizeActivity = 5;
|
||||
private string _searchTermActivity = string.Empty;
|
||||
private List<ActivityDTO> _filteredActivity = [];
|
||||
|
||||
// Cancellation tokens per gestire le richieste asincrone
|
||||
private CancellationTokenSource? _loadingCts;
|
||||
private CancellationTokenSource? _stepsCts;
|
||||
|
||||
// Timer per il debounce della ricerca
|
||||
private Timer? _searchTimerCommesse;
|
||||
private Timer? _searchTimerActivity;
|
||||
private const int SearchDelayMs = 300;
|
||||
|
||||
#region Properties per Commesse
|
||||
|
||||
private int SelectedPageCommesse
|
||||
{
|
||||
get => _selectedPageCommesse;
|
||||
set
|
||||
{
|
||||
if (_selectedPageCommesse == value) return;
|
||||
_selectedPageCommesse = value;
|
||||
_ = LoadStepsForCurrentPageAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private int SelectedPageSizeCommesse
|
||||
{
|
||||
get => _selectedPageSizeCommesse;
|
||||
set
|
||||
{
|
||||
if (_selectedPageSizeCommesse == value) return;
|
||||
_selectedPageSizeCommesse = value;
|
||||
_selectedPageCommesse = 1;
|
||||
ApplyFiltersCommesse();
|
||||
_ = LoadStepsForCurrentPageAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private string SearchTermCommesse
|
||||
{
|
||||
get => _searchTermCommesse;
|
||||
set
|
||||
{
|
||||
if (_searchTermCommesse == value) return;
|
||||
_searchTermCommesse = value;
|
||||
|
||||
_searchTimerCommesse?.Dispose();
|
||||
_searchTimerCommesse = new Timer(async _ => await InvokeAsync(ApplyFiltersCommesse), null, SearchDelayMs, Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
|
||||
private List<JtbComt> FilteredCommesse
|
||||
{
|
||||
get => _filteredCommesse;
|
||||
set
|
||||
{
|
||||
_filteredCommesse = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private int TotalPagesCommesse =>
|
||||
FilteredCommesse.Count == 0 ? 1 : (int)Math.Ceiling(FilteredCommesse.Count / (double)SelectedPageSizeCommesse);
|
||||
|
||||
private IEnumerable<JtbComt> CurrentPageCommesse =>
|
||||
FilteredCommesse.Skip((SelectedPageCommesse - 1) * SelectedPageSizeCommesse).Take(SelectedPageSizeCommesse);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties per Attivit<69>
|
||||
|
||||
private int CurrentPageActivityIndex
|
||||
{
|
||||
get => _currentPageActivity;
|
||||
set
|
||||
{
|
||||
if (_currentPageActivity == value) return;
|
||||
_currentPageActivity = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private int SelectedPageSizeActivity
|
||||
{
|
||||
get => _selectedPageSizeActivity;
|
||||
set
|
||||
{
|
||||
if (_selectedPageSizeActivity == value) return;
|
||||
_selectedPageSizeActivity = value;
|
||||
_currentPageActivity = 1;
|
||||
ApplyFiltersActivity();
|
||||
}
|
||||
}
|
||||
|
||||
private string SearchTermActivity
|
||||
{
|
||||
get => _searchTermActivity;
|
||||
set
|
||||
{
|
||||
if (_searchTermActivity == value) return;
|
||||
_searchTermActivity = value;
|
||||
|
||||
_searchTimerActivity?.Dispose();
|
||||
_searchTimerActivity = new Timer(async _ => await InvokeAsync(ApplyFiltersActivity), null, SearchDelayMs, Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
|
||||
private List<ActivityDTO> FilteredActivity
|
||||
{
|
||||
get => _filteredActivity;
|
||||
set
|
||||
{
|
||||
_filteredActivity = value;
|
||||
InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
private int TotalPagesActivity =>
|
||||
FilteredActivity.Count == 0 ? 1 : (int)Math.Ceiling(FilteredActivity.Count / (double)SelectedPageSizeActivity);
|
||||
|
||||
private IEnumerable<ActivityDTO> CurrentPageActivity =>
|
||||
FilteredActivity.Skip((CurrentPageActivityIndex - 1) * SelectedPageSizeActivity).Take(SelectedPageSizeActivity);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Lifecycle Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
_loadingCts = new CancellationTokenSource();
|
||||
|
||||
if (UserState.CodUser?.Equals(CodContact) == true)
|
||||
{
|
||||
LoadDataFromSession();
|
||||
}
|
||||
else
|
||||
{
|
||||
await LoadDataAsync();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore in OnInitializedAsync: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
public async ValueTask DisposeAsync()
|
||||
private async Task LoadData()
|
||||
{
|
||||
_loadingCts?.CancelAsync();
|
||||
_loadingCts?.Dispose();
|
||||
_stepsCts?.CancelAsync();
|
||||
_stepsCts?.Dispose();
|
||||
_searchTimerCommesse?.DisposeAsync();
|
||||
_searchTimerActivity?.DisposeAsync();
|
||||
}
|
||||
Anag = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodAnag))).Last();
|
||||
PersRif = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodAnag));
|
||||
|
||||
#endregion
|
||||
|
||||
#region Data Loading Methods
|
||||
|
||||
private async Task LoadDataAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await LoadAnagAsync();
|
||||
await LoadPersRifAsync();
|
||||
_ = LoadActivity();
|
||||
|
||||
if (!string.IsNullOrEmpty(Anag.CodVage))
|
||||
{
|
||||
Agente = (await ManageData.GetTable<StbUser>(x => x.UserCode != null && x.UserCode.Equals(Anag.CodVage)))
|
||||
.LastOrDefault();
|
||||
}
|
||||
|
||||
SaveDataToSession();
|
||||
|
||||
_ = Task.Run(async () => await LoadCommesseAsync());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore nel caricamento dati: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadAnagAsync()
|
||||
{
|
||||
if (IsContact)
|
||||
{
|
||||
var clie = (await ManageData.GetTable<AnagClie>(x => x.CodAnag!.Equals(CodContact))).Last();
|
||||
Anag = Mapper.Map<ContactDTO>(clie);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pros = (await ManageData.GetTable<PtbPros>(x => x.CodPpro!.Equals(CodContact))).Last();
|
||||
Anag = Mapper.Map<ContactDTO>(pros);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadPersRifAsync()
|
||||
{
|
||||
if (IsContact)
|
||||
{
|
||||
var pers = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag!.Equals(Anag.CodContact));
|
||||
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
|
||||
}
|
||||
else
|
||||
{
|
||||
var pers = await ManageData.GetTable<PtbProsRif>(x => x.CodPpro!.Equals(Anag.CodContact));
|
||||
PersRif = Mapper.Map<List<PersRifDTO>>(pers);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadActivity()
|
||||
{
|
||||
await Task.Run(async () =>
|
||||
{
|
||||
var activities = await IntegryApiService.RetrieveActivity(new CRMRetrieveActivityRequestDTO { CodAnag = Anag.CodContact });
|
||||
ActivityList = (await ManageData.MapActivity(activities)).OrderByDescending(x =>
|
||||
(x.EffectiveTime ?? x.EstimatedTime) ?? x.DataInsAct
|
||||
).ToList();
|
||||
});
|
||||
|
||||
UserState.Activitys = ActivityList;
|
||||
|
||||
ApplyFiltersActivity();
|
||||
|
||||
ActivityIsLoading = false;
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task LoadCommesseAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
IsLoadingCommesse = true;
|
||||
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodContact));
|
||||
|
||||
Commesse = Commesse?
|
||||
.OrderByDescending(x => x.CodJcom)
|
||||
.ToList();
|
||||
|
||||
UserState.Commesse = Commesse;
|
||||
|
||||
ApplyFiltersCommesse();
|
||||
|
||||
await LoadStepsForCurrentPageAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore nel caricamento commesse: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsLoadingCommesse = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadDataFromSession()
|
||||
{
|
||||
Anag = UserState.Anag;
|
||||
PersRif = UserState.PersRif;
|
||||
Commesse = UserState.Commesse;
|
||||
Agente = UserState.Agente;
|
||||
Steps = UserState.Steps;
|
||||
ActivityList = UserState.Activitys;
|
||||
|
||||
if (ActiveTab != UserState.ActiveTab)
|
||||
SwitchTab(UserState.ActiveTab);
|
||||
|
||||
ApplyFiltersCommesse();
|
||||
ApplyFiltersActivity();
|
||||
|
||||
IsLoadingCommesse = false;
|
||||
ActivityIsLoading = false;
|
||||
}
|
||||
|
||||
private void SaveDataToSession()
|
||||
{
|
||||
UserState.CodUser = CodContact;
|
||||
UserState.Anag = Anag;
|
||||
UserState.PersRif = PersRif;
|
||||
UserState.Agente = Agente;
|
||||
UserState.Steps = Steps;
|
||||
UserState.Activitys = ActivityList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Steps Loading Methods
|
||||
|
||||
private async Task LoadStepsForCurrentPageAsync()
|
||||
{
|
||||
if (CurrentPageCommesse?.Any() != true) return;
|
||||
|
||||
try
|
||||
{
|
||||
_stepsCts?.Cancel();
|
||||
_stepsCts = new CancellationTokenSource();
|
||||
var token = _stepsCts.Token;
|
||||
|
||||
IsLoadingSteps = true;
|
||||
|
||||
var tasksToLoad = new List<Task>();
|
||||
var semaphore = new SemaphoreSlim(3); // Limita a 3 richieste simultanee
|
||||
|
||||
foreach (var commessa in CurrentPageCommesse.Where(c => !Steps.ContainsKey(c.CodJcom)))
|
||||
{
|
||||
if (token.IsCancellationRequested) break;
|
||||
|
||||
tasksToLoad.Add(LoadStepForCommessaAsync(commessa.CodJcom, semaphore, token));
|
||||
}
|
||||
|
||||
if (tasksToLoad.Any())
|
||||
{
|
||||
await Task.WhenAll(tasksToLoad);
|
||||
UserState.Steps = Steps;
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// Operazione annullata, non fare nulla
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore nel caricamento steps: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsLoadingSteps = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task LoadStepForCommessaAsync(string codJcom, SemaphoreSlim semaphore, CancellationToken token)
|
||||
{
|
||||
await semaphore.WaitAsync(token);
|
||||
|
||||
try
|
||||
{
|
||||
_loadingSteps.Add(codJcom);
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
var jobProgress = await IntegryApiService.RetrieveJobProgress(codJcom);
|
||||
|
||||
if (!token.IsCancellationRequested)
|
||||
{
|
||||
Steps[codJcom] = jobProgress.Steps;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Errore nel caricamento step per {codJcom}: {ex.Message}");
|
||||
if (!token.IsCancellationRequested)
|
||||
{
|
||||
Steps[codJcom] = null;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_loadingSteps.Remove(codJcom);
|
||||
semaphore.Release();
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsLoadingStep(string codJcom) => _loadingSteps.Contains(codJcom);
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI Methods
|
||||
|
||||
private void SwitchTab(int tabIndex)
|
||||
{
|
||||
ActiveTab = tabIndex;
|
||||
UserState.ActiveTab = ActiveTab;
|
||||
|
||||
if (tabIndex == 1 && Commesse == null)
|
||||
{
|
||||
_ = Task.Run(async () => await LoadCommesseAsync());
|
||||
}
|
||||
else if (tabIndex == 1 && Steps.IsNullOrEmpty())
|
||||
{
|
||||
_ = Task.Run(async () => await LoadStepsForCurrentPageAsync());
|
||||
}
|
||||
else if (tabIndex == 2 && ActivityList?.Count == 0)
|
||||
{
|
||||
_ = Task.Run(async () => await LoadActivity());
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyFiltersCommesse()
|
||||
{
|
||||
if (Commesse == null)
|
||||
{
|
||||
FilteredCommesse = [];
|
||||
return;
|
||||
}
|
||||
|
||||
var filtered = Commesse.AsEnumerable();
|
||||
if (!string.IsNullOrWhiteSpace(SearchTermCommesse))
|
||||
{
|
||||
var searchLower = SearchTermCommesse.ToLowerInvariant();
|
||||
filtered = filtered.Where(c =>
|
||||
c.CodJcom?.ToLowerInvariant().Contains(searchLower) == true ||
|
||||
c.Descrizione?.ToLowerInvariant().Contains(searchLower) == true ||
|
||||
c.CodAnag?.ToLowerInvariant().Contains(searchLower) == true);
|
||||
}
|
||||
|
||||
FilteredCommesse = filtered.ToList();
|
||||
if (SelectedPageCommesse > TotalPagesCommesse && TotalPagesCommesse > 0) _selectedPageCommesse = 1;
|
||||
|
||||
_ = LoadStepsForCurrentPageAsync();
|
||||
}
|
||||
|
||||
private void ApplyFiltersActivity()
|
||||
{
|
||||
var filtered = ActivityList.AsEnumerable();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(SearchTermActivity))
|
||||
{
|
||||
var searchLower = SearchTermActivity.ToLowerInvariant();
|
||||
filtered = filtered.Where(a =>
|
||||
a.ActivityDescription?.ToLowerInvariant().Contains(searchLower) == true ||
|
||||
a.ActivityId?.ToLowerInvariant().Contains(searchLower) == true);
|
||||
}
|
||||
|
||||
FilteredActivity = filtered.ToList();
|
||||
if (CurrentPageActivityIndex > TotalPagesActivity && TotalPagesActivity > 0)
|
||||
{
|
||||
_currentPageActivity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearSearchCommesse()
|
||||
{
|
||||
SearchTermCommesse = string.Empty;
|
||||
ApplyFiltersCommesse();
|
||||
}
|
||||
|
||||
private void ClearSearchActivity()
|
||||
{
|
||||
SearchTermActivity = string.Empty;
|
||||
ApplyFiltersActivity();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Modal Methods
|
||||
|
||||
private async Task OpenPersRifForm()
|
||||
{
|
||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, null, Anag, PersRif);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(PersRifDTO))
|
||||
{
|
||||
await LoadPersRifAsync();
|
||||
UserState.PersRif = PersRif;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OpenUserForm(ContactDTO anag)
|
||||
{
|
||||
var result = await ModalHelpers.OpenUserForm(Dialog, anag);
|
||||
|
||||
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();
|
||||
SaveDataToSession();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
.tab-section {
|
||||
width: 100%;
|
||||
border-radius: var(--mud-default-borderradius);
|
||||
background: var(--light-card-background);
|
||||
}
|
||||
|
||||
.container-primary-info {
|
||||
background: var(--light-card-background);
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
width: 100%;
|
||||
margin-bottom: 2rem;
|
||||
border-radius: 16px;
|
||||
@@ -45,10 +39,9 @@
|
||||
|
||||
.section-info {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: row;
|
||||
padding: .4rem 1.2rem .8rem;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.section-personal-info {
|
||||
@@ -91,11 +84,9 @@
|
||||
|
||||
.container-button {
|
||||
width: 100%;
|
||||
background: var(--light-card-background);
|
||||
padding: 0 !important;
|
||||
padding-bottom: .5rem !important;
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
padding: .25rem 0;
|
||||
border-radius: 16px;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.container-button .divider {
|
||||
@@ -145,157 +136,12 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
background: var(--light-card-background);
|
||||
margin-bottom: 1rem;
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
border-radius: 16px;
|
||||
max-height: 32vh;
|
||||
overflow: auto;
|
||||
scrollbar-width: none;
|
||||
padding: 1rem 0;
|
||||
}
|
||||
|
||||
.container-pers-rif::-webkit-scrollbar { width: 3px; }
|
||||
|
||||
.container-pers-rif::-webkit-scrollbar-thumb {
|
||||
background: #bbb;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.container-pers-rif .divider {
|
||||
margin: 0 0 0 3.5rem;
|
||||
width: unset;
|
||||
}
|
||||
|
||||
.custom-tab-panel {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.commesse-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.attivita-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
/*--------------
|
||||
TabPanel
|
||||
----------------*/
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: -webkit-fill-available;
|
||||
background: var(--light-card-background);
|
||||
border-radius: 20px 20px 0 0;
|
||||
border-bottom: .1rem solid var(--card-border-color);
|
||||
overflow: clip;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
/* nascondo gli input */
|
||||
|
||||
.tab-toggle { display: none; }
|
||||
|
||||
.tab-list {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/* la lineetta */
|
||||
|
||||
.tab-list::before {
|
||||
content: '';
|
||||
display: block;
|
||||
height: 3px;
|
||||
width: calc(100% / 3);
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--mud-palette-primary);
|
||||
transition: transform .3s;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
transition: .3s;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.tab-trigger {
|
||||
display: block;
|
||||
padding: 10px 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* tab attivo */
|
||||
|
||||
#tab1:checked ~ .box .tab-list .tab-item:nth-child(1),
|
||||
#tab2:checked ~ .box .tab-list .tab-item:nth-child(2),
|
||||
#tab3:checked ~ .box .tab-list .tab-item:nth-child(3) {
|
||||
opacity: 1;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* spostamento lineetta */
|
||||
|
||||
#tab1:checked ~ .box .tab-list::before { transform: translateX(0%); }
|
||||
|
||||
#tab2:checked ~ .box .tab-list::before { transform: translateX(100%); }
|
||||
|
||||
#tab3:checked ~ .box .tab-list::before { transform: translateX(200%); }
|
||||
|
||||
.tab-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: -webkit-fill-available;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
display: none;
|
||||
flex: 1;
|
||||
overflow-y: hidden;
|
||||
animation: fade .3s ease;
|
||||
padding: .5rem;
|
||||
}
|
||||
|
||||
.tab-content::-webkit-scrollbar { width: 3px; }
|
||||
|
||||
.tab-content::-webkit-scrollbar-thumb {
|
||||
background: #bbb;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
#tab1:checked ~ .tab-container .tab-content:nth-child(1),
|
||||
#tab2:checked ~ .tab-container .tab-content:nth-child(2),
|
||||
#tab3:checked ~ .tab-container .tab-content:nth-child(3) { display: block; }
|
||||
|
||||
@keyframes fade {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(5px);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.custom-pagination ::deep ul { padding-left: 0 !important; }
|
||||
|
||||
.SelectedPageSize { width: 100%; }
|
||||
|
||||
.FilterSection { display: flex; }
|
||||
}
|
||||
@@ -1,50 +1,27 @@
|
||||
@page "/Users"
|
||||
@attribute [Authorize]
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Dto.Users
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Messages.Contact
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
@inject NewContactService NewContact
|
||||
@inject FilterUserDTO Filter
|
||||
@inject UserListState UserState
|
||||
@implements IDisposable
|
||||
@inject IPageTitleService PageTitleService
|
||||
|
||||
<HeaderLayout Title="Contatti"/>
|
||||
@* <HeaderLayout Title="Contatti"/> *@
|
||||
|
||||
<div class="container search-box">
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="() => FilterUsers()" DebounceInterval="500"/>
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="TextToFilter" OnDebounceIntervalElapsed="() => FilterUsers()" DebounceInterval="500" />
|
||||
|
||||
@if (!TextToFilter.IsNullOrEmpty())
|
||||
{
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
|
||||
}
|
||||
|
||||
<MudIconButton Class="rounded-button" OnClick="ToggleFilter" Icon="@Icons.Material.Rounded.FilterList" Variant="Variant.Filled" Color="Color.Primary" Size="Size.Small" />
|
||||
</div>
|
||||
|
||||
<MudChipSet Class="mt-2" T="string" @bind-SelectedValue="TypeUser" @bind-SelectedValue:after="FilterUsers" SelectionMode="SelectionMode.SingleSelection">
|
||||
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("all")">Tutti</MudChip>
|
||||
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("contact")">Clienti</MudChip>
|
||||
<MudChip Color="Color.Primary" Variant="Variant.Text" Value="@("prospect")">Prospect</MudChip>
|
||||
</MudChipSet>
|
||||
</div>
|
||||
|
||||
<div class="container users">
|
||||
@if (IsLoading)
|
||||
@if (GroupedUserList?.Count > 0)
|
||||
{
|
||||
<SpinnerLayout FullScreen="false"/>
|
||||
}
|
||||
else if (GroupedUserList?.Count > 0)
|
||||
{
|
||||
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
|
||||
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
||||
@if (item.ShowHeader)
|
||||
{
|
||||
<div class="letter-header">@item.HeaderLetter</div>
|
||||
@@ -52,75 +29,69 @@
|
||||
<UserCard User="item.User"/>
|
||||
</Virtualize>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessun contatto trovato"/>
|
||||
}
|
||||
</div>
|
||||
|
||||
<FilterUsers @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="FilterUsers"/>
|
||||
|
||||
@code {
|
||||
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
|
||||
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
||||
|
||||
private bool IsLoading { get; set; }
|
||||
|
||||
//Filtri
|
||||
private string? TextToFilter { get; set; }
|
||||
private bool OpenFilter { get; set; }
|
||||
private string TypeUser { get; set; } = "all";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
IsLoading = true;
|
||||
PageTitleService?.SetTitle("Contatti");
|
||||
}
|
||||
|
||||
if (!UserState.IsLoaded)
|
||||
{
|
||||
UserState.OnUsersLoaded += OnUsersLoaded;
|
||||
}
|
||||
else
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await LoadData();
|
||||
LoadFromSession();
|
||||
FilterUsers();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
NewContact.OnContactCreated += async response => await OnUserCreated(response);
|
||||
}
|
||||
|
||||
private void OnUsersLoaded()
|
||||
{
|
||||
InvokeAsync(async () =>
|
||||
{
|
||||
await LoadData();
|
||||
LoadFromSession();
|
||||
FilterUsers();
|
||||
});
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
UserState.OnUsersLoaded -= OnUsersLoaded;
|
||||
}
|
||||
|
||||
private void LoadFromSession()
|
||||
{
|
||||
GroupedUserList = UserState.GroupedUserList!;
|
||||
FilteredGroupedUserList = UserState.FilteredGroupedUserList!;
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (!Filter.IsInitialized)
|
||||
var users = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||
|
||||
var sortedUsers = users
|
||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
||||
.OrderBy(u =>
|
||||
{
|
||||
var firstChar = char.ToUpper(u.RagSoc[0]);
|
||||
return char.IsLetter(firstChar) ? firstChar.ToString() : "ZZZ";
|
||||
})
|
||||
.ThenBy(u => u.RagSoc)
|
||||
.ToList();
|
||||
|
||||
GroupedUserList = [];
|
||||
|
||||
string? lastHeader = null;
|
||||
|
||||
foreach (var user in sortedUsers)
|
||||
{
|
||||
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||
var firstChar = char.ToUpper(user.RagSoc[0]);
|
||||
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
|
||||
|
||||
if (loggedUser.UserCode != null)
|
||||
Filter.Agenti = [loggedUser.UserCode];
|
||||
var showHeader = currentLetter != lastHeader;
|
||||
lastHeader = currentLetter;
|
||||
|
||||
Filter.IsInitialized = true;
|
||||
GroupedUserList.Add(new UserDisplayItem
|
||||
{
|
||||
User = user,
|
||||
ShowHeader = showHeader,
|
||||
HeaderLetter = currentLetter
|
||||
});
|
||||
}
|
||||
|
||||
FilterUsers();
|
||||
}
|
||||
|
||||
private class UserDisplayItem
|
||||
{
|
||||
public required AnagClie User { get; set; }
|
||||
public bool ShowHeader { get; set; }
|
||||
public string? HeaderLetter { get; set; }
|
||||
}
|
||||
|
||||
private void FilterUsers() => FilterUsers(false);
|
||||
@@ -130,157 +101,29 @@
|
||||
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
|
||||
{
|
||||
TextToFilter = null;
|
||||
FilteredGroupedUserList = GroupedUserList;
|
||||
return;
|
||||
}
|
||||
|
||||
var filter = TextToFilter.Trim();
|
||||
var result = new List<UserDisplayItem>();
|
||||
|
||||
foreach (var item in GroupedUserList)
|
||||
{
|
||||
var user = item.User;
|
||||
|
||||
switch (TypeUser)
|
||||
{
|
||||
case "contact" when !user.IsContact:
|
||||
case "prospect" when user.IsContact:
|
||||
continue;
|
||||
}
|
||||
|
||||
var matchesFilter =
|
||||
(Filter.Prov.IsNullOrEmpty() ||
|
||||
(!string.IsNullOrEmpty(user.Prov) &&
|
||||
user.Prov.Trim().Contains(Filter.Prov!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
|
||||
(Filter.Citta.IsNullOrEmpty() ||
|
||||
(!string.IsNullOrEmpty(user.Citta) &&
|
||||
user.Citta.Trim().Contains(Filter.Citta!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
|
||||
(Filter.Nazione.IsNullOrEmpty() ||
|
||||
(!string.IsNullOrEmpty(user.Nazione) &&
|
||||
user.Nazione.Trim().Contains(Filter.Nazione!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
|
||||
(Filter.Indirizzo.IsNullOrEmpty() ||
|
||||
(!string.IsNullOrEmpty(user.Indirizzo) &&
|
||||
user.Indirizzo.Trim().Contains(Filter.Indirizzo!.Trim(), StringComparison.OrdinalIgnoreCase))) &&
|
||||
(!Filter.ConAgente || user.CodVage is not null) &&
|
||||
(!Filter.SenzaAgente || user.CodVage is null) &&
|
||||
(Filter.Agenti.IsNullOrEmpty() || (user.CodVage != null && Filter.Agenti!.Contains(user.CodVage)));
|
||||
|
||||
if (!matchesFilter) continue;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(TextToFilter))
|
||||
{
|
||||
var filter = TextToFilter.Trim();
|
||||
|
||||
var matchesText =
|
||||
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (matchesText)
|
||||
{
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (
|
||||
(!string.IsNullOrEmpty(user.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase))
|
||||
)
|
||||
{
|
||||
result.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
FilteredGroupedUserList = result;
|
||||
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnUserCreated(CRMCreateContactResponseDTO response)
|
||||
{
|
||||
IsLoading = true;
|
||||
|
||||
string codAnag;
|
||||
bool isContact;
|
||||
|
||||
switch (response)
|
||||
{
|
||||
case null:
|
||||
return;
|
||||
case { AnagClie: null, PtbPros: not null }:
|
||||
await ManageData.InsertOrUpdate(response.PtbPros);
|
||||
isContact = false;
|
||||
codAnag = response.PtbPros.CodPpro!;
|
||||
break;
|
||||
case { AnagClie: not null, PtbPros: null }:
|
||||
await ManageData.InsertOrUpdate(response.AnagClie);
|
||||
isContact = true;
|
||||
codAnag = response.AnagClie.CodAnag!;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
var contact = await ManageData.GetSpecificContact(codAnag, isContact);
|
||||
if (contact == null)
|
||||
{
|
||||
IsLoading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var firstChar = char.ToUpper(contact.RagSoc![0]);
|
||||
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
|
||||
|
||||
var insertIndex = -1;
|
||||
var foundHeader = false;
|
||||
|
||||
for (var i = 0; i < GroupedUserList.Count; i++)
|
||||
{
|
||||
var current = GroupedUserList[i];
|
||||
|
||||
if (!current.ShowHeader || current.HeaderLetter != currentLetter) continue;
|
||||
foundHeader = true;
|
||||
insertIndex = i + 1;
|
||||
|
||||
while (insertIndex < GroupedUserList.Count &&
|
||||
GroupedUserList[insertIndex].HeaderLetter == currentLetter &&
|
||||
string.Compare(contact.RagSoc, GroupedUserList[insertIndex].User.RagSoc, StringComparison.OrdinalIgnoreCase) > 0)
|
||||
{
|
||||
insertIndex++;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (!foundHeader)
|
||||
{
|
||||
var headerItem = new UserDisplayItem
|
||||
{
|
||||
HeaderLetter = currentLetter,
|
||||
ShowHeader = true,
|
||||
User = contact
|
||||
};
|
||||
|
||||
GroupedUserList.Add(headerItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
var newItem = new UserDisplayItem
|
||||
{
|
||||
HeaderLetter = currentLetter,
|
||||
ShowHeader = false,
|
||||
User = contact
|
||||
};
|
||||
|
||||
GroupedUserList.Insert(insertIndex, newItem);
|
||||
}
|
||||
|
||||
FilterUsers();
|
||||
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
|
||||
private void ToggleFilter()
|
||||
{
|
||||
OpenFilter = !OpenFilter;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,8 @@
|
||||
flex-direction: column;
|
||||
-ms-overflow-style: none;
|
||||
scrollbar-width: none;
|
||||
padding-bottom: 9vh;
|
||||
padding-bottom: 70px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.users .divider {
|
||||
@@ -27,6 +28,6 @@
|
||||
padding-bottom: .5rem;
|
||||
}
|
||||
|
||||
.search-box .input-card { margin: 0 !important; }
|
||||
|
||||
.search-box .input-card ::deep .rounded-button { border-radius: 50%; }
|
||||
.search-box .input-card {
|
||||
margin: 0 !important;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
@using salesbook.Shared.Components.SingleElements.Modal.ExceptionModal
|
||||
@using salesbook.Shared.Components.SingleElements
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<ErrorBoundary @ref="ErrorBoundary">
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
@using salesbook.Shared.Core.Interface.System
|
||||
@inject IGenericSystemService GenericSystemService
|
||||
|
||||
<div class="app-version">
|
||||
<span>@($"v{GenericSystemService.GetCurrentAppVersion()}")</span>
|
||||
</div>
|
||||
@@ -1,11 +0,0 @@
|
||||
.app-version{
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
.app-version span{
|
||||
font-size: smaller;
|
||||
color: var(--mud-palette-gray-darker);
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
|
||||
<div class="bottom-sheet pb-safe-area">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Aggiungi un promemoria</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => CloseBottomSheet()"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span>Data</span>
|
||||
|
||||
<MudTextField T="DateTime?" Format="yyyy-MM-dd" InputType="InputType.Date" @bind-Value="Date" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField T="string?" Placeholder="Memo" Variant="Variant.Text" Lines="4" @bind-Value="Memo" />
|
||||
</div>
|
||||
|
||||
<div class="button-section">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="() => CloseBottomSheet(true)">Salva</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
private DateTime? Date { get; set; } = DateTime.Today;
|
||||
private string? Memo { get; set; }
|
||||
|
||||
private void CloseBottomSheet(bool save)
|
||||
{
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
}
|
||||
|
||||
private void CloseBottomSheet() => CloseBottomSheet(false);
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService manageData
|
||||
|
||||
@@ -14,81 +15,89 @@
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="Filter.Text" DebounceInterval="500"/>
|
||||
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Filter.Text = null"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Con agente</span>
|
||||
<span class="disable-full-width">Assegnata a</span>
|
||||
|
||||
<MudSelectExtended SearchBox="true"
|
||||
ItemCollection="Users.Select(x => x.UserName).ToList()"
|
||||
SelectAllPosition="SelectAllPosition.NextToSearchBox"
|
||||
SelectAll="true"
|
||||
NoWrap="true"
|
||||
MultiSelection="true"
|
||||
MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionUser))"
|
||||
FullWidth="true" T="string"
|
||||
Variant="Variant.Text"
|
||||
Virtualize="true"
|
||||
@bind-SelectedValues="Filter.User"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code"/>
|
||||
|
||||
<MudCheckBox @bind-Value="Filter.ConAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeConAgente"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Senza agente</span>
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
<MudCheckBox @bind-Value="Filter.SenzaAgente" Color="Color.Primary" @bind-Value:after="OnAfterChangeSenzaAgente"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Agente</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
|
||||
@bind-SelectedValues="Filter.Agenti" @bind-SelectedValues:after="OnAfterChangeAgenti"
|
||||
MultiSelection="true" MultiSelectionTextFunc="@(new Func<List<string>, string>(GetMultiSelectionAgente))"
|
||||
SelectAllPosition="SelectAllPosition.NextToSearchBox" SelectAll="true"
|
||||
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var user in Users)
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Type"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var type in ActivityType)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Esito</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Result"
|
||||
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 class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Categoria</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true"
|
||||
T="ActivityCategoryEnum?"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Category"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var category in CategoryList)
|
||||
{
|
||||
<MudSelectItemExtended T="ActivityCategoryEnum?" Class="custom-item-select" Value="@category">@category.ConvertToHumanReadable()</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<MudTextField T="string?"
|
||||
Placeholder="Indirizzo"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Indirizzo"
|
||||
DebounceInterval="500"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<MudTextField T="string?"
|
||||
Placeholder="Città"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Citta"
|
||||
DebounceInterval="500"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<MudTextField T="string?"
|
||||
Placeholder="Provincia"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Prov"
|
||||
DebounceInterval="500"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<MudTextField T="string?"
|
||||
Placeholder="Nazione"
|
||||
Variant="Variant.Text"
|
||||
@bind-Value="Filter.Nazione"
|
||||
DebounceInterval="500"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="button-section">
|
||||
<MudButton OnClick="ClearFilters" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
||||
<MudButton OnClick="() => Filter = new FilterActivityDTO()" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
||||
</div>
|
||||
</div>
|
||||
@@ -98,10 +107,13 @@
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
[Parameter] public FilterUserDTO Filter { get; set; }
|
||||
[Parameter] public EventCallback<FilterUserDTO> FilterChanged { get; set; }
|
||||
[Parameter] public FilterActivityDTO Filter { get; set; }
|
||||
[Parameter] public EventCallback<FilterActivityDTO> FilterChanged { get; set; }
|
||||
|
||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
||||
private List<StbUser> Users { get; set; } = [];
|
||||
private List<ActivityCategoryEnum> CategoryList { get; set; } = [];
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
@@ -109,14 +121,19 @@
|
||||
await LoadData();
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
private string GetMultiSelectionUser(List<string> selectedValues)
|
||||
{
|
||||
Users = await manageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||
return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||
}
|
||||
|
||||
private string GetMultiSelectionAgente(List<string> selectedValues)
|
||||
private async Task LoadData()
|
||||
{
|
||||
return $"{selectedValues.Count} Agent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||
Users = await manageData.GetTable<StbUser>();
|
||||
ActivityResult = await manageData.GetTable<StbActivityResult>();
|
||||
ActivityType = await manageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
CategoryList = ActivityCategoryHelper.AllActivityCategory;
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
@@ -131,27 +148,4 @@
|
||||
CloseBottomSheet();
|
||||
}
|
||||
|
||||
private void OnAfterChangeAgenti()
|
||||
{
|
||||
if (Filter.Agenti == null || !Filter.Agenti.Any()) return;
|
||||
|
||||
Filter.ConAgente = false;
|
||||
Filter.SenzaAgente = false;
|
||||
}
|
||||
|
||||
private void ClearFilters()
|
||||
{
|
||||
Filter.ConAgente = false;
|
||||
Filter.SenzaAgente = false;
|
||||
Filter.Agenti = [];
|
||||
Filter.Indirizzo = null;
|
||||
Filter.Citta = null;
|
||||
Filter.Nazione = null;
|
||||
Filter.Prov = null;
|
||||
}
|
||||
|
||||
private void OnAfterChangeConAgente() => Filter.SenzaAgente = false;
|
||||
|
||||
private void OnAfterChangeSenzaAgente() => Filter.ConAgente = false;
|
||||
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
|
||||
<div class="bottom-sheet-backdrop @(IsSheetVisible ? "show" : "")" @onclick="CloseBottomSheet"></div>
|
||||
|
||||
<div class="bottom-sheet-container @(IsSheetVisible ? "show" : "")">
|
||||
<div style="height: 95vh" class="bottom-sheet pb-safe-area">
|
||||
<div class="title">
|
||||
<MudText Typo="Typo.h6">
|
||||
<b>Cerca indirizzo</b>
|
||||
</MudText>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => CloseBottomSheet()"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card clearButton">
|
||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="Address" DebounceInterval="500" OnDebounceIntervalElapsed="SearchAllAddress" />
|
||||
|
||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Address = null" />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@if (Loading)
|
||||
{
|
||||
<SpinnerLayout />
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Addresses != null)
|
||||
{
|
||||
foreach (var address in Addresses)
|
||||
{
|
||||
<b><span @onclick="() => OnSelectAddress(address.PlaceId)">@address.Description</span></b>
|
||||
|
||||
<div class="divider"></div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<NoDataAvailable Text="Nessun indirizzo trovato" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
@code {
|
||||
[Parameter] public string Region { get; set; }
|
||||
|
||||
[Parameter] public IndirizzoDTO Indirizzo { get; set; }
|
||||
[Parameter] public EventCallback<IndirizzoDTO> IndirizzoChanged { get; set; }
|
||||
|
||||
[Parameter] public bool IsSheetVisible { get; set; }
|
||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||
|
||||
private bool Loading { get; set; }
|
||||
|
||||
private string? Address { get; set; }
|
||||
private List<AutoCompleteAddressDTO>? Addresses { get; set; }
|
||||
|
||||
private string? Uuid { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (IsSheetVisible)
|
||||
{
|
||||
Uuid = Guid.NewGuid().ToString();
|
||||
Address = null;
|
||||
Addresses = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseBottomSheet()
|
||||
{
|
||||
IsSheetVisible = false;
|
||||
IsSheetVisibleChanged.InvokeAsync(IsSheetVisible);
|
||||
}
|
||||
|
||||
private async Task SearchAllAddress()
|
||||
{
|
||||
if (Address == null || Uuid == null) return;
|
||||
|
||||
Loading = true;
|
||||
StateHasChanged();
|
||||
|
||||
Addresses = await IntegryApiService.AutoCompleteAddress(Address, Region, Uuid);
|
||||
|
||||
Loading = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnSelectAddress(string placeId)
|
||||
{
|
||||
CloseBottomSheet();
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
try
|
||||
{
|
||||
Indirizzo = await IntegryApiService.PlaceDetails(placeId, Uuid);
|
||||
await IndirizzoChanged.InvokeAsync(Indirizzo);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
Snackbar.Clear();
|
||||
|
||||
Snackbar.Add("Impossibile selezionare questo indirizzo", Severity.Error);
|
||||
}
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Helpers.Enum
|
||||
@inject IDialogService Dialog
|
||||
@@ -11,7 +11,7 @@
|
||||
@switch (Activity.Category)
|
||||
{
|
||||
case ActivityCategoryEnum.Commessa:
|
||||
@Activity.Commessa?.Descrizione
|
||||
@Activity.Commessa
|
||||
break;
|
||||
case ActivityCategoryEnum.Interna:
|
||||
@Activity.Cliente
|
||||
@@ -28,25 +28,11 @@
|
||||
<span class="activity-hours">
|
||||
@if (Activity.EffectiveTime is null)
|
||||
{
|
||||
if (ShowDate)
|
||||
{
|
||||
@($"{Activity.EstimatedTime:g}")
|
||||
}
|
||||
else
|
||||
{
|
||||
@($"{Activity.EstimatedTime:t}")
|
||||
}
|
||||
@($"{Activity.EstimatedTime:t}")
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShowDate)
|
||||
{
|
||||
@($"{Activity.EffectiveTime:g}")
|
||||
}
|
||||
else
|
||||
{
|
||||
@($"{Activity.EffectiveTime:t}")
|
||||
}
|
||||
@($"{Activity.EffectiveTime:t}")
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@@ -81,8 +67,6 @@
|
||||
[Parameter] public EventCallback<string> ActivityChanged { get; set; }
|
||||
[Parameter] public EventCallback<ActivityDTO> ActivityDeleted { get; set; }
|
||||
|
||||
[Parameter] public bool ShowDate { get; set; }
|
||||
|
||||
private TimeSpan? Durata { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
@@ -97,7 +81,7 @@
|
||||
|
||||
private async Task OpenActivity()
|
||||
{
|
||||
var result = await ModalHelpers.OpenActivityForm(Dialog, Activity, null);
|
||||
var result = await ModalHelpers.OpenActivityForm(Dialog, null, Activity.ActivityId);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
|
||||
@@ -5,23 +5,14 @@
|
||||
padding: .5rem .5rem;
|
||||
border-radius: 12px;
|
||||
line-height: normal;
|
||||
/*box-shadow: var(--custom-box-shadow);*/
|
||||
box-shadow: var(--custom-box-shadow);
|
||||
}
|
||||
|
||||
.activity-card.memo {
|
||||
border-left: 5px solid var(--mud-palette-info-darken);
|
||||
background-color: hsl(from var(--mud-palette-info-darken) h s 99%);
|
||||
}
|
||||
.activity-card.memo { border-left: 5px solid var(--mud-palette-info-darken); }
|
||||
|
||||
.activity-card.interna {
|
||||
border-left: 5px solid var(--mud-palette-success-darken);
|
||||
background-color: hsl(from var(--mud-palette-success-darken) h s 99%);
|
||||
}
|
||||
.activity-card.interna { border-left: 5px solid var(--mud-palette-success-darken); }
|
||||
|
||||
.activity-card.commessa {
|
||||
border-left: 5px solid var(--mud-palette-warning);
|
||||
background-color: hsl(from var(--mud-palette-warning) h s 99%);
|
||||
}
|
||||
.activity-card.commessa { border-left: 5px solid var(--mud-palette-warning); }
|
||||
|
||||
.activity-left-section {
|
||||
display: flex;
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject IAttachedService AttachedService
|
||||
|
||||
<div @onclick="OpenAttached" class="activity-card">
|
||||
<div class="activity-left-section">
|
||||
<div class="activity-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="activity-title" Typo="Typo.body1" HtmlTag="h3">
|
||||
@(Attached.Description.IsNullOrEmpty() ? Attached.FileName : Attached.Description)
|
||||
</MudText>
|
||||
<div class="activity-hours-section">
|
||||
<span class="activity-hours">@($"{Attached.DateAttached:g}")</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="activity-info-section">
|
||||
@if (Attached.IsActivity)
|
||||
{
|
||||
<MudChip T="string" Color="Color.Primary" Variant="Variant.Outlined" Icon="@IconConstants.Chip.Tag" Size="Size.Small">
|
||||
@Attached.RefAttached
|
||||
</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Color="Color.Warning" Variant="Variant.Outlined" Icon="@IconConstants.Chip.FileTextLine" Size="Size.Small">
|
||||
@Attached.RefAttached
|
||||
</MudChip>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public CRMAttachedResponseDTO Attached { get; set; } = new();
|
||||
|
||||
private async Task OpenAttached()
|
||||
{
|
||||
var bytes = await IntegryApiService.DownloadFileFromRefUuid(Attached.RefUuid, Attached.FileName);
|
||||
await AttachedService.OpenFile(bytes, Attached.FileName);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
.activity-card {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: .5rem .5rem;
|
||||
border-radius: 12px;
|
||||
line-height: normal;
|
||||
background: var(--light-card-background);
|
||||
}
|
||||
|
||||
.activity-card.memo { border-left: 5px solid var(--mud-palette-info-darken); }
|
||||
|
||||
.activity-card.interna { border-left: 5px solid var(--mud-palette-success-darken); }
|
||||
|
||||
.activity-card.commessa { border-left: 5px solid var(--mud-palette-warning); }
|
||||
|
||||
.activity-left-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.activity-hours {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
font-weight: 600;
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
.activity-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
|
||||
|
||||
.activity-body-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.title-section ::deep > .activity-title {
|
||||
font-weight: 700 !important;
|
||||
margin: 0 !important;
|
||||
line-height: normal !important;
|
||||
color: var(--mud-palette-text-primary);
|
||||
}
|
||||
|
||||
.activity-body-section ::deep > .activity-subtitle {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
margin: .2rem 0 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.activity-info-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: .25rem;
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
@using salesbook.Shared.Core.Dto.JobProgress
|
||||
@using salesbook.Shared.Core.Dto.PageState
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@inject JobSteps JobSteps
|
||||
|
||||
<div @onclick="OpenPageCommessa" class="activity-card">
|
||||
<div class="activity-left-section">
|
||||
<div class="activity-body-section">
|
||||
<div class="title-section">
|
||||
<MudText Class="activity-title" Typo="Typo.body1" HtmlTag="h3">@Commessa.CodJcom</MudText>
|
||||
<div class="activity-hours-section">
|
||||
@if (LastUpd is not null)
|
||||
{
|
||||
<span class="activity-hours">Aggiornato il @($"{LastUpd:d}")</span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<span class="activity-title">@Commessa.Descrizione</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="activity-info-section">
|
||||
@if (Stato is not null)
|
||||
{
|
||||
<MudChip T="string" Variant="Variant.Outlined" Icon="@IconConstants.Chip.Stato" Size="Size.Small">@Stato</MudChip>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public JtbComt Commessa { get; set; } = new();
|
||||
[Parameter] public string RagSoc { get; set; } = "";
|
||||
[Parameter] public List<CRMJobStepDTO>? Steps { get; set; }
|
||||
|
||||
private string? Stato { get; set; }
|
||||
private DateTime? LastUpd { get; set; }
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
GetStepInfo();
|
||||
}
|
||||
|
||||
private void GetStepInfo()
|
||||
{
|
||||
if (Steps is null) return;
|
||||
|
||||
// Ultimo step non skip
|
||||
var lastBeforeSkip = Steps
|
||||
.LastOrDefault(s => s.Status is { Skip: false });
|
||||
|
||||
if (lastBeforeSkip is not null)
|
||||
Stato = lastBeforeSkip.StepName;
|
||||
|
||||
// Ultima data disponibile
|
||||
LastUpd = Steps
|
||||
.Where(s => s.Date.HasValue)
|
||||
.Select(s => s.Date!.Value)
|
||||
.DefaultIfEmpty()
|
||||
.Max();
|
||||
|
||||
if (LastUpd.Equals(DateTime.MinValue))
|
||||
LastUpd = null;
|
||||
}
|
||||
|
||||
|
||||
private void OpenPageCommessa()
|
||||
{
|
||||
JobSteps.Steps = Steps;
|
||||
NavigationManager.NavigateTo($"commessa/{Commessa.CodJcom}/{RagSoc}");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
.activity-card {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: .5rem .5rem;
|
||||
border-radius: 12px;
|
||||
line-height: normal;
|
||||
|
||||
border-left: 5px solid var(--card-border-color);
|
||||
background-color: hsl(from var(--card-border-color) h s 99%);
|
||||
}
|
||||
|
||||
.activity-left-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.activity-hours {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
font-weight: 600;
|
||||
font-size: .8rem;
|
||||
}
|
||||
|
||||
.activity-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
|
||||
|
||||
.activity-body-section {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.activity-title {
|
||||
font-weight: 800 !important;
|
||||
margin: 0 !important;
|
||||
line-height: normal !important;
|
||||
color: var(--mud-palette-text-primary);
|
||||
}
|
||||
|
||||
.title-section ::deep > .activity-title {
|
||||
font-weight: 600;
|
||||
color: var(--mud-palette-text-primary);
|
||||
}
|
||||
|
||||
.activity-body-section ::deep > .activity-subtitle {
|
||||
color: var(--mud-palette-gray-darker);
|
||||
margin: .2rem 0 !important;
|
||||
line-height: normal !important;
|
||||
}
|
||||
|
||||
.activity-info-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-top: .25rem;
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@inject IDialogService Dialog
|
||||
@using salesbook.Shared.Core.Entity
|
||||
|
||||
<div class="contact-card" @onclick="OpenPersRifForm">
|
||||
<div class="contact-card">
|
||||
<div class="contact-left-section">
|
||||
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large"/>
|
||||
<MudIcon Color="Color.Default" Icon="@Icons.Material.Filled.PersonOutline" Size="Size.Large" />
|
||||
|
||||
<div class="contact-body-section">
|
||||
<div class="title-section">
|
||||
@@ -19,25 +18,15 @@
|
||||
<div class="contact-right-section">
|
||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
||||
{
|
||||
<a href="@($"tel:{Contact.NumCellulare}")">
|
||||
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone"/>
|
||||
</a>
|
||||
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
|
||||
}
|
||||
|
||||
@if (!Contact.EMail.IsNullOrEmpty())
|
||||
{
|
||||
<a href="@($"mailto:{Contact.EMail}")">
|
||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline"/>
|
||||
</a>
|
||||
@if (!Contact.EMail.IsNullOrEmpty()){
|
||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public PersRifDTO Contact { get; set; } = new();
|
||||
|
||||
private async Task OpenPersRifForm()
|
||||
{
|
||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, Contact);
|
||||
}
|
||||
[Parameter] public VtbCliePersRif Contact { get; set; } = new();
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
padding: 0 .5rem;
|
||||
padding: 0 .75rem;
|
||||
border-radius: 16px;
|
||||
line-height: normal;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
@using Java.Sql
|
||||
@using salesbook.Shared.Components.Layout.Spinner
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageDataService
|
||||
@inject ISnackbar Snackbar
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<div class="row" id="@Notification.Id" @onclick="OpenActivity">
|
||||
<div class="behind-left">
|
||||
<button class="read-btn">
|
||||
<MudIcon Icon="@Icons.Material.Rounded.Check" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="behind-right">
|
||||
<button class="trash-btn">
|
||||
<MudIcon Icon="@Icons.Material.Rounded.Delete" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="notification-card">
|
||||
@if (Notification.NotificationData is { Type: not null })
|
||||
{
|
||||
@switch (Notification.NotificationData.Type)
|
||||
{
|
||||
case "memo":
|
||||
<div class="avatar"><MudIcon Icon="@Icons.Material.Rounded.ContentPaste" /></div>
|
||||
break;
|
||||
case "newPlanned":
|
||||
<div class="avatar"><MudIcon Icon="@Icons.Material.Rounded.CalendarMonth" /></div>
|
||||
break;
|
||||
}
|
||||
}
|
||||
<div class="notification-body">
|
||||
<div class="title-row">
|
||||
<div class="title">@Notification.Title</div>
|
||||
|
||||
<div class="section-time">
|
||||
<div class="notification-time">@GetTimeAgo(Notification.StartDate)</div>
|
||||
@if (Unread)
|
||||
{
|
||||
<span class="unread-dot"></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (
|
||||
Notification.StartDate < DateTime.Today && Notification.Body != null && Notification.Body.Contains("Oggi")
|
||||
)
|
||||
{
|
||||
<div class="subtitle">@Notification.Body.Replace("Oggi", $"{Notification.StartDate:d}")</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="subtitle">@Notification.Body</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<OverlayLayout Visible="VisibleOverlay" />
|
||||
|
||||
@code {
|
||||
[Parameter] public bool Unread { get; set; }
|
||||
[Parameter] public WtbNotification Notification { get; set; } = new();
|
||||
|
||||
private bool VisibleOverlay { get; set; }
|
||||
|
||||
private async Task OpenActivity()
|
||||
{
|
||||
if(Notification.NotificationData?.ActivityId == null) return;
|
||||
var activityId = Notification.NotificationData.ActivityId;
|
||||
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
Snackbar.Clear();
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var activity = (await ManageDataService.GetActivityTryLocalDb(new WhereCondActivity { ActivityId = activityId })).LastOrDefault();
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
|
||||
if (activity == null) Snackbar.Add("Impossibile aprire l'attivit<69>", Severity.Error);
|
||||
|
||||
_ = ModalHelpers.OpenActivityForm(Dialog, activity, null);
|
||||
}
|
||||
|
||||
private static string GetTimeAgo(DateTime? timestamp)
|
||||
{
|
||||
if (timestamp is null) return "";
|
||||
|
||||
var difference = DateTime.Now - timestamp.Value;
|
||||
|
||||
if (DateTime.Now.Day != timestamp.Value.Day)
|
||||
return timestamp.Value.ToString("dd/MM/yyyy");
|
||||
|
||||
switch (difference.TotalMinutes)
|
||||
{
|
||||
case < 1:
|
||||
return "Adesso";
|
||||
case < 60:
|
||||
return $"{(int)difference.TotalMinutes} minuti fa";
|
||||
default:
|
||||
{
|
||||
switch (difference.TotalHours)
|
||||
{
|
||||
case < 2:
|
||||
return $"{(int)difference.TotalHours} ora fa";
|
||||
case < 24:
|
||||
return $"{timestamp.Value:t}";
|
||||
default:
|
||||
{
|
||||
return timestamp.Value.ToString("dd/MM/yyyy");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
.row {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: var(--mud-default-borderradius);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.behind-left, .behind-right {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.behind-right {
|
||||
justify-content: flex-end;
|
||||
padding-right: 14px;
|
||||
background: var(--mud-palette-error);
|
||||
}
|
||||
|
||||
.behind-left {
|
||||
justify-content: flex-start;
|
||||
padding-left: 14px;
|
||||
background: var(--mud-palette-info);
|
||||
}
|
||||
|
||||
.read-btn, .trash-btn {
|
||||
color: white;
|
||||
padding: 10px 15px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.notification-card {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px;
|
||||
gap: 12px;
|
||||
background: var(--light-card-background);
|
||||
transition: transform .2s ease;
|
||||
touch-action: pan-y;
|
||||
will-change: transform;
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.avatar {
|
||||
min-width: 42px;
|
||||
height: 42px;
|
||||
border-radius: 12px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--mud-palette-background);
|
||||
border: 1px solid var(--mud-palette-divider);
|
||||
font-weight: bold;
|
||||
color: var(--mud-palette-primary);
|
||||
}
|
||||
|
||||
.notification-body {
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.title-row {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
justify-items: center;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.unread-dot {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
background-color: var(--mud-palette-error);
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: 700;
|
||||
margin-bottom: unset !important;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.section-time {
|
||||
display: flex;
|
||||
gap: .65rem;
|
||||
min-width: max-content;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.notification-time {
|
||||
font-size: 13px;
|
||||
color: #94a3b8;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.collapsing {
|
||||
transition: height .22s ease, margin .22s ease, opacity .22s ease;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.notification-body ::deep > .subtitle {
|
||||
font-size: 12px;
|
||||
color: var(--mud-palette-drawer-text);
|
||||
line-height: inherit;
|
||||
margin-top: .5rem;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@inject IManageDataService ManageData
|
||||
@@ -7,7 +6,7 @@
|
||||
<div class="user-card-left-section">
|
||||
<div class="user-card-body-section">
|
||||
<div class="title-section">
|
||||
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@(User.IsContact? Icons.Material.Filled.Person : Icons.Material.Filled.PersonOutline)" Size="Size.Large" />
|
||||
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@Icons.Material.Filled.Person" Size="Size.Large" />
|
||||
|
||||
<div class="user-card-right-section">
|
||||
<div class="user-card-title">
|
||||
@@ -25,23 +24,11 @@
|
||||
@if (!Commesse.IsNullOrEmpty())
|
||||
{
|
||||
<div @onclick="OpenUser" class="container-commesse">
|
||||
|
||||
@for (var i = 0; i < Commesse!.Count; i++)
|
||||
@foreach (var commessa in Commesse!)
|
||||
{
|
||||
var commessa = Commesse[i];
|
||||
|
||||
<div class="commessa">
|
||||
@if (i > 5 && Commesse.Count - i > 1)
|
||||
{
|
||||
<span>@($"E altre {Commesse.Count - i} commesse")</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@($"{commessa.CodJcom} - {commessa.Descrizione}")</span>
|
||||
}
|
||||
<span>@($"{commessa.CodJcom} - {commessa.Descrizione}")</span>
|
||||
</div>
|
||||
|
||||
@if (i > 5 && Commesse.Count - i > 1) break;
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -60,14 +47,14 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
[Parameter] public ContactDTO User { get; set; } = new();
|
||||
[Parameter] public AnagClie User { get; set; } = new();
|
||||
|
||||
private List<JtbComt>? Commesse { get; set; }
|
||||
private bool IsLoading { get; set; } = true;
|
||||
private bool ShowSectionCommesse { get; set; }
|
||||
|
||||
private void OpenUser() =>
|
||||
NavigationManager.NavigateTo($"/User/{User.CodContact}/{User.IsContact}");
|
||||
NavigationManager.NavigateTo($"/User/{User.CodAnag}");
|
||||
|
||||
private async Task ShowCommesse()
|
||||
{
|
||||
@@ -75,8 +62,7 @@
|
||||
|
||||
if (ShowSectionCommesse)
|
||||
{
|
||||
Commesse = (await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodContact)))
|
||||
.OrderByDescending(x => x.CodJcom).ToList();
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodAnag));
|
||||
IsLoading = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
@using salesbook.Shared.Core.Services
|
||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<div class="container container-modal">
|
||||
<div class="c-modal">
|
||||
<div class="exception-header mb-2">
|
||||
@@ -1,51 +1,31 @@
|
||||
@using System.Globalization
|
||||
@using System.Text.RegularExpressions
|
||||
@using CommunityToolkit.Mvvm.Messaging
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Core.Dto.Activity
|
||||
@using salesbook.Shared.Core.Dto.Contact
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Messages.Activity.Copy
|
||||
@inject IManageDataService ManageData
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject IMessenger Messenger
|
||||
@inject IDialogService Dialog
|
||||
@inject IAttachedService AttachedService
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave"
|
||||
OnSave="Save" Title="@(IsNew ? "Nuova" : $"{ActivityModel.ActivityId}")"/>
|
||||
<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="container-button">
|
||||
<MudButton Class="button-settings blue-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.Description"
|
||||
Size="Size.Medium"
|
||||
OnClick="@SuggestActivityDescription"
|
||||
Variant="Variant.Outlined">
|
||||
Suggerisci descrizione
|
||||
</MudButton>
|
||||
<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">
|
||||
<MudAutocomplete ReadOnly="IsView" T="string?" Placeholder="Cliente"
|
||||
SearchFunc="@SearchCliente" @bind-Value="ActivityModel.Cliente"
|
||||
@bind-Value:after="OnClienteChanged"
|
||||
SearchFunc="@SearchCliente" @bind-Value="ActivityModel.Cliente" @bind-Value:after="OnClienteChanged"
|
||||
CoerceValue="true"/>
|
||||
</div>
|
||||
|
||||
@@ -54,24 +34,18 @@
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Commessa</span>
|
||||
|
||||
@if (ActivityModel.CodJcom != null && SelectedComessa == null)
|
||||
@if (Commesse.IsNullOrEmpty())
|
||||
{
|
||||
<MudSkeleton/>
|
||||
<span class="warning-text">Nessuna commessa presente</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAutocomplete
|
||||
T="JtbComt?" ReadOnly="IsView"
|
||||
@bind-Value="SelectedComessa"
|
||||
@bind-Value:after="OnCommessaSelectedAfter"
|
||||
SearchFunc="SearchCommesseAsync"
|
||||
ToStringFunc="@(c => c == null ? string.Empty : $"{c.CodJcom} - {c.Descrizione}")"
|
||||
Clearable="true"
|
||||
OnClearButtonClick="OnCommessaClear"
|
||||
ShowProgressIndicator="true"
|
||||
DebounceInterval="300"
|
||||
MaxItems="50"
|
||||
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code"/>
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Commesse.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="ActivityModel.CodJcom" @bind-Value:after="OnCommessaChanged" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var com in Commesse)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@com.CodJcom">@($"{com.CodJcom} - {com.Descrizione}")</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@@ -80,10 +54,7 @@
|
||||
<div class="form-container">
|
||||
<span>Inizio</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture"
|
||||
InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedTime"
|
||||
@bind-Value:after="OnAfterChangeValue" DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture" InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedTime" @bind-Value:after="OnAfterChangeValue" DebounceInterval="500" OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
@@ -91,43 +62,15 @@
|
||||
<div class="form-container">
|
||||
<span>Fine</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture"
|
||||
InputType="InputType.DateTimeLocal" @bind-Value="ActivityModel.EstimatedEndtime"
|
||||
@bind-Value:after="OnAfterChangeValue" DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
<MudTextField ReadOnly="IsView" T="DateTime?" Format="s" Culture="CultureInfo.CurrentUICulture" 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 class="disable-full-width">Avviso</span>
|
||||
<span>Avviso</span>
|
||||
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || ActivityModel.EstimatedTime == null)"
|
||||
T="int" Variant="Variant.Text" @bind-Value="ActivityModel.MinuteBefore"
|
||||
@bind-Value:after="OnAfterChangeTimeBefore" Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="Nessuno" Value="-1">
|
||||
Nessuno
|
||||
</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="All'ora pianificata" Value="0">All'ora
|
||||
pianificata
|
||||
</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="30 minuti prima" Value="30">
|
||||
30 minuti prima
|
||||
</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="1 ora prima" Value="60">
|
||||
1 ora prima
|
||||
</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="2 ore prima" Value="120">
|
||||
2 ore prima
|
||||
</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="1 giorno prima" Value="1440">
|
||||
1 giorno prima
|
||||
</MudSelectItemExtended>
|
||||
<MudSelectItemExtended Class="custom-item-select" Text="1 settimana prima" Value="10080">
|
||||
1 settimana prima
|
||||
</MudSelectItemExtended>
|
||||
</MudSelectExtended>
|
||||
<MudSwitch ReadOnly="IsView" T="bool" Disabled="true" Color="Color.Primary"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -135,27 +78,12 @@
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Assegnata a</span>
|
||||
|
||||
@if (ActivityModel.UserName != null && SelectedUser == null)
|
||||
{
|
||||
<MudSkeleton/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudAutocomplete
|
||||
Disabled="Users.IsNullOrEmpty()" ReadOnly="IsView"
|
||||
T="StbUser"
|
||||
@bind-Value="SelectedUser"
|
||||
@bind-Value:after="OnUserSelectedAfter"
|
||||
SearchFunc="SearchUtentiAsync"
|
||||
ToStringFunc="@(u => u == null ? string.Empty : u.FullName)"
|
||||
Clearable="true"
|
||||
OnClearButtonClick="OnUserClear"
|
||||
ShowProgressIndicator="true"
|
||||
DebounceInterval="300"
|
||||
MaxItems="50"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code"/>
|
||||
}
|
||||
<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>
|
||||
@@ -163,23 +91,12 @@
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo</span>
|
||||
|
||||
@if (ActivityType.IsNullOrEmpty())
|
||||
{
|
||||
<MudSkeleton/>
|
||||
}
|
||||
else
|
||||
{
|
||||
<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>
|
||||
}
|
||||
<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>
|
||||
@@ -187,114 +104,52 @@
|
||||
<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">
|
||||
<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>
|
||||
<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"/>
|
||||
<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 class="container-chip-attached">
|
||||
@if (!AttachedList.IsNullOrEmpty())
|
||||
{
|
||||
foreach (var item in AttachedList!.Select((p, index) => new { p, index }))
|
||||
{
|
||||
@if (item.p.Type == AttachedDTO.TypeAttached.Position)
|
||||
{
|
||||
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success"
|
||||
OnClick="@(() => OpenPosition(item.p))"
|
||||
OnClose="@(() => OnRemoveAttached(item.index))">
|
||||
@item.p.Description
|
||||
</MudChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string" Color="Color.Default" OnClick="@(() => OpenAttached(item.p))"
|
||||
OnClose="@(() => OnRemoveAttached(item.index))">
|
||||
@item.p.Name
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if (!IsLoading)
|
||||
{
|
||||
if (ActivityFileList != null)
|
||||
{
|
||||
foreach (var file in ActivityFileList)
|
||||
{
|
||||
<MudChip T="string" OnClick="@(() => OpenAttached(file.Id, file.FileName))"
|
||||
OnClose="@(() => DeleteAttach(file))" Color="Color.Default">
|
||||
@file.FileName
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7"/>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (!IsView)
|
||||
|
||||
@if (!IsNew)
|
||||
{
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings green-icon"
|
||||
<MudButton Class="button-settings gray-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.AttachFile"
|
||||
StartIcon="@Icons.Material.Filled.ContentCopy"
|
||||
Size="Size.Medium"
|
||||
OnClick="OpenAddAttached"
|
||||
OnClick="Duplica"
|
||||
Variant="Variant.Outlined">
|
||||
Aggiungi allegati
|
||||
Duplica
|
||||
</MudButton>
|
||||
|
||||
@if (!IsNew)
|
||||
{
|
||||
<div class="divider"></div>
|
||||
<div class="divider"></div>
|
||||
|
||||
<MudButton Class="button-settings gray-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.ContentCopy"
|
||||
Size="Size.Medium"
|
||||
OnClick="Duplica"
|
||||
Variant="Variant.Outlined">
|
||||
Duplica
|
||||
</MudButton>
|
||||
|
||||
<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>
|
||||
}
|
||||
<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>
|
||||
|
||||
|
||||
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
||||
<MessageContent>
|
||||
Confermi la cancellazione dell'attività corrente?
|
||||
</MessageContent>
|
||||
<YesButton>
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
||||
StartIcon="@Icons.Material.Rounded.DeleteForever">
|
||||
StartIcon="@Icons.Material.Filled.DeleteForever">
|
||||
Cancella
|
||||
</MudButton>
|
||||
</YesButton>
|
||||
@@ -304,10 +159,7 @@
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel"
|
||||
@bind-ActivityModel:after="OnAfterChangeEsito"/>
|
||||
|
||||
<AddMemo @bind-IsSheetVisible="OpenAddMemo"/>
|
||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
@@ -319,16 +171,14 @@
|
||||
private ActivityDTO ActivityModel { get; set; } = new();
|
||||
|
||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
||||
private List<SrlActivityTypeUser> ActivityType { get; set; } = [];
|
||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
||||
private List<StbUser> Users { get; set; } = [];
|
||||
private List<JtbComt> Commesse { get; set; } = [];
|
||||
private List<AnagClie> Clienti { get; set; } = [];
|
||||
private List<PtbPros> Pros { get; set; } = [];
|
||||
private List<ActivityFileDto>? ActivityFileList { get; set; }
|
||||
|
||||
private bool IsNew { get; set; }
|
||||
private bool IsLoading { get; set; }
|
||||
private bool IsView => !NetworkService.ConnectionAvailable;
|
||||
private bool IsNew => Id.IsNullOrEmpty();
|
||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
@@ -336,52 +186,33 @@
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
private bool OpenEsito { get; set; }
|
||||
private bool OpenAddMemo { get; set; }
|
||||
private bool OpenEsito { get; set; } = false;
|
||||
|
||||
//MessageBox
|
||||
private MudMessageBox ConfirmDelete { get; set; }
|
||||
|
||||
//Attached
|
||||
private List<AttachedDTO>? AttachedList { get; set; }
|
||||
private bool CanAddPosition { get; set; } = true;
|
||||
|
||||
// cache per commesse
|
||||
private string? _lastLoadedCodAnag;
|
||||
|
||||
//Commessa
|
||||
private JtbComt? SelectedComessa { get; set; }
|
||||
|
||||
//User
|
||||
private StbUser? SelectedUser { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
_ = LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
|
||||
if (!Id.IsNullOrEmpty())
|
||||
ActivityModel = (await ManageData.GetActivity(x => x.ActivityId.Equals(Id))).Last();
|
||||
|
||||
if (ActivityCopied != null)
|
||||
{
|
||||
ActivityModel = ActivityCopied.Clone();
|
||||
}
|
||||
else if (!Id.IsNullOrEmpty())
|
||||
{
|
||||
ActivityModel = (await ManageData.GetActivity(new WhereCondActivity { ActivityId = Id }, true)).Last();
|
||||
}
|
||||
|
||||
if (Id.IsNullOrEmpty()) Id = ActivityModel.ActivityId;
|
||||
IsNew = Id.IsNullOrEmpty();
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
await LoadCommesse();
|
||||
|
||||
if (IsNew)
|
||||
{
|
||||
ActivityModel.EstimatedTime = DateTime.Today.AddHours(DateTime.Now.Hour);
|
||||
ActivityModel.EstimatedEndtime = ActivityModel.EstimatedTime?.AddHours(1);
|
||||
ActivityModel.EstimatedTime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour));
|
||||
ActivityModel.EstimatedEndtime = DateTime.Today.Add(TimeSpan.FromHours(DateTime.Now.Hour) + TimeSpan.FromHours(1));
|
||||
ActivityModel.UserName = UserSession.User.Username;
|
||||
}
|
||||
|
||||
_ = LoadData();
|
||||
|
||||
await LoadActivityType();
|
||||
OriginalModel = ActivityModel.Clone();
|
||||
}
|
||||
|
||||
@@ -392,308 +223,103 @@
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
await SavePosition();
|
||||
var response = await IntegryApiService.SaveActivity(ActivityModel);
|
||||
|
||||
if (response == null)
|
||||
return;
|
||||
|
||||
var newActivity = response.Last();
|
||||
|
||||
await ManageData.InsertOrUpdate(newActivity);
|
||||
await SaveAttached(newActivity.ActivityId!);
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(newActivity);
|
||||
}
|
||||
|
||||
private async Task SavePosition()
|
||||
{
|
||||
if (AttachedList is null) return;
|
||||
|
||||
var positionTasks = AttachedList
|
||||
.Where(a => a.Type == AttachedDTO.TypeAttached.Position)
|
||||
.Select(async attached =>
|
||||
{
|
||||
var position = new PositionDTO
|
||||
{
|
||||
Description = attached.Description,
|
||||
Lat = attached.Lat,
|
||||
Lng = attached.Lng
|
||||
};
|
||||
ActivityModel.Position = await IntegryApiService.SavePosition(position);
|
||||
});
|
||||
|
||||
await Task.WhenAll(positionTasks);
|
||||
}
|
||||
|
||||
private async Task SaveAttached(string activityId)
|
||||
{
|
||||
if (AttachedList is null) return;
|
||||
|
||||
var uploadTasks = AttachedList
|
||||
.Where(a => a.FileContent is not null && a.Type != AttachedDTO.TypeAttached.Position)
|
||||
.Select(a => IntegryApiService.UploadFile(activityId, a.FileBytes, a.Name));
|
||||
|
||||
await Task.WhenAll(uploadTasks);
|
||||
}
|
||||
|
||||
private bool CheckPreSave()
|
||||
{
|
||||
Snackbar.Clear();
|
||||
if (!ActivityModel.ActivityTypeId.IsNullOrEmpty()) return true;
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
|
||||
if (!ActivityModel.ActivityTypeId.IsNullOrEmpty()) return true;
|
||||
Snackbar.Add("Tipo attività obbligatorio!", Severity.Error);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Task LoadData()
|
||||
private async Task LoadData()
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
IsLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
SelectedComessa = ActivityModel.Commessa;
|
||||
|
||||
Users = await ManageData.GetTable<StbUser>();
|
||||
if (!ActivityModel.UserName.IsNullOrEmpty())
|
||||
{
|
||||
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
if (!IsNew && Id != null)
|
||||
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
|
||||
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
|
||||
Pros = await ManageData.GetProspect();
|
||||
|
||||
IsLoading = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
Users = await ManageData.GetTable<StbUser>();
|
||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
||||
Pros = await ManageData.GetTable<PtbPros>();
|
||||
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||
}
|
||||
|
||||
private async Task LoadActivityType()
|
||||
{
|
||||
if (ActivityModel.UserName is null)
|
||||
{
|
||||
ActivityType = [];
|
||||
return;
|
||||
}
|
||||
private async Task LoadCommesse() =>
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(ActivityModel.CodAnag));
|
||||
|
||||
ActivityType = await ManageData.GetTable<SrlActivityTypeUser>(x => x.UserName != null && x.UserName.Equals(ActivityModel.UserName)
|
||||
private async Task<IEnumerable<string>?> SearchCliente(string value, CancellationToken token)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
return null;
|
||||
|
||||
var listToReturn = new List<string>();
|
||||
|
||||
listToReturn.AddRange(
|
||||
Clienti.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)).Select(x => $"{x.CodAnag} - {x.RagSoc}")
|
||||
);
|
||||
|
||||
listToReturn.AddRange(
|
||||
Pros.Where(x => x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase)).Select(x => $"{x.CodPpro} - {x.RagSoc}")
|
||||
);
|
||||
|
||||
return listToReturn;
|
||||
}
|
||||
|
||||
private async Task LoadCommesse(string searchValue)
|
||||
{
|
||||
if (_lastLoadedCodAnag == ActivityModel.CodAnag && searchValue.IsNullOrEmpty()) return;
|
||||
|
||||
if (ActivityModel.CodAnag == null)
|
||||
{
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x =>
|
||||
x.CodJcom.ToUpper().Contains(searchValue.ToUpper()) ||
|
||||
x.Descrizione.ToUpper().Contains(searchValue.ToUpper())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag == ActivityModel.CodAnag);
|
||||
}
|
||||
|
||||
Commesse = Commesse.OrderByDescending(x => x.CodJcom).ToList();
|
||||
_lastLoadedCodAnag = ActivityModel.CodAnag;
|
||||
}
|
||||
|
||||
private async Task<IEnumerable<JtbComt>> SearchCommesseAsync(string value, CancellationToken token)
|
||||
{
|
||||
await LoadCommesse(value);
|
||||
if (Commesse.IsNullOrEmpty()) return [];
|
||||
|
||||
IEnumerable<JtbComt> list;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
list = Commesse.OrderByDescending(x => x.CodJcom).Take(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
list = Commesse
|
||||
.Where(x => (x.CodJcom.Contains(value, StringComparison.OrdinalIgnoreCase)
|
||||
|| x.Descrizione.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||
&& (x.CodAnag == ActivityModel.CodAnag || ActivityModel.CodAnag == null))
|
||||
.OrderByDescending(x => x.CodJcom)
|
||||
.Take(50);
|
||||
}
|
||||
|
||||
return token.IsCancellationRequested ? [] : list;
|
||||
}
|
||||
|
||||
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 Task<IEnumerable<string>?> SearchCliente(string value, CancellationToken token)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
return Task.FromResult<IEnumerable<string>?>(null);
|
||||
|
||||
var results = new List<string>();
|
||||
|
||||
results.AddRange(Clienti
|
||||
.Where(x => (x.CodAnag != null && x.CodAnag.Contains(value, StringComparison.OrdinalIgnoreCase)) || x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||
.Select(x => $"{x.CodAnag} - {x.RagSoc}"));
|
||||
|
||||
results.AddRange(Pros
|
||||
.Where(x => (x.CodPpro != null && x.CodPpro.Contains(value, StringComparison.OrdinalIgnoreCase)) || x.RagSoc.Contains(value, StringComparison.OrdinalIgnoreCase))
|
||||
.Select(x => $"{x.CodPpro} - {x.RagSoc}"));
|
||||
|
||||
return Task.FromResult<IEnumerable<string>?>(results);
|
||||
}
|
||||
|
||||
private Task OnClienteChanged()
|
||||
private async Task OnClienteChanged()
|
||||
{
|
||||
ActivityModel.CodJcom = null;
|
||||
if (string.IsNullOrWhiteSpace(ActivityModel.Cliente)) return Task.CompletedTask;
|
||||
|
||||
var parts = ActivityModel.Cliente.Split('-', 2, StringSplitOptions.TrimEntries);
|
||||
if (parts.Length == 2)
|
||||
{
|
||||
ActivityModel.CodAnag = parts[0];
|
||||
ActivityModel.Cliente = parts[1];
|
||||
if (ActivityModel.Cliente.IsNullOrEmpty()) return;
|
||||
|
||||
var isCliente = Clienti.FirstOrDefault(x => x.CodAnag != null && x.CodAnag.Equals(ActivityModel.CodAnag));
|
||||
ActivityModel.TipoAnag = isCliente == null ? "P" : "C";
|
||||
}
|
||||
var match = Regex.Match(ActivityModel.Cliente!, @"^\s*(\S+)\s*-\s*(.*)$");
|
||||
if (!match.Success)
|
||||
return;
|
||||
|
||||
OnAfterChangeValue();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void OnCommessaSelectedAfter()
|
||||
{
|
||||
var com = SelectedComessa;
|
||||
if (com != null)
|
||||
{
|
||||
ActivityModel.CodJcom = com.CodJcom;
|
||||
ActivityModel.Commessa = com;
|
||||
|
||||
if (com.CodAnag != null)
|
||||
{
|
||||
ActivityModel.CodAnag = com.CodAnag;
|
||||
ActivityModel.TipoAnag = com.TipoAnag;
|
||||
ActivityModel.Cliente = Clienti
|
||||
.Where(x => x.CodAnag != null && x.CodAnag.Equals(com.CodAnag))
|
||||
.Select(x => x.RagSoc)
|
||||
.FirstOrDefault() ?? Pros
|
||||
.Where(x => x.CodPpro != null && x.CodPpro.Equals(com.CodAnag))
|
||||
.Select(x => x.RagSoc)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
ActivityModel.CodAnag = null;
|
||||
ActivityModel.Cliente = null;
|
||||
ActivityModel.TipoAnag = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ActivityModel.CodJcom = null;
|
||||
ActivityModel.Commessa = null;
|
||||
ActivityModel.CodAnag = null;
|
||||
ActivityModel.Cliente = null;
|
||||
ActivityModel.TipoAnag = null;
|
||||
}
|
||||
ActivityModel.CodAnag = match.Groups[1].Value;
|
||||
ActivityModel.Cliente = match.Groups[2].Value;
|
||||
|
||||
await LoadCommesse();
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private async Task OnUserSelectedAfter()
|
||||
private async Task OnCommessaChanged()
|
||||
{
|
||||
ActivityModel.UserName = SelectedUser?.UserName;
|
||||
await LoadActivityType();
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private async Task OnCommessaClear()
|
||||
{
|
||||
ActivityModel.Commessa = null;
|
||||
ActivityModel.CodJcom = null;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnUserClear()
|
||||
{
|
||||
ActivityModel.UserName = null;
|
||||
ActivityType = [];
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private void OnAfterChangeTimeBefore()
|
||||
{
|
||||
if (ActivityModel.EstimatedTime is not null)
|
||||
{
|
||||
ActivityModel.NotificationDate = ActivityModel.MinuteBefore switch
|
||||
{
|
||||
-1 => null,
|
||||
0 => ActivityModel.EstimatedTime,
|
||||
_ => ActivityModel.EstimatedTime.Value.AddMinutes(ActivityModel.MinuteBefore * -1)
|
||||
};
|
||||
}
|
||||
|
||||
ActivityModel.Commessa = (await ManageData.GetTable<JtbComt>(x => x.CodJcom.Equals(ActivityModel.CodJcom))).Last().Descrizione;
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
if (!IsNew)
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(ActivityModel) ? "Aggiorna" : null;
|
||||
}
|
||||
|
||||
if (ActivityModel.EstimatedTime is not null &&
|
||||
(ActivityModel.EstimatedEndtime is null || ActivityModel.EstimatedEndtime <= ActivityModel.EstimatedTime))
|
||||
if (ActivityModel.EstimatedEndtime <= ActivityModel.EstimatedTime)
|
||||
{
|
||||
ActivityModel.EstimatedEndtime = ActivityModel.EstimatedTime.Value.AddHours(1);
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private Task OnAfterChangeEsito()
|
||||
{
|
||||
OnAfterChangeValue();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void OpenSelectEsito()
|
||||
{
|
||||
if (IsView) return;
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username))) return;
|
||||
|
||||
OpenEsito = !OpenEsito;
|
||||
StateHasChanged();
|
||||
@@ -732,141 +358,9 @@
|
||||
private void Duplica()
|
||||
{
|
||||
var activityCopy = ActivityModel.Clone();
|
||||
activityCopy.ActivityId = null;
|
||||
|
||||
MudDialog.Cancel();
|
||||
Messenger.Send(new CopyActivityMessage(activityCopy));
|
||||
}
|
||||
|
||||
private async Task OpenAddAttached()
|
||||
{
|
||||
var result = await ModalHelpers.OpenAddAttached(Dialog, CanAddPosition);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(AttachedDTO))
|
||||
{
|
||||
var attached = (AttachedDTO)result.Data;
|
||||
|
||||
if (attached.Type == AttachedDTO.TypeAttached.Position)
|
||||
CanAddPosition = false;
|
||||
|
||||
AttachedList ??= [];
|
||||
AttachedList.Add(attached);
|
||||
|
||||
LabelSave = "Aggiorna";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRemoveAttached(int index)
|
||||
{
|
||||
if (AttachedList is null || index < 0 || index >= AttachedList.Count)
|
||||
return;
|
||||
|
||||
var attached = AttachedList[index];
|
||||
|
||||
if (attached.Type == AttachedDTO.TypeAttached.Position)
|
||||
CanAddPosition = true;
|
||||
|
||||
AttachedList.RemoveAt(index);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OpenAttached(string idAttached, string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var bytes = await IntegryApiService.DownloadFile(ActivityModel.ActivityId!, fileName);
|
||||
await AttachedService.OpenFile(bytes, fileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("Impossibile aprire il file", Severity.Error);
|
||||
Console.WriteLine($"Errore durante l'apertura del file: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OpenAttached(AttachedDTO attached)
|
||||
{
|
||||
if (attached is { FileContent: not null, MimeType: not null })
|
||||
{
|
||||
await AttachedService.OpenFile(attached.FileContent!, attached.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("Impossibile aprire il file", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteAttach(ActivityFileDto file)
|
||||
{
|
||||
Snackbar.Clear();
|
||||
|
||||
if (ActivityFileList == null) return;
|
||||
|
||||
try
|
||||
{
|
||||
ActivityFileList.Remove(file);
|
||||
StateHasChanged();
|
||||
|
||||
await IntegryApiService.DeleteFile(ActivityModel.ActivityId!, file.FileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ActivityFileList.Add(file);
|
||||
StateHasChanged();
|
||||
|
||||
Snackbar.Add("Impossibile eliminare il file", Severity.Error);
|
||||
Console.WriteLine($"Impossibile eliminare il file: {ex.Message}");
|
||||
}
|
||||
finally
|
||||
{
|
||||
Snackbar.Add($"{file.FileName} eliminato con successo", Severity.Info);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenPosition(AttachedDTO attached)
|
||||
{
|
||||
if (attached is { Lat: not null, Lng: not null })
|
||||
{
|
||||
const string baseUrl = "https://www.google.it/maps/place/";
|
||||
NavigationManager.NavigateTo(
|
||||
$"{baseUrl}{AdjustCoordinate(attached.Lat.Value)},{AdjustCoordinate(attached.Lng.Value)}"
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("Impossibile aprire la posizione", Severity.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private static string AdjustCoordinate(double coordinate) =>
|
||||
coordinate.ToString(CultureInfo.InvariantCulture).Replace(",", ".");
|
||||
|
||||
private async Task SuggestActivityDescription()
|
||||
{
|
||||
if (ActivityModel.ActivityTypeId == null)
|
||||
{
|
||||
Snackbar.Add("Indicare prima il tipo attività", Severity.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
var activityDescriptions = await IntegryApiService.SuggestActivityDescription(ActivityModel.ActivityTypeId);
|
||||
|
||||
var modal = ModalHelpers.OpenSuggestActivityDescription(Dialog, activityDescriptions);
|
||||
|
||||
if (modal is { IsCanceled: false, Result: not null })
|
||||
ActivityModel.ActivityDescription = modal.Result.Data!.ToString();
|
||||
|
||||
VisibleOverlay = false;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,3 @@
|
||||
.container-chip-attached {
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.container-button {
|
||||
background: var(--mud-palette-background-gray) !important;
|
||||
box-shadow: unset;
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@inject IAttachedService AttachedService
|
||||
|
||||
<MudDialog Class="customDialog-form disable-safe-area">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" SmallHeader="true" Cancel="true" OnCancel="() => MudDialog.Cancel()" Title="@TitleModal"/>
|
||||
|
||||
@if (RequireNewName)
|
||||
{
|
||||
<MudTextField @bind-Value="NewName" Class="px-3" Variant="Variant.Outlined"/>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (!SelectTypePicture)
|
||||
{
|
||||
<div style="margin-bottom: 1rem;" class="content attached">
|
||||
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.Image"
|
||||
Label="Immagini" OnClick="OnImage"/>
|
||||
|
||||
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.InsertDriveFile"
|
||||
Label="File" OnClick="OnFile"/>
|
||||
|
||||
@if (CanAddPosition)
|
||||
{
|
||||
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.AddLocationAlt"
|
||||
Label="Posizione" OnClick="OnPosition"/>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="margin-bottom: 1rem;" class="content attached">
|
||||
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.CameraAlt"
|
||||
Label="Camera" OnClick="OnCamera"/>
|
||||
|
||||
<MudFab Size="Size.Small" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.Image"
|
||||
Label="Galleria" OnClick="OnGallery"/>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
@if (RequireNewName)
|
||||
{
|
||||
<MudButton Disabled="NewName.IsNullOrEmpty()" Class="my-3" Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.Check" OnClick="OnNewName">
|
||||
Salva
|
||||
</MudButton>
|
||||
}
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public bool CanAddPosition { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
private AttachedDTO? Attached { get; set; }
|
||||
|
||||
private bool _requireNewName;
|
||||
private bool RequireNewName
|
||||
{
|
||||
get => _requireNewName;
|
||||
set
|
||||
{
|
||||
_requireNewName = value;
|
||||
TitleModal = _requireNewName ? "Nome allegato" : "Aggiungi allegati";
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
private bool SelectTypePicture { get; set; }
|
||||
|
||||
private string TitleModal { get; set; } = "Aggiungi allegati";
|
||||
|
||||
private string? _newName;
|
||||
private string? NewName
|
||||
{
|
||||
get => _newName;
|
||||
set
|
||||
{
|
||||
_newName = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SelectTypePicture = false;
|
||||
RequireNewName = false;
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
}
|
||||
|
||||
private async Task OnImage()
|
||||
{
|
||||
SelectTypePicture = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnCamera()
|
||||
{
|
||||
Attached = await AttachedService.SelectImageFromCamera();
|
||||
|
||||
if (Attached != null)
|
||||
{
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnGallery()
|
||||
{
|
||||
Attached = await AttachedService.SelectImageFromGallery();
|
||||
|
||||
if (Attached != null)
|
||||
{
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnFile()
|
||||
{
|
||||
Attached = await AttachedService.SelectFile();
|
||||
MudDialog.Close(Attached);
|
||||
}
|
||||
|
||||
private async Task OnPosition()
|
||||
{
|
||||
Attached = await AttachedService.SelectPosition();
|
||||
|
||||
if (Attached != null)
|
||||
{
|
||||
RequireNewName = true;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNewName()
|
||||
{
|
||||
if (Attached != null)
|
||||
{
|
||||
switch (Attached.Type)
|
||||
{
|
||||
case AttachedDTO.TypeAttached.Position:
|
||||
{
|
||||
CanAddPosition = false;
|
||||
|
||||
Attached.Description = NewName!;
|
||||
Attached.Name = NewName!;
|
||||
|
||||
break;
|
||||
}
|
||||
case AttachedDTO.TypeAttached.Image:
|
||||
{
|
||||
var extension = Path.GetExtension(Attached.Name);
|
||||
Attached.Name = NewName! + extension;
|
||||
|
||||
break;
|
||||
}
|
||||
case AttachedDTO.TypeAttached.Document:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
MudDialog.Close(Attached);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
.content.attached {
|
||||
display: flex;
|
||||
gap: 2rem;
|
||||
padding: 1rem;
|
||||
height: unset;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
@@ -1,658 +0,0 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@using salesbook.Shared.Core.Entity
|
||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||
@using salesbook.Shared.Core.Dto.Contact
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@inject IManageDataService ManageData
|
||||
@inject INetworkService NetworkService
|
||||
@inject IIntegryApiService IntegryApiService
|
||||
@inject IDialogService Dialog
|
||||
|
||||
<MudDialog Class="customDialog-form">
|
||||
<DialogContent>
|
||||
<HeaderLayout ShowProfile="false" Cancel="true" OnCancel="() => MudDialog.Cancel()" LabelSave="@LabelSave" OnSave="Save" Title="@(IsNew ? "Nuovo" : $"{ContactModel.CodContact}")"/>
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Azienda"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.RagSoc"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Nazione</span>
|
||||
|
||||
@if (Nazioni.IsNullOrEmpty())
|
||||
{
|
||||
<span class="warning-text">Nessuna nazione trovata</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || Nazioni.IsNullOrEmpty())" T="string?"
|
||||
Variant="Variant.Text" @bind-Value="ContactModel.Nazione" @bind-Value:after="OnAfterChangeValue"
|
||||
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||
@foreach (var nazione in Nazioni)
|
||||
{
|
||||
<MudSelectItemExtended Class="custom-item-select" Value="@nazione.CodNazioneAlpha2">@($"{nazione.Descrizione}")</MudSelectItemExtended>
|
||||
}
|
||||
</MudSelectExtended>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">P. IVA</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.PartIva"
|
||||
@bind-Value:after="OnAfterChangePIva"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Cod. Fiscale</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.CodFisc"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Tipo cliente</span>
|
||||
|
||||
<MudAutocomplete Disabled="VtbTipi.IsNullOrEmpty()" ReadOnly="IsView"
|
||||
T="VtbTipi"
|
||||
@bind-Value="SelectedType"
|
||||
@bind-Value:after="OnTypeSelectedAfter"
|
||||
SearchFunc="SearchTypeAsync"
|
||||
ToStringFunc="@(u => u == null ? string.Empty : $"{u.CodVtip} - {u.Descrizione}")"
|
||||
Clearable="true"
|
||||
ShowProgressIndicator="true"
|
||||
DebounceInterval="300"
|
||||
MaxItems="50"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (!IsView)
|
||||
{
|
||||
<div class="container-button mb-3">
|
||||
<MudButton Class="button-settings blue-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.Search"
|
||||
Size="Size.Medium"
|
||||
OnClick="() => OpenSearchAddress = !OpenSearchAddress"
|
||||
Variant="Variant.Outlined">
|
||||
Cerca indirizzo
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Indirizzo</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
@bind-Value="ContactModel.Indirizzo"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">CAP</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Cap"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Città</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Citta"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Provincia</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
MaxLength="2"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Prov"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">PEC</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.EMailPec"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">E-Mail</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.EMail"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Telefono</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="ContactModel.Telefono"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Agente</span>
|
||||
|
||||
<MudAutocomplete Disabled="Users.IsNullOrEmpty()" ReadOnly="IsView"
|
||||
T="StbUser"
|
||||
@bind-Value="SelectedUser"
|
||||
@bind-Value:after="OnUserSelectedAfter"
|
||||
SearchFunc="SearchUtentiAsync"
|
||||
ToStringFunc="@(u => u == null ? string.Empty : u.FullName)"
|
||||
Clearable="true"
|
||||
ShowProgressIndicator="true"
|
||||
DebounceInterval="300"
|
||||
MaxItems="50"
|
||||
Class="customIcon-select"
|
||||
AdornmentIcon="@Icons.Material.Filled.Code" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (IsNew)
|
||||
{
|
||||
<div class="container-chip-persrif">
|
||||
@if (!PersRifList.IsNullOrEmpty())
|
||||
{
|
||||
foreach (var item in PersRifList!.Select((p, index) => new { p, index }))
|
||||
{
|
||||
<MudChip T="string" Color="Color.Default" OnClick="() => OpenPersRifForm(item.index, item.p)" OnClose="() => OnRemovePersRif(item.index)">
|
||||
@item.p.PersonaRif
|
||||
</MudChip>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (IsNew)
|
||||
{
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings gray-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Filled.PersonAddAlt1"
|
||||
Size="Size.Medium"
|
||||
OnClick="NewPersRif"
|
||||
Variant="Variant.Outlined">
|
||||
Persona di riferimento
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (NetworkService.ConnectionAvailable && !ContactModel.IsContact)
|
||||
{
|
||||
<div class="container-button">
|
||||
<MudButton Class="button-settings blue-icon"
|
||||
FullWidth="true"
|
||||
StartIcon="@Icons.Material.Rounded.Sync"
|
||||
Size="Size.Medium"
|
||||
OnClick="ConvertProspectToContact"
|
||||
Variant="Variant.Outlined">
|
||||
Converti in cliente
|
||||
</MudButton>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
<MudMessageBox MarkupMessage="new MarkupString(VatMessage)" @ref="CheckVat" Class="c-messageBox" Title="Verifica partita iva" CancelText="@(VatAlreadyRegistered ? "" : "Annulla")">
|
||||
<YesButton>
|
||||
@if (VatAlreadyRegistered)
|
||||
{
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
||||
StartIcon="@Icons.Material.Rounded.Close">
|
||||
Chiudi
|
||||
</MudButton>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||
StartIcon="@Icons.Material.Rounded.Check">
|
||||
Aggiungi
|
||||
</MudButton>
|
||||
}
|
||||
</YesButton>
|
||||
</MudMessageBox>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
<SearchAddress Region="@ContactModel.Nazione" @bind-IsSheetVisible="OpenSearchAddress" @bind-Indirizzo="Address" @bind-Indirizzo:after="OnAddressSet"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public ContactDTO? OriginalModel { get; set; }
|
||||
private ContactDTO ContactModel { get; set; } = new();
|
||||
|
||||
private List<VtbTipi>? VtbTipi { get; set; }
|
||||
private List<PersRifDTO>? PersRifList { get; set; }
|
||||
private List<Nazioni>? Nazioni { get; set; }
|
||||
private List<StbUser> Users { get; set; } = [];
|
||||
|
||||
private bool IsNew => OriginalModel is null;
|
||||
private bool IsView => !NetworkService.ConnectionAvailable;
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
//MessageBox
|
||||
private MudMessageBox CheckVat { get; set; }
|
||||
private string VatMessage { get; set; } = "";
|
||||
private bool VatAlreadyRegistered { get; set; }
|
||||
|
||||
//BottomSeath
|
||||
private bool OpenSearchAddress { get; set; }
|
||||
private IndirizzoDTO Address { get; set; }
|
||||
|
||||
//Agente
|
||||
private StbUser? SelectedUser { get; set; }
|
||||
|
||||
//Type
|
||||
private VtbTipi? SelectedType { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
|
||||
_ = LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var requestDto = new CRMCreateContactRequestDTO
|
||||
{
|
||||
TipoAnag = ContactModel.IsContact ? "C" : "P",
|
||||
Cliente = ContactModel,
|
||||
PersRif = PersRifList,
|
||||
CodVage = ContactModel.CodVage
|
||||
};
|
||||
|
||||
var response = await IntegryApiService.SaveContact(requestDto);
|
||||
|
||||
switch (response)
|
||||
{
|
||||
case null:
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
case {AnagClie: null, PtbPros: not null}:
|
||||
await ManageData.InsertOrUpdate(response.PtbPros);
|
||||
await ManageData.InsertOrUpdate(response.PtbProsRif);
|
||||
break;
|
||||
case { AnagClie: not null, PtbPros: null }:
|
||||
await ManageData.InsertOrUpdate(response.AnagClie);
|
||||
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
|
||||
break;
|
||||
default:
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(response);
|
||||
}
|
||||
|
||||
private Task LoadData()
|
||||
{
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
if (IsNew)
|
||||
{
|
||||
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||
|
||||
ContactModel.IsContact = false;
|
||||
ContactModel.Nazione = "IT";
|
||||
ContactModel.CodVage = loggedUser.UserCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
ContactModel = OriginalModel!.Clone();
|
||||
}
|
||||
|
||||
Users = await ManageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||
Nazioni = await ManageData.GetTable<Nazioni>();
|
||||
VtbTipi = await ManageData.GetTable<VtbTipi>();
|
||||
});
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
if (!IsNew)
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(ContactModel) ? "Aggiorna" : null;
|
||||
}
|
||||
}
|
||||
|
||||
private Task NewPersRif() => OpenPersRifForm(null, null);
|
||||
|
||||
private async Task OpenPersRifForm(int? index, PersRifDTO? persRif)
|
||||
{
|
||||
var result = await ModalHelpers.OpenPersRifForm(Dialog, persRif);
|
||||
|
||||
if (result is { Canceled: false, Data: not null } && result.Data.GetType() == typeof(PersRifDTO))
|
||||
{
|
||||
if (index != null)
|
||||
OnRemovePersRif(index.Value);
|
||||
|
||||
PersRifList ??= [];
|
||||
|
||||
PersRifList.Add((PersRifDTO)result.Data);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRemovePersRif(int index)
|
||||
{
|
||||
if (PersRifList is null || index < 0 || index >= PersRifList.Count)
|
||||
return;
|
||||
|
||||
PersRifList.RemoveAt(index);
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task OnAfterChangePIva()
|
||||
{
|
||||
CheckVatResponseDTO? response = null;
|
||||
var error = false;
|
||||
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var nazione = Nazioni?.Find(x =>
|
||||
x.CodNazioneAlpha2.Equals(ContactModel.Nazione) ||
|
||||
x.CodNazioneIso.Equals(ContactModel.Nazione) ||
|
||||
x.Nazione.Equals(ContactModel.Nazione)
|
||||
);
|
||||
|
||||
if (nazione == null)
|
||||
return;
|
||||
|
||||
var pIva = ContactModel.PartIva.Trim();
|
||||
|
||||
var clie = (await ManageData.GetClienti(new WhereCondContact {PartIva = pIva})).LastOrDefault();
|
||||
|
||||
if (clie == null)
|
||||
{
|
||||
var pros = (await ManageData.GetProspect(new WhereCondContact {PartIva = pIva})).LastOrDefault();
|
||||
|
||||
if (pros == null)
|
||||
{
|
||||
if (nazione.ChkPartIva)
|
||||
{
|
||||
if (!IsView)
|
||||
{
|
||||
try
|
||||
{
|
||||
response = await IntegryApiService.CheckVat(new CheckVatRequestDTO
|
||||
{
|
||||
CountryCode = nazione.CodNazioneAlpha2,
|
||||
VatNumber = pIva
|
||||
});
|
||||
|
||||
VatMessage = $"La p.Iva (<b>{pIva}</b>) corrisponde a:<br><br><b>{response.RagSoc}</b><br><b>{response.CompleteAddress}</b><br><br>Si desidera aggiungere questi dati nel form?";
|
||||
VatAlreadyRegistered = false;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add(e.Message, Severity.Error);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("La ricerca della partita iva non è al momento disponibile", Severity.Warning);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Snackbar.Clear();
|
||||
Snackbar.Add("La ricerca della partita iva non è abilitata per questa nazione", Severity.Warning);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VatMessage = $"Prospect (<b>{pros.CodPpro}</b>) già censito con la p.iva: <b>{pIva} - {pros.RagSoc}</b>";
|
||||
VatAlreadyRegistered = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VatMessage = $"Cliente (<b>{clie.CodAnag}</b>) già censito con la p.iva: <b>{pIva} - {clie.RagSoc}</b>";
|
||||
VatAlreadyRegistered = true;
|
||||
}
|
||||
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
|
||||
if (!error)
|
||||
{
|
||||
var result = await CheckVat.ShowAsync();
|
||||
|
||||
if (result is true && response != null)
|
||||
{
|
||||
ContactModel.RagSoc = response.RagSoc;
|
||||
ContactModel.Indirizzo = response.Indirizzo;
|
||||
ContactModel.Cap = response.Cap;
|
||||
ContactModel.Citta = response.Citta;
|
||||
ContactModel.Prov = response.Prov;
|
||||
}
|
||||
}
|
||||
|
||||
OnAfterChangeValue();
|
||||
}
|
||||
|
||||
private void OnAddressSet()
|
||||
{
|
||||
ContactModel.Citta = Address.Citta;
|
||||
ContactModel.Indirizzo = Address.Indirizzo;
|
||||
ContactModel.Prov = Address.Prov;
|
||||
ContactModel.Cap = Address.Cap;
|
||||
}
|
||||
|
||||
private async Task ConvertProspectToContact()
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
var response = await IntegryApiService.TransferProspect(new CRMTransferProspectRequestDTO
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
.container-button {
|
||||
background: var(--mud-palette-background-gray) !important;
|
||||
box-shadow: unset;
|
||||
}
|
||||
|
||||
.container-chip-persrif {
|
||||
width: 100%;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.search-address {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.65rem;
|
||||
color: var(--mud-palette-primary);
|
||||
font-weight: 600;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
@using salesbook.Shared.Core.Entity
|
||||
|
||||
<MudDialog OnBackdropClick="Cancel">
|
||||
<DialogContent>
|
||||
@if (!ActivityTypers.IsNullOrEmpty())
|
||||
{
|
||||
<MudList T="string" SelectedValueChanged="OnClickItem">
|
||||
@foreach (var item in ActivityTypers!)
|
||||
{
|
||||
<MudListItem Text="@item.ActivityTypeDescription" Value="item.ActivityTypeDescription"/>
|
||||
}
|
||||
</MudList>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="spinner-container">
|
||||
<MudIcon Size="Size.Large" Color="Color.Error" Icon="@Icons.Material.Rounded.Close"/>
|
||||
<MudText>Nessuna descrizione consigliata</MudText>
|
||||
</div>
|
||||
}
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
[Parameter] public List<StbActivityTyper>? ActivityTypers { get; set; }
|
||||
|
||||
private void Cancel() => MudDialog.Cancel();
|
||||
|
||||
private void OnClickItem(string? selectedValue) =>
|
||||
MudDialog.Close(DialogResult.Ok(selectedValue));
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
@using salesbook.Shared.Core.Dto
|
||||
@using salesbook.Shared.Components.Layout
|
||||
@using salesbook.Shared.Core.Interface
|
||||
@using salesbook.Shared.Components.Layout.Overlay
|
||||
@using salesbook.Shared.Core.Interface.IntegryApi
|
||||
@using salesbook.Shared.Core.Interface.System.Network
|
||||
@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 ? "Nuovo" : "")" />
|
||||
|
||||
<div class="content">
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Cognome e Nome"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.PersonaRif"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Placeholder="Mansione"
|
||||
Variant="Variant.Text"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.Mansione"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
|
||||
<div class="input-card">
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Email</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.EMail"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Fax</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.Fax"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Cellulare</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.NumCellulare"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue"/>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="form-container">
|
||||
<span class="disable-full-width">Telefono</span>
|
||||
|
||||
<MudTextField ReadOnly="IsView"
|
||||
T="string?"
|
||||
Variant="Variant.Text"
|
||||
FullWidth="true"
|
||||
Class="customIcon-select"
|
||||
Lines="1"
|
||||
@bind-Value="PersRifModel.Telefono"
|
||||
@bind-Value:after="OnAfterChangeValue"
|
||||
DebounceInterval="500"
|
||||
OnDebounceIntervalElapsed="OnAfterChangeValue" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</DialogContent>
|
||||
</MudDialog>
|
||||
|
||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||
|
||||
@code {
|
||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||
|
||||
[Parameter] public PersRifDTO? OriginalModel { get; set; }
|
||||
[Parameter] public ContactDTO? ContactModel { get; set; }
|
||||
[Parameter] public List<PersRifDTO>? PersRifList { get; set; }
|
||||
|
||||
private PersRifDTO PersRifModel { get; set; } = new();
|
||||
|
||||
private bool IsNew => OriginalModel is null;
|
||||
private bool IsView => !NetworkService.ConnectionAvailable;
|
||||
|
||||
private string? LabelSave { get; set; }
|
||||
|
||||
//Overlay for save
|
||||
private bool VisibleOverlay { get; set; }
|
||||
private bool SuccessAnimation { get; set; }
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||
|
||||
_ = LoadData();
|
||||
|
||||
LabelSave = IsNew ? "Aggiungi" : null;
|
||||
}
|
||||
|
||||
private async Task Save()
|
||||
{
|
||||
VisibleOverlay = true;
|
||||
StateHasChanged();
|
||||
|
||||
if (ContactModel != null && PersRifList != null)
|
||||
{
|
||||
PersRifList.Add(PersRifModel);
|
||||
|
||||
var requestDto = new CRMCreateContactRequestDTO
|
||||
{
|
||||
TipoAnag = ContactModel.IsContact ? "C" : "P",
|
||||
Cliente = ContactModel,
|
||||
PersRif = PersRifList,
|
||||
CodVage = ContactModel.CodVage,
|
||||
CodAnag = ContactModel.CodContact
|
||||
};
|
||||
|
||||
var response = await IntegryApiService.SaveContact(requestDto);
|
||||
|
||||
switch (response)
|
||||
{
|
||||
case null:
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
case {AnagClie: null, PtbPros: not null}:
|
||||
await ManageData.InsertOrUpdate(response.PtbPros);
|
||||
await ManageData.InsertOrUpdate(response.PtbProsRif);
|
||||
break;
|
||||
case { AnagClie: not null, PtbPros: null }:
|
||||
await ManageData.InsertOrUpdate(response.AnagClie);
|
||||
await ManageData.InsertOrUpdate(response.VtbCliePersRif);
|
||||
break;
|
||||
default:
|
||||
VisibleOverlay = false;
|
||||
StateHasChanged();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SuccessAnimation = true;
|
||||
StateHasChanged();
|
||||
|
||||
await Task.Delay(1250);
|
||||
|
||||
MudDialog.Close(PersRifModel);
|
||||
}
|
||||
|
||||
private async Task LoadData()
|
||||
{
|
||||
if (!IsNew)
|
||||
PersRifModel = OriginalModel!.Clone();
|
||||
}
|
||||
|
||||
private void OnAfterChangeValue()
|
||||
{
|
||||
if (!IsNew)
|
||||
{
|
||||
LabelSave = !OriginalModel.Equals(PersRifModel) ? "Aggiorna" : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
.container-button {
|
||||
background: var(--mud-palette-background-gray) !important;
|
||||
box-shadow: unset;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto.Activity;
|
||||
|
||||
public class CRMRetrieveActivityRequestDTO
|
||||
{
|
||||
[JsonPropertyName("dateFilter")]
|
||||
public string? DateFilter { get; set; }
|
||||
|
||||
[JsonPropertyName("activityId")]
|
||||
public string? ActivityId { get; set; }
|
||||
|
||||
[JsonPropertyName("codAnag")]
|
||||
public string? CodAnag { get; set; }
|
||||
|
||||
[JsonPropertyName("codJcom")]
|
||||
public string? CodJcom { get; set; }
|
||||
|
||||
[JsonPropertyName("startDate")]
|
||||
public DateTime? StarDate { get; set; }
|
||||
|
||||
[JsonPropertyName("endDate")]
|
||||
public DateTime? EndDate { get; set; }
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto.Activity;
|
||||
|
||||
public class WhereCondActivity
|
||||
{
|
||||
public DateTime? Start { get; set; }
|
||||
public DateTime? End { get; set; }
|
||||
|
||||
public string? ActivityId { get; set; }
|
||||
}
|
||||
@@ -1,26 +1,17 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using salesbook.Shared.Core.Entity;
|
||||
using salesbook.Shared.Core.Helpers.Enum;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto.Activity;
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class ActivityDTO : StbActivity
|
||||
{
|
||||
public JtbComt? Commessa { get; set; }
|
||||
public string? Commessa { get; set; }
|
||||
public string? Cliente { get; set; }
|
||||
public ActivityCategoryEnum Category { get; set; }
|
||||
public bool Complete { get; set; }
|
||||
|
||||
//Notification
|
||||
public int MinuteBefore { get; set; } = -1;
|
||||
[JsonPropertyName("notificationDate")]
|
||||
public DateTime? NotificationDate { get; set; }
|
||||
|
||||
public bool Deleted { get; set; }
|
||||
|
||||
[JsonPropertyName("stbPosizioni")]
|
||||
public PositionDTO? Position { get; set; }
|
||||
|
||||
public ActivityDTO Clone()
|
||||
{
|
||||
return (ActivityDTO)MemberwiseClone();
|
||||
@@ -30,11 +21,8 @@ public class ActivityDTO : StbActivity
|
||||
{
|
||||
return Commessa == other.Commessa &&
|
||||
Cliente == other.Cliente &&
|
||||
Position == other.Position &&
|
||||
MinuteBefore == other.MinuteBefore &&
|
||||
NotificationDate == other.NotificationDate &&
|
||||
Category == other.Category &&
|
||||
Complete == other.Complete && ActivityId == other.ActivityId && ActivityResultId == other.ActivityResultId && ActivityTypeId == other.ActivityTypeId && DataInsAct.Equals(other.DataInsAct) && ActivityDescription == other.ActivityDescription && ParentActivityId == other.ParentActivityId && TipoAnag == other.TipoAnag && CodAnag == other.CodAnag && CodJcom == other.CodJcom && CodJfas == other.CodJfas && Nullable.Equals(EstimatedTime, other.EstimatedTime) && Nullable.Equals(AlarmDate, other.AlarmDate) && Nullable.Equals(AlarmTime, other.AlarmTime) && Nullable.Equals(EffectiveTime, other.EffectiveTime) && ResultDescription == other.ResultDescription && Nullable.Equals(EstimatedEndtime, other.EstimatedEndtime) && Nullable.Equals(EffectiveEndtime, other.EffectiveEndtime) && UserCreator == other.UserCreator && UserName == other.UserName && Nullable.Equals(PercComp, other.PercComp) && Nullable.Equals(EstimatedHours, other.EstimatedHours) && CodMart == other.CodMart && PartitaMag == other.PartitaMag && Matricola == other.Matricola && Priorita == other.Priorita && Nullable.Equals(ActivityPlayCounter, other.ActivityPlayCounter) && ActivityEvent == other.ActivityEvent && Guarantee == other.Guarantee && Note == other.Note && Rfid == other.Rfid && IdLotto == other.IdLotto && PersonaRif == other.PersonaRif && HrNum == other.HrNum && Gestione == other.Gestione && Nullable.Equals(DataOrd, other.DataOrd) && NumOrd == other.NumOrd && IdStep == other.IdStep && IdRiga == other.IdRiga && Nullable.Equals(OraInsAct, other.OraInsAct) && IndiceGradimento == other.IndiceGradimento && NoteGradimento == other.NoteGradimento && FlagRisolto == other.FlagRisolto && FlagTipologia == other.FlagTipologia && OreRapportino == other.OreRapportino && UserModifier == other.UserModifier && Nullable.Equals(OraModAct, other.OraModAct) && Nullable.Equals(OraViewAct, other.OraViewAct) && CodVdes == other.CodVdes && CodCmac == other.CodCmac && WrikeId == other.WrikeId && CodMgrp == other.CodMgrp && PlanId == other.PlanId;
|
||||
Complete == other.Complete && ActivityId == other.ActivityId && ActivityResultId == other.ActivityResultId && ActivityTypeId == other.ActivityTypeId && DataInsAct.Equals(other.DataInsAct) && ActivityDescription == other.ActivityDescription && ParentActivityId == other.ParentActivityId && TipoAnag == other.TipoAnag && CodAnag == other.CodAnag && CodJcom == other.CodJcom && CodJfas == other.CodJfas && Nullable.Equals(EstimatedDate, other.EstimatedDate) && Nullable.Equals(EstimatedTime, other.EstimatedTime) && Nullable.Equals(AlarmDate, other.AlarmDate) && Nullable.Equals(AlarmTime, other.AlarmTime) && Nullable.Equals(EffectiveDate, other.EffectiveDate) && Nullable.Equals(EffectiveTime, other.EffectiveTime) && ResultDescription == other.ResultDescription && Nullable.Equals(EstimatedEnddate, other.EstimatedEnddate) && Nullable.Equals(EstimatedEndtime, other.EstimatedEndtime) && Nullable.Equals(EffectiveEnddate, other.EffectiveEnddate) && Nullable.Equals(EffectiveEndtime, other.EffectiveEndtime) && UserCreator == other.UserCreator && UserName == other.UserName && Nullable.Equals(PercComp, other.PercComp) && Nullable.Equals(EstimatedHours, other.EstimatedHours) && CodMart == other.CodMart && PartitaMag == other.PartitaMag && Matricola == other.Matricola && Priorita == other.Priorita && Nullable.Equals(ActivityPlayCounter, other.ActivityPlayCounter) && ActivityEvent == other.ActivityEvent && Guarantee == other.Guarantee && Note == other.Note && Rfid == other.Rfid && IdLotto == other.IdLotto && PersonaRif == other.PersonaRif && HrNum == other.HrNum && Gestione == other.Gestione && Nullable.Equals(DataOrd, other.DataOrd) && NumOrd == other.NumOrd && IdStep == other.IdStep && IdRiga == other.IdRiga && Nullable.Equals(OraInsAct, other.OraInsAct) && IndiceGradimento == other.IndiceGradimento && NoteGradimento == other.NoteGradimento && FlagRisolto == other.FlagRisolto && FlagTipologia == other.FlagTipologia && OreRapportino == other.OreRapportino && UserModifier == other.UserModifier && Nullable.Equals(OraModAct, other.OraModAct) && Nullable.Equals(OraViewAct, other.OraViewAct) && CodVdes == other.CodVdes && CodCmac == other.CodCmac && WrikeId == other.WrikeId && CodMgrp == other.CodMgrp && PlanId == other.PlanId;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
@@ -57,12 +45,16 @@ public class ActivityDTO : StbActivity
|
||||
hashCode.Add(CodAnag);
|
||||
hashCode.Add(CodJcom);
|
||||
hashCode.Add(CodJfas);
|
||||
hashCode.Add(EstimatedDate);
|
||||
hashCode.Add(EstimatedTime);
|
||||
hashCode.Add(AlarmDate);
|
||||
hashCode.Add(AlarmTime);
|
||||
hashCode.Add(EffectiveDate);
|
||||
hashCode.Add(EffectiveTime);
|
||||
hashCode.Add(ResultDescription);
|
||||
hashCode.Add(EstimatedEnddate);
|
||||
hashCode.Add(EstimatedEndtime);
|
||||
hashCode.Add(EffectiveEnddate);
|
||||
hashCode.Add(EffectiveEndtime);
|
||||
hashCode.Add(UserCreator);
|
||||
hashCode.Add(UserName);
|
||||
@@ -103,9 +95,6 @@ public class ActivityDTO : StbActivity
|
||||
hashCode.Add(Cliente);
|
||||
hashCode.Add(Category);
|
||||
hashCode.Add(Complete);
|
||||
hashCode.Add(Position);
|
||||
hashCode.Add(MinuteBefore);
|
||||
hashCode.Add(NotificationDate);
|
||||
return hashCode.ToHashCode();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class ActivityFileDto
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[JsonPropertyName("fileName")]
|
||||
public string FileName { get; set; }
|
||||
|
||||
[JsonPropertyName("originalSize")]
|
||||
public int OriginalSize { get; set; }
|
||||
|
||||
[JsonPropertyName("lastUpd")]
|
||||
public DateTime LastUpd { get; set; }
|
||||
|
||||
[JsonPropertyName("descrizione")]
|
||||
public string Descrizione { get; set; }
|
||||
|
||||
[JsonPropertyName("modello")]
|
||||
public string Modello { get; set; }
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class AttachedDTO
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? MimeType { get; set; }
|
||||
public long? DimensionBytes { get; set; }
|
||||
public string? Path { get; set; }
|
||||
|
||||
public byte[]? FileBytes { get; set; }
|
||||
|
||||
public Stream? FileContent =>
|
||||
FileBytes is null ? null : new MemoryStream(FileBytes);
|
||||
|
||||
public double? Lat { get; set; }
|
||||
public double? Lng { get; set; }
|
||||
|
||||
public TypeAttached Type { get; set; }
|
||||
|
||||
public enum TypeAttached
|
||||
{
|
||||
Image,
|
||||
Document,
|
||||
Position
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class AutoCompleteAddressDTO
|
||||
{
|
||||
[JsonPropertyName("description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[JsonPropertyName("placeId")]
|
||||
public string PlaceId { get; set; }
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace salesbook.Shared.Core.Dto;
|
||||
|
||||
public class CRMAttachedResponseDTO
|
||||
{
|
||||
[JsonPropertyName("fileName")]
|
||||
public string FileName { get; set; }
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[JsonPropertyName("dateAttached")]
|
||||
public DateTime DateAttached { get; set; }
|
||||
|
||||
[JsonPropertyName("fileSize")]
|
||||
public decimal FileSize { get; set; }
|
||||
|
||||
[JsonPropertyName("refUuid")]
|
||||
public string RefUuid { get; set; }
|
||||
|
||||
[JsonPropertyName("refAttached")]
|
||||
public string RefAttached { get; set; }
|
||||
|
||||
[JsonPropertyName("activity")]
|
||||
public bool IsActivity { get; set; }
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user