Compare commits
31 Commits
feature/Na
...
82d268d9f8
| Author | SHA1 | Date | |
|---|---|---|---|
| 82d268d9f8 | |||
| 014e2ffc41 | |||
| 8508820350 | |||
| 374b99501e | |||
| 8be3fa9f9e | |||
| 588dbe308a | |||
| 9957229e70 | |||
| cd88c79b32 | |||
| c9d7091355 | |||
| d90a194a4e | |||
| de9d415f04 | |||
| b561405ddc | |||
| c93b0c9bec | |||
| c003c29d83 | |||
| 8dfb163cfa | |||
| 068723f31f | |||
| 8ebc6e3b8f | |||
| 9c69884cc9 | |||
| b34f6cb213 | |||
| 7bcb0581cc | |||
| b2064ad71e | |||
| 8c521dc81e | |||
| 65e48777e6 | |||
| bf2e1b65f0 | |||
| 691c132fb6 | |||
| 5d292a12ef | |||
| 60f7d14a72 | |||
| 5fe41f9445 | |||
| e614c83a5b | |||
| c2da42a51b | |||
| ca6be0c0a8 |
109
salesbook.Maui/Core/Services/AttachedService.cs
Normal file
109
salesbook.Maui/Core/Services/AttachedService.cs
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
|
namespace salesbook.Maui.Core.Services;
|
||||||
|
|
||||||
|
public class AttachedService : IAttachedService
|
||||||
|
{
|
||||||
|
public async Task<AttachedDTO?> SelectImage()
|
||||||
|
{
|
||||||
|
var perm = await Permissions.RequestAsync<Permissions.Photos>();
|
||||||
|
if (perm != PermissionStatus.Granted) return null;
|
||||||
|
|
||||||
|
var result = await FilePicker.PickAsync(new PickOptions
|
||||||
|
{
|
||||||
|
PickerTitle = "Scegli un'immagine",
|
||||||
|
FileTypes = FilePickerFileType.Images
|
||||||
|
});
|
||||||
|
|
||||||
|
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Image);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AttachedDTO?> SelectFile()
|
||||||
|
{
|
||||||
|
var perm = await Permissions.RequestAsync<Permissions.StorageRead>();
|
||||||
|
if (perm != PermissionStatus.Granted) return null;
|
||||||
|
|
||||||
|
var result = await FilePicker.PickAsync();
|
||||||
|
|
||||||
|
return result is null ? null : await ConvertToDto(result, AttachedDTO.TypeAttached.Document);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<AttachedDTO?> SelectPosition()
|
||||||
|
{
|
||||||
|
var perm = await Permissions.RequestAsync<Permissions.LocationWhenInUse>();
|
||||||
|
if (perm != PermissionStatus.Granted) return null;
|
||||||
|
|
||||||
|
var loc = await Geolocation.GetLastKnownLocationAsync();
|
||||||
|
if (loc is null) return null;
|
||||||
|
|
||||||
|
return new AttachedDTO
|
||||||
|
{
|
||||||
|
Name = "Posizione attuale",
|
||||||
|
Lat = loc.Latitude,
|
||||||
|
Lng = loc.Longitude,
|
||||||
|
Type = AttachedDTO.TypeAttached.Position
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<AttachedDTO> ConvertToDto(FileResult file, AttachedDTO.TypeAttached type)
|
||||||
|
{
|
||||||
|
var stream = await file.OpenReadAsync();
|
||||||
|
using var ms = new MemoryStream();
|
||||||
|
await stream.CopyToAsync(ms);
|
||||||
|
|
||||||
|
return new AttachedDTO
|
||||||
|
{
|
||||||
|
Name = file.FileName,
|
||||||
|
Path = file.FullPath,
|
||||||
|
MimeType = file.ContentType,
|
||||||
|
DimensionBytes = ms.Length,
|
||||||
|
FileBytes = ms.ToArray(),
|
||||||
|
Type = type
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task<string?> SaveToTempStorage(Stream file, string fileName)
|
||||||
|
{
|
||||||
|
var cacheDirectory = FileSystem.CacheDirectory;
|
||||||
|
var targetDirectory = Path.Combine(cacheDirectory, "file");
|
||||||
|
|
||||||
|
if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory);
|
||||||
|
|
||||||
|
var tempFilePath = Path.Combine(targetDirectory, fileName + ".temp");
|
||||||
|
var filePath = Path.Combine(targetDirectory, fileName);
|
||||||
|
|
||||||
|
if (File.Exists(filePath)) return filePath;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await using var fileStream =
|
||||||
|
new FileStream(tempFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||||
|
await file.CopyToAsync(fileStream);
|
||||||
|
|
||||||
|
File.Move(tempFilePath, filePath);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Errore durante il salvataggio dello stream: {e.Message}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (File.Exists(tempFilePath)) File.Delete(tempFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenFile(Stream file, string fileName)
|
||||||
|
{
|
||||||
|
var filePath = await SaveToTempStorage(file, fileName);
|
||||||
|
|
||||||
|
if (filePath is null) return;
|
||||||
|
await Launcher.OpenAsync(new OpenFileRequest
|
||||||
|
{
|
||||||
|
File = new ReadOnlyFile(filePath)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,8 @@ public class LocalDbService
|
|||||||
_connection.CreateTableAsync<StbActivityResult>();
|
_connection.CreateTableAsync<StbActivityResult>();
|
||||||
_connection.CreateTableAsync<StbActivityType>();
|
_connection.CreateTableAsync<StbActivityType>();
|
||||||
_connection.CreateTableAsync<StbUser>();
|
_connection.CreateTableAsync<StbUser>();
|
||||||
|
_connection.CreateTableAsync<VtbTipi>();
|
||||||
|
_connection.CreateTableAsync<Nazioni>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ResetSettingsDb()
|
public async Task ResetSettingsDb()
|
||||||
@@ -32,10 +34,14 @@ public class LocalDbService
|
|||||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_activity_result;");
|
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 stb_activity_type;");
|
||||||
await _connection.ExecuteAsync("DROP TABLE IF EXISTS stb_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<StbActivityResult>();
|
||||||
await _connection.CreateTableAsync<StbActivityType>();
|
await _connection.CreateTableAsync<StbActivityType>();
|
||||||
await _connection.CreateTableAsync<StbUser>();
|
await _connection.CreateTableAsync<StbUser>();
|
||||||
|
await _connection.CreateTableAsync<VtbTipi>();
|
||||||
|
await _connection.CreateTableAsync<Nazioni>();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,20 +1,190 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using System.Linq.Expressions;
|
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
using salesbook.Shared.Core.Dto.Contact;
|
||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
using salesbook.Shared.Core.Helpers.Enum;
|
using salesbook.Shared.Core.Helpers.Enum;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
|
using Sentry.Protocol;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace salesbook.Maui.Core.Services;
|
namespace salesbook.Maui.Core.Services;
|
||||||
|
|
||||||
public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManageDataService
|
public class ManageDataService(
|
||||||
|
LocalDbService localDb,
|
||||||
|
IMapper mapper,
|
||||||
|
IIntegryApiService integryApiService,
|
||||||
|
INetworkService networkService
|
||||||
|
) : IManageDataService
|
||||||
{
|
{
|
||||||
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
|
public Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new() =>
|
||||||
localDb.Get(whereCond);
|
localDb.Get(whereCond);
|
||||||
|
|
||||||
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
public async Task<List<AnagClie>> GetClienti(WhereCondContact? whereCond)
|
||||||
{
|
{
|
||||||
var activities = await localDb.Get(whereCond);
|
List<AnagClie> clienti = [];
|
||||||
|
whereCond ??= new WhereCondContact();
|
||||||
|
whereCond.OnlyContact = true;
|
||||||
|
|
||||||
|
if (networkService.ConnectionAvailable)
|
||||||
|
{
|
||||||
|
var response = await integryApiService.RetrieveAnagClie(
|
||||||
|
new CRMAnagRequestDTO
|
||||||
|
{
|
||||||
|
CodAnag = whereCond.CodAnag,
|
||||||
|
FlagStato = whereCond.FlagStato,
|
||||||
|
PartIva = whereCond.PartIva,
|
||||||
|
ReturnPersRif = !whereCond.OnlyContact
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
clienti = response.AnagClie ?? [];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clienti = await localDb.Get<AnagClie>(x =>
|
||||||
|
(whereCond.FlagStato != null && x.FlagStato.Equals(whereCond.FlagStato)) ||
|
||||||
|
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||||
|
(whereCond.PartIva == null && whereCond.FlagStato == null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return clienti;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<PtbPros>> GetProspect(WhereCondContact? whereCond)
|
||||||
|
{
|
||||||
|
List<PtbPros> prospect = [];
|
||||||
|
whereCond ??= new WhereCondContact();
|
||||||
|
whereCond.OnlyContact = true;
|
||||||
|
|
||||||
|
if (networkService.ConnectionAvailable)
|
||||||
|
{
|
||||||
|
var response = await integryApiService.RetrieveProspect(
|
||||||
|
new CRMProspectRequestDTO
|
||||||
|
{
|
||||||
|
CodPpro = whereCond.CodAnag,
|
||||||
|
PartIva = whereCond.PartIva,
|
||||||
|
ReturnPersRif = !whereCond.OnlyContact
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
prospect = response.PtbPros ?? [];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prospect = await localDb.Get<PtbPros>(x =>
|
||||||
|
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||||
|
(whereCond.PartIva == null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return prospect;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<ContactDTO>> GetContact(WhereCondContact? whereCond)
|
||||||
|
{
|
||||||
|
List<AnagClie>? contactList;
|
||||||
|
List<PtbPros>? prospectList;
|
||||||
|
whereCond ??= new WhereCondContact();
|
||||||
|
|
||||||
|
if (networkService.ConnectionAvailable)
|
||||||
|
{
|
||||||
|
var clienti = await integryApiService.RetrieveAnagClie(
|
||||||
|
new CRMAnagRequestDTO
|
||||||
|
{
|
||||||
|
CodAnag = whereCond.CodAnag,
|
||||||
|
FlagStato = whereCond.FlagStato,
|
||||||
|
PartIva = whereCond.PartIva,
|
||||||
|
ReturnPersRif = !whereCond.OnlyContact
|
||||||
|
}
|
||||||
|
);
|
||||||
|
_ = UpdateDbUsers(clienti);
|
||||||
|
|
||||||
|
var prospect = await integryApiService.RetrieveProspect(
|
||||||
|
new CRMProspectRequestDTO
|
||||||
|
{
|
||||||
|
CodPpro = whereCond.CodAnag,
|
||||||
|
PartIva = whereCond.PartIva,
|
||||||
|
ReturnPersRif = !whereCond.OnlyContact
|
||||||
|
}
|
||||||
|
);
|
||||||
|
_ = UpdateDbUsers(prospect);
|
||||||
|
|
||||||
|
contactList = clienti.AnagClie;
|
||||||
|
prospectList = prospect.PtbPros;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
contactList = await localDb.Get<AnagClie>(x =>
|
||||||
|
(whereCond.FlagStato != null && x.FlagStato.Equals(whereCond.FlagStato)) ||
|
||||||
|
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||||
|
(whereCond.PartIva == null && whereCond.FlagStato == null)
|
||||||
|
);
|
||||||
|
prospectList = await localDb.Get<PtbPros>(x =>
|
||||||
|
(whereCond.PartIva != null && x.PartIva.Equals(whereCond.PartIva)) ||
|
||||||
|
(whereCond.PartIva == null)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mappa i contatti
|
||||||
|
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
||||||
|
|
||||||
|
// Mappa i prospects
|
||||||
|
var prospectMapper = mapper.Map<List<ContactDTO>>(prospectList);
|
||||||
|
|
||||||
|
contactMapper.AddRange(prospectMapper);
|
||||||
|
|
||||||
|
return contactMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<ContactDTO?> GetSpecificContact(string codAnag, bool isContact)
|
||||||
|
{
|
||||||
|
if (isContact)
|
||||||
|
{
|
||||||
|
var contact = (await localDb.Get<AnagClie>(x => x.CodAnag != null && x.CodAnag.Equals(codAnag)))
|
||||||
|
.LastOrDefault();
|
||||||
|
|
||||||
|
return contact == null ? null : mapper.Map<ContactDTO>(contact);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var contact = (await localDb.Get<PtbPros>(x => x.CodPpro != null && x.CodPpro.Equals(codAnag)))
|
||||||
|
.LastOrDefault();
|
||||||
|
|
||||||
|
return contact == null ? null : mapper.Map<ContactDTO>(contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<ActivityDTO>> GetActivity(WhereCondActivity whereCond, bool useLocalDb)
|
||||||
|
{
|
||||||
|
List<StbActivity>? activities;
|
||||||
|
|
||||||
|
if (networkService.ConnectionAvailable && !useLocalDb)
|
||||||
|
{
|
||||||
|
activities = await integryApiService.RetrieveActivity(
|
||||||
|
new CRMRetrieveActivityRequestDTO
|
||||||
|
{
|
||||||
|
StarDate = whereCond.Start,
|
||||||
|
EndDate = whereCond.End,
|
||||||
|
ActivityId = whereCond.ActivityId
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
_ = UpdateDb(activities);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activities = await localDb.Get<StbActivity>(x =>
|
||||||
|
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
|
||||||
|
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null &&
|
||||||
|
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) ||
|
||||||
|
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) ||
|
||||||
|
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activities == null) return [];
|
||||||
|
|
||||||
var codJcomList = activities
|
var codJcomList = activities
|
||||||
.Select(x => x.CodJcom)
|
.Select(x => x.CodJcom)
|
||||||
@@ -69,6 +239,39 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
|||||||
return returnDto;
|
return returnDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Task UpdateDbUsers(UsersSyncResponseDTO response)
|
||||||
|
{
|
||||||
|
return Task.Run(async () =>
|
||||||
|
{
|
||||||
|
if (response.AnagClie != null)
|
||||||
|
{
|
||||||
|
await localDb.InsertOrUpdate(response.AnagClie);
|
||||||
|
|
||||||
|
if (response.VtbDest != null) await localDb.InsertOrUpdate(response.VtbDest);
|
||||||
|
if (response.VtbCliePersRif != null) await localDb.InsertOrUpdate(response.VtbCliePersRif);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.PtbPros != null)
|
||||||
|
{
|
||||||
|
await localDb.InsertOrUpdate(response.PtbPros);
|
||||||
|
|
||||||
|
if (response.PtbProsRif != null) await localDb.InsertOrUpdate(response.PtbProsRif);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private Task UpdateDb<T>(List<T>? entityList)
|
||||||
|
{
|
||||||
|
return Task.Run(() =>
|
||||||
|
{
|
||||||
|
if (entityList == null) return;
|
||||||
|
_ = localDb.InsertOrUpdate(entityList);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task InsertOrUpdate<T>(List<T> listToSave) =>
|
||||||
|
localDb.InsertOrUpdate(listToSave);
|
||||||
|
|
||||||
public Task InsertOrUpdate<T>(T objectToSave) =>
|
public Task InsertOrUpdate<T>(T objectToSave) =>
|
||||||
localDb.InsertOrUpdate<T>([objectToSave]);
|
localDb.InsertOrUpdate<T>([objectToSave]);
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,11 @@ namespace salesbook.Maui.Core.Services;
|
|||||||
|
|
||||||
public class NetworkService : INetworkService
|
public class NetworkService : INetworkService
|
||||||
{
|
{
|
||||||
|
public bool ConnectionAvailable { get; set; }
|
||||||
|
|
||||||
public bool IsNetworkAvailable()
|
public bool IsNetworkAvailable()
|
||||||
{
|
{
|
||||||
|
//return false;
|
||||||
return Connectivity.Current.NetworkAccess == NetworkAccess.Internet;
|
return Connectivity.Current.NetworkAccess == NetworkAccess.Internet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,17 +5,6 @@ namespace salesbook.Maui.Core.Services;
|
|||||||
|
|
||||||
public class SyncDbService(IIntegryApiService integryApiService, LocalDbService localDb) : ISyncDbService
|
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)
|
public async Task GetAndSaveCommesse(string? dateFilter)
|
||||||
{
|
{
|
||||||
var allCommesse = await integryApiService.RetrieveAllCommesse(dateFilter);
|
var allCommesse = await integryApiService.RetrieveAllCommesse(dateFilter);
|
||||||
@@ -27,46 +16,6 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
|||||||
await localDb.InsertOrUpdate(allCommesse!);
|
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)
|
public async Task GetAndSaveSettings(string? dateFilter)
|
||||||
{
|
{
|
||||||
if (dateFilter is not null)
|
if (dateFilter is not null)
|
||||||
@@ -82,5 +31,11 @@ public class SyncDbService(IIntegryApiService integryApiService, LocalDbService
|
|||||||
|
|
||||||
if (!settingsResponse.StbUsers.IsNullOrEmpty())
|
if (!settingsResponse.StbUsers.IsNullOrEmpty())
|
||||||
await localDb.InsertAll(settingsResponse.StbUsers!);
|
await localDb.InsertAll(settingsResponse.StbUsers!);
|
||||||
|
|
||||||
|
if (!settingsResponse.VtbTipi.IsNullOrEmpty())
|
||||||
|
await localDb.InsertAll(settingsResponse.VtbTipi!);
|
||||||
|
|
||||||
|
if (!settingsResponse.Nazioni.IsNullOrEmpty())
|
||||||
|
await localDb.InsertAll(settingsResponse.Nazioni!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using AutoMapper;
|
||||||
using CommunityToolkit.Maui;
|
using CommunityToolkit.Maui;
|
||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using IntegryApiClient.MAUI;
|
using IntegryApiClient.MAUI;
|
||||||
@@ -7,11 +8,14 @@ using MudBlazor.Services;
|
|||||||
using MudExtensions.Services;
|
using MudExtensions.Services;
|
||||||
using salesbook.Maui.Core.Services;
|
using salesbook.Maui.Core.Services;
|
||||||
using salesbook.Shared;
|
using salesbook.Shared;
|
||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Dto.PageState;
|
||||||
using salesbook.Shared.Core.Helpers;
|
using salesbook.Shared.Core.Helpers;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
using salesbook.Shared.Core.Messages.Activity.Copy;
|
using salesbook.Shared.Core.Messages.Activity.Copy;
|
||||||
using salesbook.Shared.Core.Messages.Activity.New;
|
using salesbook.Shared.Core.Messages.Activity.New;
|
||||||
using salesbook.Shared.Core.Messages.Back;
|
using salesbook.Shared.Core.Messages.Back;
|
||||||
|
using salesbook.Shared.Core.Messages.Contact;
|
||||||
using salesbook.Shared.Core.Services;
|
using salesbook.Shared.Core.Services;
|
||||||
|
|
||||||
namespace salesbook.Maui
|
namespace salesbook.Maui
|
||||||
@@ -27,9 +31,17 @@ namespace salesbook.Maui
|
|||||||
var builder = MauiApp.CreateBuilder();
|
var builder = MauiApp.CreateBuilder();
|
||||||
builder
|
builder
|
||||||
.UseMauiApp<App>()
|
.UseMauiApp<App>()
|
||||||
|
.UseIntegry(appToken: AppToken, useLoginAzienda: true)
|
||||||
.UseMauiCommunityToolkit()
|
.UseMauiCommunityToolkit()
|
||||||
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); })
|
.UseSentry(options =>
|
||||||
.UseLoginAzienda(AppToken);
|
{
|
||||||
|
options.Dsn = "https://453b6b38f94fd67e40e0d5306d6caff8@o4508499810254848.ingest.de.sentry.io/4509605099667536";
|
||||||
|
#if DEBUG
|
||||||
|
options.Debug = true;
|
||||||
|
#endif
|
||||||
|
options.TracesSampleRate = 1.0;
|
||||||
|
})
|
||||||
|
.ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); });
|
||||||
|
|
||||||
builder.Services.AddMauiBlazorWebView();
|
builder.Services.AddMauiBlazorWebView();
|
||||||
builder.Services.AddMudServices();
|
builder.Services.AddMudServices();
|
||||||
@@ -42,16 +54,23 @@ namespace salesbook.Maui
|
|||||||
builder.Services.AddScoped<AuthenticationStateProvider>(provider =>
|
builder.Services.AddScoped<AuthenticationStateProvider>(provider =>
|
||||||
provider.GetRequiredService<AppAuthenticationStateProvider>());
|
provider.GetRequiredService<AppAuthenticationStateProvider>());
|
||||||
|
|
||||||
builder.Services.AddScoped<INetworkService, NetworkService>();
|
|
||||||
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
|
builder.Services.AddScoped<IIntegryApiService, IntegryApiService>();
|
||||||
builder.Services.AddScoped<ISyncDbService, SyncDbService>();
|
builder.Services.AddScoped<ISyncDbService, SyncDbService>();
|
||||||
builder.Services.AddScoped<IManageDataService, ManageDataService>();
|
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<FilterUserDTO>();
|
||||||
|
|
||||||
//Message
|
//Message
|
||||||
builder.Services.AddScoped<IMessenger, WeakReferenceMessenger>();
|
builder.Services.AddScoped<IMessenger, WeakReferenceMessenger>();
|
||||||
builder.Services.AddScoped<NewActivityService>();
|
builder.Services.AddScoped<NewActivityService>();
|
||||||
builder.Services.AddScoped<BackNavigationService>();
|
builder.Services.AddScoped<BackNavigationService>();
|
||||||
builder.Services.AddScoped<CopyActivityService>();
|
builder.Services.AddScoped<CopyActivityService>();
|
||||||
|
builder.Services.AddScoped<NewContactService>();
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
builder.Services.AddBlazorWebViewDeveloperTools();
|
builder.Services.AddBlazorWebViewDeveloperTools();
|
||||||
@@ -59,6 +78,8 @@ namespace salesbook.Maui
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||||
|
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
||||||
|
builder.Services.AddSingleton<INetworkService, NetworkService>();
|
||||||
builder.Services.AddSingleton<LocalDbService>();
|
builder.Services.AddSingleton<LocalDbService>();
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
|
|||||||
@@ -3,4 +3,7 @@
|
|||||||
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:usesCleartextTraffic="true" android:supportsRtl="true"></application>
|
<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.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -3,7 +3,7 @@ using Android.Runtime;
|
|||||||
|
|
||||||
namespace salesbook.Maui
|
namespace salesbook.Maui
|
||||||
{
|
{
|
||||||
[Application]
|
[Application(HardwareAccelerated = true)]
|
||||||
public class MainApplication : MauiApplication
|
public class MainApplication : MauiApplication
|
||||||
{
|
{
|
||||||
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
|
||||||
|
|||||||
@@ -35,5 +35,15 @@
|
|||||||
<key>NSAllowsArbitraryLoads</key>
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
|
|
||||||
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
|
<string>L'app utilizza la tua posizione per allegarla alle attività.</string>
|
||||||
|
|
||||||
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
|
<string>Consente di selezionare immagini da allegare alle attività.</string>
|
||||||
|
|
||||||
|
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||||
|
<string>Permette all'app di salvare file o immagini nella tua libreria fotografica se necessario.</string>
|
||||||
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
<ApplicationId>it.integry.salesbook</ApplicationId>
|
<ApplicationId>it.integry.salesbook</ApplicationId>
|
||||||
|
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<ApplicationDisplayVersion>1.0.0</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.1.0</ApplicationDisplayVersion>
|
||||||
<ApplicationVersion>3</ApplicationVersion>
|
<ApplicationVersion>5</ApplicationVersion>
|
||||||
|
|
||||||
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
|
||||||
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||||
@@ -55,8 +55,7 @@
|
|||||||
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup
|
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND '$(Configuration)' == 'Debug'">
|
||||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android' AND '$(Configuration)' == 'Debug'">
|
|
||||||
|
|
||||||
<!--these help speed up android builds-->
|
<!--these help speed up android builds-->
|
||||||
<!--
|
<!--
|
||||||
@@ -66,27 +65,25 @@
|
|||||||
-->
|
-->
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup
|
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(Configuration)' == 'Debug'">
|
||||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' AND '$(Configuration)' == 'Debug'">
|
|
||||||
<!--forces the simulator to pickup entitlements-->
|
<!--forces the simulator to pickup entitlements-->
|
||||||
<EnableCodeSigning>true</EnableCodeSigning>
|
<EnableCodeSigning>true</EnableCodeSigning>
|
||||||
<CodesignRequireProvisioningProfile>true</CodesignRequireProvisioningProfile>
|
<CodesignRequireProvisioningProfile>true</CodesignRequireProvisioningProfile>
|
||||||
<DisableCodesignVerification>true</DisableCodesignVerification>
|
<DisableCodesignVerification>true</DisableCodesignVerification>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup
|
<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
|
||||||
<SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>14.2</SupportedOSPlatformVersion>
|
||||||
<DefineConstants>$(DefineConstants);APPLE;PLATFORM</DefineConstants>
|
<DefineConstants>$(DefineConstants);APPLE;PLATFORM</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
|
<PropertyGroup Condition="'$(TargetFramework)'=='net9.0-ios'">
|
||||||
<CodesignKey>Apple Development: Created via API (5B7B69P4JY)</CodesignKey>
|
<CodesignKey>Apple Distribution: Integry S.r.l. (UNP26J4R89)</CodesignKey>
|
||||||
<CodesignProvision>VS: WildCard Development</CodesignProvision>
|
<CodesignProvision></CodesignProvision>
|
||||||
|
<ProvisioningType>manual</ProvisioningType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup
|
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
||||||
Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios' OR $([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">
|
|
||||||
<!--
|
<!--
|
||||||
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
<BundleResource Include="Platforms\iOS\PrivacyInfo.xcprivacy" LogicalName="PrivacyInfo.xcprivacy" />
|
||||||
|
|
||||||
@@ -98,7 +95,7 @@
|
|||||||
|
|
||||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
|
||||||
<!-- Android App Icon -->
|
<!-- Android App Icon -->
|
||||||
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65"/>
|
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" ForegroundScale="0.65" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
|
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
|
||||||
@@ -122,14 +119,15 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="CommunityToolkit.Maui" Version="11.2.0" />
|
<PackageReference Include="CommunityToolkit.Maui" Version="12.0.0" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="IntegryApiClient.MAUI" Version="1.1.4" />
|
<PackageReference Include="IntegryApiClient.MAUI" Version="1.1.6" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.5" />
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.6" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.70" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.81" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.70" />
|
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.81" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.70" />
|
<PackageReference Include="Microsoft.AspNetCore.Components.WebView.Maui" Version="9.0.81" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.5" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.6" />
|
||||||
|
<PackageReference Include="Sentry.Maui" Version="5.11.2" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
<div class="@(Back ? "" : "container") header">
|
<div class="@(Back ? "" : "container") header">
|
||||||
<div class="header-content @(Back ? "with-back" : "no-back")">
|
<div class="header-content @(Back ? "with-back" : "no-back")">
|
||||||
|
@if (!SmallHeader)
|
||||||
|
{
|
||||||
@if (Back)
|
@if (Back)
|
||||||
{
|
{
|
||||||
<div class="left-section">
|
<div class="left-section">
|
||||||
@@ -45,6 +47,16 @@
|
|||||||
</MudButton>
|
</MudButton>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="title">
|
||||||
|
<MudText Typo="Typo.h6">
|
||||||
|
<b>@Title</b>
|
||||||
|
</MudText>
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="() => GoBack()" />
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -66,6 +78,8 @@
|
|||||||
[Parameter] public bool ShowCalendarToggle { get; set; }
|
[Parameter] public bool ShowCalendarToggle { get; set; }
|
||||||
[Parameter] public EventCallback OnCalendarToggle { get; set; }
|
[Parameter] public EventCallback OnCalendarToggle { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public bool SmallHeader { get; set; }
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
Back = !Back ? !Back && Cancel : Back;
|
Back = !Back ? !Back && Cancel : Back;
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
|
.header {
|
||||||
|
min-height: var(--mh-header);
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.header-content {
|
.header-content {
|
||||||
|
width: 100%;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
@using System.Globalization
|
@using System.Globalization
|
||||||
@using CommunityToolkit.Mvvm.Messaging
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Messages.Back
|
@using salesbook.Shared.Core.Messages.Back
|
||||||
@inherits LayoutComponentBase
|
@inherits LayoutComponentBase
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
@inject IMessenger Messenger
|
|
||||||
@inject BackNavigationService BackService
|
@inject BackNavigationService BackService
|
||||||
|
@inject INetworkService NetworkService
|
||||||
|
@inject IIntegryApiService IntegryApiService
|
||||||
|
|
||||||
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
|
<MudThemeProvider Theme="_currentTheme" @ref="@_mudThemeProvider" @bind-IsDarkMode="@IsDarkMode" />
|
||||||
<MudPopoverProvider/>
|
<MudPopoverProvider/>
|
||||||
@@ -14,12 +15,32 @@
|
|||||||
<div class="page">
|
<div class="page">
|
||||||
<NavMenu/>
|
<NavMenu/>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<article>
|
<article>
|
||||||
@Body
|
@Body
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
@@ -27,6 +48,50 @@
|
|||||||
private bool IsDarkMode { get; set; }
|
private bool IsDarkMode { get; set; }
|
||||||
private string _mainContentClass = "";
|
private string _mainContentClass = "";
|
||||||
|
|
||||||
|
//Connection state
|
||||||
|
private bool FirstCheck { get; set; } = true;
|
||||||
|
private bool _isNetworkAvailable;
|
||||||
|
private bool _servicesIsDown;
|
||||||
|
private bool _showWarning;
|
||||||
|
|
||||||
|
private DateTime _lastApiCheck = DateTime.MinValue;
|
||||||
|
private int _delaySeconds = 3;
|
||||||
|
|
||||||
|
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()
|
private readonly MudTheme _currentTheme = new()
|
||||||
{
|
{
|
||||||
PaletteLight = new PaletteLight()
|
PaletteLight = new PaletteLight()
|
||||||
@@ -81,6 +146,9 @@
|
|||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
|
_cts = new CancellationTokenSource();
|
||||||
|
_ = CheckConnectionState(_cts.Token);
|
||||||
|
|
||||||
BackService.OnHardwareBack += async () => { await JS.InvokeVoidAsync("goBack"); };
|
BackService.OnHardwareBack += async () => { await JS.InvokeVoidAsync("goBack"); };
|
||||||
|
|
||||||
var culture = new CultureInfo("it-IT", false);
|
var culture = new CultureInfo("it-IT", false);
|
||||||
@@ -89,4 +157,40 @@
|
|||||||
CultureInfo.CurrentUICulture = culture;
|
CultureInfo.CurrentUICulture = culture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Task CheckConnectionState(CancellationToken token)
|
||||||
|
{
|
||||||
|
return Task.Run(async () =>
|
||||||
|
{
|
||||||
|
while (!token.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
var isNetworkAvailable = NetworkService.IsNetworkAvailable();
|
||||||
|
var servicesDown = ServicesIsDown;
|
||||||
|
|
||||||
|
if (isNetworkAvailable && (DateTime.UtcNow - _lastApiCheck).TotalSeconds >= _delaySeconds)
|
||||||
|
{
|
||||||
|
servicesDown = !await IntegryApiService.SystemOk();
|
||||||
|
_lastApiCheck = DateTime.UtcNow;
|
||||||
|
}
|
||||||
|
|
||||||
|
await InvokeAsync(async () =>
|
||||||
|
{
|
||||||
|
IsNetworkAvailable = isNetworkAvailable;
|
||||||
|
ServicesIsDown = servicesDown;
|
||||||
|
|
||||||
|
await Task.Delay(1500, token);
|
||||||
|
ShowWarning = !(IsNetworkAvailable && !ServicesIsDown);
|
||||||
|
NetworkService.ConnectionAvailable = !ShowWarning;
|
||||||
|
});
|
||||||
|
|
||||||
|
await Task.Delay(500, token);
|
||||||
|
}
|
||||||
|
}, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_cts?.Cancel();
|
||||||
|
_cts?.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
@using CommunityToolkit.Mvvm.Messaging
|
@using CommunityToolkit.Mvvm.Messaging
|
||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Messages.Activity.Copy
|
@using salesbook.Shared.Core.Messages.Activity.Copy
|
||||||
@using salesbook.Shared.Core.Messages.Activity.New
|
@using salesbook.Shared.Core.Messages.Activity.New
|
||||||
|
@using salesbook.Shared.Core.Messages.Contact
|
||||||
@inject IDialogService Dialog
|
@inject IDialogService Dialog
|
||||||
@inject IMessenger Messenger
|
@inject IMessenger Messenger
|
||||||
@inject CopyActivityService CopyActivityService
|
@inject CopyActivityService CopyActivityService
|
||||||
|
|
||||||
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
<div class="container animated-navbar @(IsVisible ? "show-nav" : "hide-nav") @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||||
<nav class="navbar @(IsVisible? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
<nav class="navbar @(IsVisible ? PlusVisible ? "with-plus" : "without-plus" : "with-plus")">
|
||||||
<div class="container-navbar">
|
<div class="container-navbar">
|
||||||
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
<ul class="navbar-nav flex-row nav-justified align-items-center w-100 text-center">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -42,10 +44,10 @@
|
|||||||
{
|
{
|
||||||
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
<MudMenu PopoverClass="custom_popover" AnchorOrigin="Origin.TopLeft" TransformOrigin="Origin.BottomRight">
|
||||||
<ActivatorContent>
|
<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>
|
</ActivatorContent>
|
||||||
<ChildContent>
|
<ChildContent>
|
||||||
<MudMenuItem Disabled="true">Nuovo contatto</MudMenuItem>
|
<MudMenuItem OnClick="() => CreateUser()">Nuovo contatto</MudMenuItem>
|
||||||
<MudMenuItem OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
|
<MudMenuItem OnClick="() => CreateActivity()">Nuova attivit<69></MudMenuItem>
|
||||||
</ChildContent>
|
</ChildContent>
|
||||||
</MudMenu>
|
</MudMenu>
|
||||||
@@ -66,10 +68,10 @@
|
|||||||
{
|
{
|
||||||
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
var location = args.Location.Remove(0, NavigationManager.BaseUri.Length);
|
||||||
|
|
||||||
var newIsVisible = new List<string> { "Calendar", "Users", "Notifications" }
|
var newIsVisible = new List<string> { "Calendar", "Users", "Notifications", "Commessa" }
|
||||||
.Contains(location);
|
.Contains(location);
|
||||||
|
|
||||||
var newPlusVisible = new List<string> { "Calendar", "Users" }
|
var newPlusVisible = new List<string> { "Calendar", "Users", "Commessa" }
|
||||||
.Contains(location);
|
.Contains(location);
|
||||||
|
|
||||||
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
|
if (IsVisible == newIsVisible && PlusVisible == newPlusVisible) return;
|
||||||
@@ -92,5 +94,14 @@
|
|||||||
Messenger.Send(new NewActivityMessage(((StbActivity)result.Data).ActivityId));
|
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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
@page "/Calendar"
|
@page "/Calendar"
|
||||||
@using salesbook.Shared.Core.Dto
|
|
||||||
@using salesbook.Shared.Core.Interface
|
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Components.SingleElements
|
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Components.SingleElements
|
||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Messages.Activity.New
|
@using salesbook.Shared.Core.Messages.Activity.New
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
@@ -372,7 +371,9 @@
|
|||||||
filteredActivity = filteredActivity
|
filteredActivity = filteredActivity
|
||||||
.Where(x => Filter.Category == null || x.Category.Equals(Filter.Category));
|
.Where(x => Filter.Category == null || x.Category.Equals(Filter.Category));
|
||||||
|
|
||||||
return filteredActivity.ToList();
|
return filteredActivity
|
||||||
|
.OrderBy(x => x.EffectiveTime ?? x.EstimatedTime)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JSInvokable]
|
[JSInvokable]
|
||||||
@@ -470,9 +471,7 @@
|
|||||||
|
|
||||||
var start = CurrentMonth;
|
var start = CurrentMonth;
|
||||||
var end = start.AddDays(DaysInMonth - 1);
|
var end = start.AddDays(DaysInMonth - 1);
|
||||||
var activities = await ManageData.GetActivity(x =>
|
var activities = await ManageData.GetActivity(new WhereCondActivity{Start = start, End = end});
|
||||||
(x.EffectiveDate == null && x.EstimatedDate >= start && x.EstimatedDate <= end) ||
|
|
||||||
(x.EffectiveDate >= start && x.EffectiveDate <= end));
|
|
||||||
MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList();
|
MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList();
|
||||||
|
|
||||||
PrepareRenderingData();
|
PrepareRenderingData();
|
||||||
@@ -540,7 +539,7 @@
|
|||||||
|
|
||||||
await ManageData.DeleteActivity(activity);
|
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)
|
if (indexActivity != null)
|
||||||
{
|
{
|
||||||
@@ -557,7 +556,7 @@
|
|||||||
{
|
{
|
||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
|
|
||||||
var activity = (await ManageData.GetActivity(x => x.ActivityId.Equals(activityId))).LastOrDefault();
|
var activity = (await ManageData.GetActivity(new WhereCondActivity {ActivityId = activityId}, true)).LastOrDefault();
|
||||||
|
|
||||||
if (activity == null)
|
if (activity == null)
|
||||||
{
|
{
|
||||||
@@ -582,7 +581,7 @@
|
|||||||
|
|
||||||
private async Task OnActivityChanged(string activityId)
|
private async Task OnActivityChanged(string activityId)
|
||||||
{
|
{
|
||||||
var newActivity = await ManageData.GetActivity(x => x.ActivityId.Equals(activityId));
|
var newActivity = await ManageData.GetActivity(new WhereCondActivity { ActivityId = activityId }, true);
|
||||||
var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId.Equals(activityId));
|
var indexActivity = MonthActivities?.FindIndex(x => x.ActivityId.Equals(activityId));
|
||||||
|
|
||||||
if (indexActivity != null && !newActivity.IsNullOrEmpty())
|
if (indexActivity != null && !newActivity.IsNullOrEmpty())
|
||||||
|
|||||||
@@ -122,7 +122,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
padding-bottom: 70px;
|
padding-bottom: 16vh;
|
||||||
height: calc(100% - 130px);
|
height: calc(100% - 130px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
173
salesbook.Shared/Components/Pages/Commessa.razor
Normal file
173
salesbook.Shared/Components/Pages/Commessa.razor
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
@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
|
||||||
|
@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">
|
||||||
|
@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 = Mapper.Map<List<ActivityDTO>>(activities)
|
||||||
|
.OrderBy(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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
230
salesbook.Shared/Components/Pages/Commessa.razor.css
Normal file
230
salesbook.Shared/Components/Pages/Commessa.razor.css
Normal file
@@ -0,0 +1,230 @@
|
|||||||
|
/* 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;
|
||||||
|
box-shadow: var(--custom-box-shadow);
|
||||||
|
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;
|
||||||
|
background: var(--mud-palette-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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,22 +1,35 @@
|
|||||||
@page "/"
|
@page "/"
|
||||||
@using salesbook.Shared.Core.Interface
|
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Core.Services
|
||||||
@inject IFormFactor FormFactor
|
@inject IFormFactor FormFactor
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
|
@inject PreloadService PreloadService
|
||||||
|
|
||||||
|
<SpinnerLayout FullScreen="true" />
|
||||||
|
|
||||||
@code
|
@code
|
||||||
{
|
{
|
||||||
protected override Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");
|
||||||
|
|
||||||
if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
|
if (!FormFactor.IsWeb() && NetworkService.ConnectionAvailable && lastSyncDate.Equals(DateTime.MinValue))
|
||||||
{
|
{
|
||||||
NavigationManager.NavigateTo("/sync");
|
NavigationManager.NavigateTo("/sync");
|
||||||
return base.OnInitializedAsync();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ = StartSyncUser();
|
||||||
NavigationManager.NavigateTo("/Calendar");
|
NavigationManager.NavigateTo("/Calendar");
|
||||||
return base.OnInitializedAsync();
|
}
|
||||||
|
|
||||||
|
private Task StartSyncUser()
|
||||||
|
{
|
||||||
|
return Task.Run(() =>
|
||||||
|
{
|
||||||
|
_ = PreloadService.PreloadUsersAsync();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
@page "/login"
|
@page "/login"
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Services
|
@using salesbook.Shared.Core.Services
|
||||||
@inject IUserAccountService UserAccountService
|
@inject IUserAccountService UserAccountService
|
||||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
||||||
|
@inject INetworkService NetworkService
|
||||||
|
|
||||||
@if (Spinner)
|
@if (Spinner)
|
||||||
{
|
{
|
||||||
@@ -26,7 +28,7 @@ else
|
|||||||
<MudTextField @bind-Value="UserData.CodHash" Label="Profilo azienda" Variant="Variant.Outlined"/>
|
<MudTextField @bind-Value="UserData.CodHash" Label="Profilo azienda" Variant="Variant.Outlined"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MudButton OnClick="SignInUser" Color="Color.Primary" Variant="Variant.Filled">Login</MudButton>
|
<MudButton Disabled="@(!NetworkService.ConnectionAvailable)" OnClick="SignInUser" Color="Color.Primary" Variant="Variant.Filled">Login</MudButton>
|
||||||
@if (_attemptFailed)
|
@if (_attemptFailed)
|
||||||
{
|
{
|
||||||
<MudAlert Class="my-3" Dense="true" Severity="Severity.Error" Variant="Variant.Filled">@ErrorMessage</MudAlert>
|
<MudAlert Class="my-3" Dense="true" Severity="Severity.Error" Variant="Variant.Filled">@ErrorMessage</MudAlert>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<span class="info-title">Status</span>
|
<span class="info-title">Status</span>
|
||||||
@if (NetworkService.IsNetworkAvailable())
|
@if (NetworkService.ConnectionAvailable)
|
||||||
{
|
{
|
||||||
<div class="status online">
|
<div class="status online">
|
||||||
<i class="ri-wifi-line"></i>
|
<i class="ri-wifi-line"></i>
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
Unavailable = FormFactor.IsWeb() || !NetworkService.IsNetworkAvailable();
|
Unavailable = FormFactor.IsWeb() || !NetworkService.ConnectionAvailable;
|
||||||
LastSync = LocalStorage.Get<DateTime>("last-sync");
|
LastSync = LocalStorage.Get<DateTime>("last-sync");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,6 @@
|
|||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
Elements["Attività"] = false;
|
|
||||||
Elements["Commesse"] = false;
|
|
||||||
Elements["Clienti"] = false;
|
|
||||||
Elements["Prospect"] = false;
|
|
||||||
Elements["Impostazioni"] = false;
|
Elements["Impostazioni"] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,9 +32,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
await Task.WhenAll(
|
await Task.WhenAll(
|
||||||
RunAndTrack(SetActivity),
|
|
||||||
RunAndTrack(SetClienti),
|
|
||||||
RunAndTrack(SetProspect),
|
|
||||||
RunAndTrack(SetCommesse),
|
RunAndTrack(SetCommesse),
|
||||||
RunAndTrack(SetSettings)
|
RunAndTrack(SetSettings)
|
||||||
);
|
);
|
||||||
@@ -62,30 +55,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
private async Task SetCommesse()
|
||||||
{
|
{
|
||||||
await Task.Run(async () => { await syncDb.GetAndSaveCommesse(DateFilter); });
|
await Task.Run(async () => { await syncDb.GetAndSaveCommesse(DateFilter); });
|
||||||
|
|||||||
@@ -1,20 +1,37 @@
|
|||||||
@page "/User/{CodAnag}"
|
@page "/User/{CodContact}/{IsContact:bool}"
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
|
@using AutoMapper
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@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
|
||||||
|
@implements IAsyncDisposable
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
|
@inject IMapper Mapper
|
||||||
|
@inject IDialogService Dialog
|
||||||
|
@inject IIntegryApiService IntegryApiService
|
||||||
|
@inject UserPageState UserState
|
||||||
|
|
||||||
<HeaderLayout BackTo="Indietro" Back="true" BackOnTop="true" Title="" ShowProfile="false"/>
|
<HeaderLayout BackTo="Indietro"
|
||||||
|
LabelSave="Modifica"
|
||||||
|
OnSave="() => OpenUserForm(Anag)"
|
||||||
|
Back="true"
|
||||||
|
BackOnTop="true"
|
||||||
|
Title=""
|
||||||
|
ShowProfile="false" />
|
||||||
|
|
||||||
@if (IsLoading)
|
@if (IsLoading)
|
||||||
{
|
{
|
||||||
<SpinnerLayout FullScreen="true"/>
|
<SpinnerLayout FullScreen="true" />
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<div class="container content">
|
<div class="container content" style="overflow: auto;" id="topPage">
|
||||||
<div class="container-primary-info">
|
<div class="container-primary-info">
|
||||||
<div class="section-primary-info">
|
<div class="section-primary-info">
|
||||||
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
<MudAvatar Style="height: 70px; width: 70px; font-size: 2rem; font-weight: bold" Color="Color.Secondary">
|
||||||
@@ -23,9 +40,12 @@ else
|
|||||||
|
|
||||||
<div class="personal-info">
|
<div class="personal-info">
|
||||||
<span class="info-nome">@Anag.RagSoc</span>
|
<span class="info-nome">@Anag.RagSoc</span>
|
||||||
@if (UserSession.User.KeyGroup is not null)
|
@if (!string.IsNullOrEmpty(Anag.Indirizzo))
|
||||||
{
|
{
|
||||||
<span class="info-section">@Anag.Indirizzo</span>
|
<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>
|
<span class="info-section">@($"{Anag.Cap} - {Anag.Citta} ({Anag.Prov})")</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -35,53 +55,75 @@ else
|
|||||||
|
|
||||||
<div class="section-info">
|
<div class="section-info">
|
||||||
<div class="section-personal-info">
|
<div class="section-personal-info">
|
||||||
|
@if (!string.IsNullOrEmpty(Anag.Telefono))
|
||||||
|
{
|
||||||
<div>
|
<div>
|
||||||
<span class="info-title">Telefono</span>
|
<span class="info-title">Telefono</span>
|
||||||
<span class="info-text">
|
<span class="info-text">@Anag.Telefono</span>
|
||||||
@if (string.IsNullOrEmpty(Anag.Telefono))
|
|
||||||
{
|
|
||||||
@("Nessuna mail configurata")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@Anag.Telefono
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (!string.IsNullOrEmpty(Anag.PartIva))
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<span class="info-title">P. IVA</span>
|
||||||
|
<span class="info-text">@Anag.PartIva</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section-personal-info">
|
<div class="section-personal-info">
|
||||||
|
@if (!string.IsNullOrEmpty(Anag.EMail))
|
||||||
|
{
|
||||||
<div>
|
<div>
|
||||||
<span class="info-title">E-mail</span>
|
<span class="info-title">E-mail</span>
|
||||||
<span class="info-text">
|
<span class="info-text">@Anag.EMail</span>
|
||||||
@if (string.IsNullOrEmpty(Anag.EMail))
|
|
||||||
{
|
|
||||||
@("Nessuna mail configurata")
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
@Anag.EMail
|
|
||||||
}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (Agente != null)
|
||||||
|
{
|
||||||
|
<div>
|
||||||
|
<span class="info-title">Agente</span>
|
||||||
|
<span class="info-text">@Agente.FullName</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (PersRif is { Count: > 0 })
|
<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">
|
<div class="container-pers-rif">
|
||||||
<Virtualize Items="PersRif" Context="person">
|
@foreach (var person in PersRif)
|
||||||
@{
|
{
|
||||||
var index = PersRif.IndexOf(person);
|
|
||||||
var isLast = index == PersRif.Count - 1;
|
|
||||||
}
|
|
||||||
<ContactCard Contact="person" />
|
<ContactCard Contact="person" />
|
||||||
@if (!isLast)
|
@if (person != PersRif.Last())
|
||||||
{
|
{
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
}
|
}
|
||||||
</Virtualize>
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,33 +131,649 @@ else
|
|||||||
<MudButton Class="button-settings infoText"
|
<MudButton Class="button-settings infoText"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
Size="Size.Medium"
|
Size="Size.Medium"
|
||||||
|
OnClick="OpenPersRifForm"
|
||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Aggiungi contatto
|
Aggiungi contatto
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
</div>
|
||||||
</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">
|
||||||
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Cerca..."
|
||||||
|
Variant="Variant.Text"
|
||||||
|
@bind-Value="SearchTermCommesse"
|
||||||
|
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">
|
||||||
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Cerca..."
|
||||||
|
Variant="Variant.Text"
|
||||||
|
@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>
|
||||||
|
</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>
|
||||||
}
|
}
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public string CodAnag { get; set; }
|
[Parameter] public string CodContact { get; set; } = string.Empty;
|
||||||
|
[Parameter] public bool IsContact { get; set; }
|
||||||
|
|
||||||
private AnagClie Anag { get; set; } = new();
|
// Dati principali
|
||||||
private List<VtbCliePersRif>? PersRif { get; set; }
|
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();
|
||||||
|
|
||||||
|
// Stati di caricamento
|
||||||
private bool IsLoading { get; set; } = true;
|
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;
|
||||||
|
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()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await LoadData();
|
try
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadData()
|
|
||||||
{
|
{
|
||||||
Anag = (await ManageData.GetTable<AnagClie>(x => x.CodAnag.Equals(CodAnag))).Last();
|
_loadingCts = new CancellationTokenSource();
|
||||||
PersRif = await ManageData.GetTable<VtbCliePersRif>(x => x.CodAnag.Equals(Anag.CodAnag));
|
|
||||||
|
|
||||||
|
if (UserState.CodUser?.Equals(CodContact) == true)
|
||||||
|
{
|
||||||
|
LoadDataFromSession();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await LoadDataAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Errore in OnInitializedAsync: {ex.Message}");
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async ValueTask DisposeAsync()
|
||||||
|
{
|
||||||
|
_loadingCts?.CancelAsync();
|
||||||
|
_loadingCts?.Dispose();
|
||||||
|
_stepsCts?.CancelAsync();
|
||||||
|
_stepsCts?.Dispose();
|
||||||
|
_searchTimerCommesse?.DisposeAsync();
|
||||||
|
_searchTimerActivity?.DisposeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 = Mapper.Map<List<ActivityDTO>>(activities)
|
||||||
|
.OrderByDescending(x =>
|
||||||
|
(x.EffectiveTime ?? x.EstimatedTime) ?? x.DataInsAct
|
||||||
|
).ToList();
|
||||||
|
});
|
||||||
|
|
||||||
|
UserState.Activitys = ActivityList;
|
||||||
|
|
||||||
|
ApplyFiltersActivity();
|
||||||
|
|
||||||
|
ActivityIsLoading = 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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
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 })
|
||||||
|
{
|
||||||
|
await LoadAnagAsync();
|
||||||
|
SaveDataToSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -87,6 +87,7 @@
|
|||||||
box-shadow: var(--custom-box-shadow);
|
box-shadow: var(--custom-box-shadow);
|
||||||
padding: .25rem 0;
|
padding: .25rem 0;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container-button .divider {
|
.container-button .divider {
|
||||||
@@ -139,9 +140,154 @@
|
|||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
box-shadow: var(--custom-box-shadow);
|
box-shadow: var(--custom-box-shadow);
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
|
max-height: 32vh;
|
||||||
|
overflow: auto;
|
||||||
|
scrollbar-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.container-pers-rif::-webkit-scrollbar { display: none; }
|
||||||
|
|
||||||
.container-pers-rif .divider {
|
.container-pers-rif .divider {
|
||||||
margin: 0 0 0 3.5rem;
|
margin: 0 0 0 3.5rem;
|
||||||
width: unset;
|
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;
|
||||||
|
box-shadow: var(--custom-box-shadow);
|
||||||
|
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;
|
||||||
|
background: var(--mud-palette-surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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,27 +1,50 @@
|
|||||||
@page "/Users"
|
@page "/Users"
|
||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Interface
|
@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
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
|
@inject NewContactService NewContact
|
||||||
|
@inject FilterUserDTO Filter
|
||||||
|
@inject UserListState UserState
|
||||||
|
@implements IDisposable
|
||||||
|
|
||||||
<HeaderLayout Title="Contatti"/>
|
<HeaderLayout Title="Contatti"/>
|
||||||
|
|
||||||
<div class="container search-box">
|
<div class="container search-box">
|
||||||
<div class="input-card clearButton">
|
<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())
|
@if (!TextToFilter.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => FilterUsers(true)"/>
|
<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>
|
</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>
|
||||||
|
|
||||||
<div class="container users">
|
<div class="container users">
|
||||||
@if (GroupedUserList?.Count > 0)
|
@if (IsLoading)
|
||||||
{
|
{
|
||||||
<Virtualize Items="FilteredGroupedUserList" Context="item">
|
<SpinnerLayout FullScreen="false"/>
|
||||||
|
}
|
||||||
|
else if (GroupedUserList?.Count > 0)
|
||||||
|
{
|
||||||
|
<Virtualize OverscanCount="20" Items="FilteredGroupedUserList" Context="item">
|
||||||
@if (item.ShowHeader)
|
@if (item.ShowHeader)
|
||||||
{
|
{
|
||||||
<div class="letter-header">@item.HeaderLetter</div>
|
<div class="letter-header">@item.HeaderLetter</div>
|
||||||
@@ -29,64 +52,75 @@
|
|||||||
<UserCard User="item.User"/>
|
<UserCard User="item.User"/>
|
||||||
</Virtualize>
|
</Virtualize>
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<NoDataAvailable Text="Nessun contatto trovato"/>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<FilterUsers @bind-IsSheetVisible="OpenFilter" @bind-Filter="Filter" @bind-Filter:after="FilterUsers"/>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
|
private List<UserDisplayItem> GroupedUserList { get; set; } = [];
|
||||||
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
private List<UserDisplayItem> FilteredGroupedUserList { get; set; } = [];
|
||||||
private string? TextToFilter { get; set; }
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
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()
|
||||||
{
|
{
|
||||||
if (firstRender)
|
IsLoading = true;
|
||||||
|
|
||||||
|
if (!UserState.IsLoaded)
|
||||||
|
{
|
||||||
|
UserState.OnUsersLoaded += OnUsersLoaded;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await LoadData();
|
await LoadData();
|
||||||
StateHasChanged();
|
LoadFromSession();
|
||||||
|
FilterUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
var users = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
if (!Filter.IsInitialized)
|
||||||
|
|
||||||
var sortedUsers = users
|
|
||||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
|
||||||
.OrderBy(u =>
|
|
||||||
{
|
{
|
||||||
var firstChar = char.ToUpper(u.RagSoc[0]);
|
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||||
return char.IsLetter(firstChar) ? firstChar.ToString() : "ZZZ";
|
|
||||||
})
|
|
||||||
.ThenBy(u => u.RagSoc)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
GroupedUserList = [];
|
if (loggedUser.UserCode != null)
|
||||||
|
Filter.Agenti = [loggedUser.UserCode];
|
||||||
|
|
||||||
string? lastHeader = null;
|
Filter.IsInitialized = true;
|
||||||
|
|
||||||
foreach (var user in sortedUsers)
|
|
||||||
{
|
|
||||||
var firstChar = char.ToUpper(user.RagSoc[0]);
|
|
||||||
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
|
|
||||||
|
|
||||||
var showHeader = currentLetter != lastHeader;
|
|
||||||
lastHeader = currentLetter;
|
|
||||||
|
|
||||||
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);
|
private void FilterUsers() => FilterUsers(false);
|
||||||
@@ -96,29 +130,157 @@
|
|||||||
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
|
if (clearFilter || string.IsNullOrWhiteSpace(TextToFilter))
|
||||||
{
|
{
|
||||||
TextToFilter = null;
|
TextToFilter = null;
|
||||||
FilteredGroupedUserList = GroupedUserList;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var filter = TextToFilter.Trim();
|
|
||||||
var result = new List<UserDisplayItem>();
|
var result = new List<UserDisplayItem>();
|
||||||
|
|
||||||
foreach (var item in GroupedUserList)
|
foreach (var item in GroupedUserList)
|
||||||
{
|
{
|
||||||
var user = item.User;
|
var user = item.User;
|
||||||
if (
|
|
||||||
|
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.RagSoc) && user.RagSoc.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.Indirizzo) && user.Indirizzo.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.Telefono) && user.Telefono.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
(!string.IsNullOrEmpty(user.EMail) && user.EMail.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
|
||||||
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase))
|
(!string.IsNullOrEmpty(user.PartIva) && user.PartIva.Contains(filter, StringComparison.OrdinalIgnoreCase));
|
||||||
)
|
|
||||||
|
if (matchesText)
|
||||||
|
{
|
||||||
|
result.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
result.Add(item);
|
result.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FilteredGroupedUserList = result;
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,6 @@
|
|||||||
padding-bottom: .5rem;
|
padding-bottom: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-box .input-card {
|
.search-box .input-card { margin: 0 !important; }
|
||||||
margin: 0 !important;
|
|
||||||
}
|
.search-box .input-card ::deep .rounded-button { border-radius: 50%; }
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements.Modal.ExceptionModal
|
||||||
@inject NavigationManager NavigationManager
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
<ErrorBoundary @ref="ErrorBoundary">
|
<ErrorBoundary @ref="ErrorBoundary">
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
<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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Helpers.Enum
|
@using salesbook.Shared.Core.Helpers.Enum
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Helpers.Enum
|
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@inject IManageDataService manageData
|
@inject IManageDataService manageData
|
||||||
|
|
||||||
@@ -15,89 +14,81 @@
|
|||||||
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
<MudIconButton Icon="@Icons.Material.Filled.Close" OnClick="CloseBottomSheet"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-card clearButton">
|
<div class="input-card">
|
||||||
<MudTextField T="string?" Placeholder="Cerca..." Variant="Variant.Text" @bind-Value="Filter.Text" DebounceInterval="500"/>
|
<div class="form-container">
|
||||||
|
<span class="disable-full-width">Con agente</span>
|
||||||
|
|
||||||
<MudIconButton Class="closeIcon" Icon="@Icons.Material.Filled.Close" OnClick="() => Filter.Text = null"/>
|
<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>
|
||||||
|
|
||||||
|
<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)
|
||||||
|
{
|
||||||
|
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
|
||||||
|
}
|
||||||
|
</MudSelectExtended>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="input-card">
|
<div class="input-card">
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Assegnata a</span>
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Indirizzo"
|
||||||
<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"
|
Variant="Variant.Text"
|
||||||
Virtualize="true"
|
@bind-Value="Filter.Indirizzo"
|
||||||
@bind-SelectedValues="Filter.User"
|
DebounceInterval="500"/>
|
||||||
Class="customIcon-select"
|
|
||||||
AdornmentIcon="@Icons.Material.Filled.Code"/>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Tipo</span>
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Città"
|
||||||
<MudSelectExtended FullWidth="true"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
@bind-Value="Filter.Type"
|
@bind-Value="Filter.Citta"
|
||||||
Class="customIcon-select"
|
DebounceInterval="500"/>
|
||||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
|
||||||
@foreach (var type in ActivityType)
|
|
||||||
{
|
|
||||||
<MudSelectItemExtended Class="custom-item-select" Value="@type.ActivityTypeId">@type.ActivityTypeId</MudSelectItemExtended>
|
|
||||||
}
|
|
||||||
</MudSelectExtended>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Esito</span>
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Provincia"
|
||||||
<MudSelectExtended FullWidth="true"
|
|
||||||
T="string?"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
@bind-Value="Filter.Result"
|
@bind-Value="Filter.Prov"
|
||||||
Class="customIcon-select"
|
DebounceInterval="500"/>
|
||||||
AdornmentIcon="@Icons.Material.Filled.Code">
|
|
||||||
@foreach (var result in ActivityResult)
|
|
||||||
{
|
|
||||||
<MudSelectItemExtended Class="custom-item-select" Value="@result.ActivityResultId">@result.ActivityResultId</MudSelectItemExtended>
|
|
||||||
}
|
|
||||||
</MudSelectExtended>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
|
|
||||||
<div class="form-container">
|
<div class="form-container">
|
||||||
<span class="disable-full-width">Categoria</span>
|
<MudTextField T="string?"
|
||||||
|
Placeholder="Nazione"
|
||||||
<MudSelectExtended FullWidth="true"
|
|
||||||
T="ActivityCategoryEnum?"
|
|
||||||
Variant="Variant.Text"
|
Variant="Variant.Text"
|
||||||
@bind-Value="Filter.Category"
|
@bind-Value="Filter.Nazione"
|
||||||
Class="customIcon-select"
|
DebounceInterval="500"/>
|
||||||
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>
|
</div>
|
||||||
|
|
||||||
<div class="button-section">
|
<div class="button-section">
|
||||||
<MudButton OnClick="() => Filter = new FilterActivityDTO()" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
<MudButton OnClick="ClearFilters" Variant="Variant.Outlined" Color="Color.Error">Pulisci</MudButton>
|
||||||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="OnFilterButton">Filtra</MudButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -107,13 +98,10 @@
|
|||||||
[Parameter] public bool IsSheetVisible { get; set; }
|
[Parameter] public bool IsSheetVisible { get; set; }
|
||||||
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
[Parameter] public EventCallback<bool> IsSheetVisibleChanged { get; set; }
|
||||||
|
|
||||||
[Parameter] public FilterActivityDTO Filter { get; set; }
|
[Parameter] public FilterUserDTO Filter { get; set; }
|
||||||
[Parameter] public EventCallback<FilterActivityDTO> FilterChanged { get; set; }
|
[Parameter] public EventCallback<FilterUserDTO> FilterChanged { get; set; }
|
||||||
|
|
||||||
private List<StbActivityResult> ActivityResult { get; set; } = [];
|
|
||||||
private List<StbActivityType> ActivityType { get; set; } = [];
|
|
||||||
private List<StbUser> Users { get; set; } = [];
|
private List<StbUser> Users { get; set; } = [];
|
||||||
private List<ActivityCategoryEnum> CategoryList { get; set; } = [];
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync()
|
protected override async Task OnParametersSetAsync()
|
||||||
{
|
{
|
||||||
@@ -121,19 +109,14 @@
|
|||||||
await LoadData();
|
await LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetMultiSelectionUser(List<string> selectedValues)
|
|
||||||
{
|
|
||||||
return $"{selectedValues.Count} Utent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
Users = await manageData.GetTable<StbUser>();
|
Users = await manageData.GetTable<StbUser>(x => x.KeyGroup == 5);
|
||||||
ActivityResult = await manageData.GetTable<StbActivityResult>();
|
}
|
||||||
ActivityType = await manageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
|
||||||
CategoryList = ActivityCategoryHelper.AllActivityCategory;
|
|
||||||
|
|
||||||
StateHasChanged();
|
private string GetMultiSelectionAgente(List<string> selectedValues)
|
||||||
|
{
|
||||||
|
return $"{selectedValues.Count} Agent{(selectedValues.Count != 1 ? "i selezionati" : "e selezionato")}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseBottomSheet()
|
private void CloseBottomSheet()
|
||||||
@@ -148,4 +131,27 @@
|
|||||||
CloseBottomSheet();
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
|
@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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Core.Dto.Activity
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Helpers.Enum
|
@using salesbook.Shared.Core.Helpers.Enum
|
||||||
@inject IDialogService Dialog
|
@inject IDialogService Dialog
|
||||||
@@ -27,13 +28,27 @@
|
|||||||
<div class="activity-hours-section">
|
<div class="activity-hours-section">
|
||||||
<span class="activity-hours">
|
<span class="activity-hours">
|
||||||
@if (Activity.EffectiveTime is null)
|
@if (Activity.EffectiveTime is null)
|
||||||
|
{
|
||||||
|
if (ShowDate)
|
||||||
|
{
|
||||||
|
@($"{Activity.EstimatedTime:g}")
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
@($"{Activity.EstimatedTime:t}")
|
@($"{Activity.EstimatedTime:t}")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ShowDate)
|
||||||
|
{
|
||||||
|
@($"{Activity.EffectiveTime:g}")
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@($"{Activity.EffectiveTime:t}")
|
@($"{Activity.EffectiveTime:t}")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,6 +82,8 @@
|
|||||||
[Parameter] public EventCallback<string> ActivityChanged { get; set; }
|
[Parameter] public EventCallback<string> ActivityChanged { get; set; }
|
||||||
[Parameter] public EventCallback<ActivityDTO> ActivityDeleted { get; set; }
|
[Parameter] public EventCallback<ActivityDTO> ActivityDeleted { get; set; }
|
||||||
|
|
||||||
|
[Parameter] public bool ShowDate { get; set; }
|
||||||
|
|
||||||
private TimeSpan? Durata { get; set; }
|
private TimeSpan? Durata { get; set; }
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
@@ -81,7 +98,7 @@
|
|||||||
|
|
||||||
private async Task OpenActivity()
|
private async Task OpenActivity()
|
||||||
{
|
{
|
||||||
var result = await ModalHelpers.OpenActivityForm(Dialog, null, Activity.ActivityId);
|
var result = await ModalHelpers.OpenActivityForm(Dialog, Activity, null);
|
||||||
|
|
||||||
switch (result)
|
switch (result)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
.activity-card {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: .5rem .5rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
line-height: normal;
|
||||||
|
box-shadow: var(--custom-box-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
@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;
|
||||||
|
|
||||||
|
var lastBeforeSkip = Steps
|
||||||
|
.TakeWhile(s => s.Status is { Skip: false })
|
||||||
|
.LastOrDefault();
|
||||||
|
|
||||||
|
if (lastBeforeSkip is not null) Stato = lastBeforeSkip.StepName;
|
||||||
|
|
||||||
|
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}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
.activity-card {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: .5rem .5rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
line-height: normal;
|
||||||
|
box-shadow: var(--custom-box-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.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: 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,8 +1,9 @@
|
|||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@inject IDialogService Dialog
|
||||||
|
|
||||||
<div class="contact-card">
|
<div class="contact-card" @onclick="OpenPersRifForm">
|
||||||
<div class="contact-left-section">
|
<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="contact-body-section">
|
||||||
<div class="title-section">
|
<div class="title-section">
|
||||||
@@ -18,15 +19,25 @@
|
|||||||
<div class="contact-right-section">
|
<div class="contact-right-section">
|
||||||
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
@if (!Contact.NumCellulare.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone" />
|
<a href="@($"tel:{Contact.NumCellulare}")">
|
||||||
|
<MudIcon Color="Color.Success" Size="Size.Large" Icon="@Icons.Material.Outlined.Phone"/>
|
||||||
|
</a>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (!Contact.EMail.IsNullOrEmpty()){
|
@if (!Contact.EMail.IsNullOrEmpty())
|
||||||
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline" />
|
{
|
||||||
|
<a href="@($"mailto:{Contact.EMail}")">
|
||||||
|
<MudIcon Color="Color.Info" Size="Size.Large" Icon="@Icons.Material.Filled.MailOutline"/>
|
||||||
|
</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public VtbCliePersRif Contact { get; set; } = new();
|
[Parameter] public PersRifDTO Contact { get; set; } = new();
|
||||||
|
|
||||||
|
private async Task OpenPersRifForm()
|
||||||
|
{
|
||||||
|
var result = await ModalHelpers.OpenPersRifForm(Dialog, Contact);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Interface
|
@using salesbook.Shared.Core.Interface
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@@ -6,7 +7,7 @@
|
|||||||
<div class="user-card-left-section">
|
<div class="user-card-left-section">
|
||||||
<div class="user-card-body-section">
|
<div class="user-card-body-section">
|
||||||
<div class="title-section">
|
<div class="title-section">
|
||||||
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@Icons.Material.Filled.Person" Size="Size.Large" />
|
<MudIcon @onclick="OpenUser" Color="Color.Primary" Icon="@(User.IsContact? Icons.Material.Filled.Person : Icons.Material.Filled.PersonOutline)" Size="Size.Large" />
|
||||||
|
|
||||||
<div class="user-card-right-section">
|
<div class="user-card-right-section">
|
||||||
<div class="user-card-title">
|
<div class="user-card-title">
|
||||||
@@ -24,11 +25,23 @@
|
|||||||
@if (!Commesse.IsNullOrEmpty())
|
@if (!Commesse.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
<div @onclick="OpenUser" class="container-commesse">
|
<div @onclick="OpenUser" class="container-commesse">
|
||||||
@foreach (var commessa in Commesse!)
|
|
||||||
|
@for (var i = 0; i < Commesse!.Count; i++)
|
||||||
{
|
{
|
||||||
|
var commessa = Commesse[i];
|
||||||
|
|
||||||
<div class="commessa">
|
<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>
|
</div>
|
||||||
|
|
||||||
|
@if (i > 5 && Commesse.Count - i > 1) break;
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@@ -47,14 +60,14 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public AnagClie User { get; set; } = new();
|
[Parameter] public ContactDTO User { get; set; } = new();
|
||||||
|
|
||||||
private List<JtbComt>? Commesse { get; set; }
|
private List<JtbComt>? Commesse { get; set; }
|
||||||
private bool IsLoading { get; set; } = true;
|
private bool IsLoading { get; set; } = true;
|
||||||
private bool ShowSectionCommesse { get; set; }
|
private bool ShowSectionCommesse { get; set; }
|
||||||
|
|
||||||
private void OpenUser() =>
|
private void OpenUser() =>
|
||||||
NavigationManager.NavigateTo($"/User/{User.CodAnag}");
|
NavigationManager.NavigateTo($"/User/{User.CodContact}/{User.IsContact}");
|
||||||
|
|
||||||
private async Task ShowCommesse()
|
private async Task ShowCommesse()
|
||||||
{
|
{
|
||||||
@@ -62,7 +75,8 @@
|
|||||||
|
|
||||||
if (ShowSectionCommesse)
|
if (ShowSectionCommesse)
|
||||||
{
|
{
|
||||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodAnag));
|
Commesse = (await ManageData.GetTable<JtbComt>(x => x.CodAnag.Equals(User.CodContact)))
|
||||||
|
.OrderByDescending(x => x.CodJcom).ToList();
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
@using System.Globalization
|
@using System.Globalization
|
||||||
@using System.Text.RegularExpressions
|
@using System.Text.RegularExpressions
|
||||||
@using CommunityToolkit.Mvvm.Messaging
|
@using CommunityToolkit.Mvvm.Messaging
|
||||||
@using salesbook.Shared.Core.Dto
|
|
||||||
@using salesbook.Shared.Components.Layout
|
@using salesbook.Shared.Components.Layout
|
||||||
@using salesbook.Shared.Core.Entity
|
|
||||||
@using salesbook.Shared.Core.Interface
|
|
||||||
@using salesbook.Shared.Components.Layout.Overlay
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@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.Core.Entity
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
@using salesbook.Shared.Core.Messages.Activity.Copy
|
@using salesbook.Shared.Core.Messages.Activity.Copy
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IIntegryApiService IntegryApiService
|
@inject IIntegryApiService IntegryApiService
|
||||||
@inject IMessenger Messenger
|
@inject IMessenger Messenger
|
||||||
|
@inject IDialogService Dialog
|
||||||
|
@inject IAttachedService AttachedService
|
||||||
|
|
||||||
<MudDialog Class="customDialog-form">
|
<MudDialog Class="customDialog-form">
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
@@ -117,9 +121,51 @@
|
|||||||
<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>
|
||||||
|
|
||||||
|
<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 (ActivityFileList != null)
|
||||||
|
{
|
||||||
|
foreach (var file in ActivityFileList)
|
||||||
|
{
|
||||||
|
<MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" Color="Color.Default">
|
||||||
|
@file.FileName
|
||||||
|
</MudChip>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-button">
|
||||||
|
<MudButton Class="button-settings green-icon"
|
||||||
|
FullWidth="true"
|
||||||
|
StartIcon="@Icons.Material.Rounded.AttachFile"
|
||||||
|
Size="Size.Medium"
|
||||||
|
OnClick="OpenAddAttached"
|
||||||
|
Variant="Variant.Outlined">
|
||||||
|
Aggiungi allegati
|
||||||
|
</MudButton>
|
||||||
|
|
||||||
@if (!IsNew)
|
@if (!IsNew)
|
||||||
{
|
{
|
||||||
<div class="container-button">
|
<div class="divider"></div>
|
||||||
|
|
||||||
<MudButton Class="button-settings gray-icon"
|
<MudButton Class="button-settings gray-icon"
|
||||||
FullWidth="true"
|
FullWidth="true"
|
||||||
StartIcon="@Icons.Material.Filled.ContentCopy"
|
StartIcon="@Icons.Material.Filled.ContentCopy"
|
||||||
@@ -139,9 +185,9 @@
|
|||||||
Variant="Variant.Outlined">
|
Variant="Variant.Outlined">
|
||||||
Elimina
|
Elimina
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
<MudMessageBox @ref="ConfirmDelete" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
||||||
<MessageContent>
|
<MessageContent>
|
||||||
@@ -149,17 +195,43 @@
|
|||||||
</MessageContent>
|
</MessageContent>
|
||||||
<YesButton>
|
<YesButton>
|
||||||
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Error"
|
||||||
StartIcon="@Icons.Material.Filled.DeleteForever">
|
StartIcon="@Icons.Material.Rounded.DeleteForever">
|
||||||
Cancella
|
Cancella
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</YesButton>
|
</YesButton>
|
||||||
</MudMessageBox>
|
</MudMessageBox>
|
||||||
|
|
||||||
|
<MudMessageBox @ref="AddNamePosition" Class="c-messageBox" Title="Nome della posizione" CancelText="Annulla">
|
||||||
|
<MessageContent>
|
||||||
|
<MudTextField @bind-Value="NamePosition" Variant="Variant.Outlined" />
|
||||||
|
</MessageContent>
|
||||||
|
<YesButton>
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Rounded.Check">
|
||||||
|
Salva
|
||||||
|
</MudButton>
|
||||||
|
</YesButton>
|
||||||
|
</MudMessageBox>
|
||||||
|
|
||||||
|
<MudMessageBox @ref="ConfirmMemo" Class="c-messageBox" Title="Attenzione!" CancelText="Annulla">
|
||||||
|
<MessageContent>
|
||||||
|
Vuoi creare un promemoria?
|
||||||
|
</MessageContent>
|
||||||
|
<YesButton>
|
||||||
|
<MudButton Size="Size.Small" Variant="Variant.Filled" Color="Color.Primary"
|
||||||
|
StartIcon="@Icons.Material.Rounded.Check">
|
||||||
|
Crea
|
||||||
|
</MudButton>
|
||||||
|
</YesButton>
|
||||||
|
</MudMessageBox>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</MudDialog>
|
</MudDialog>
|
||||||
|
|
||||||
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
<SaveOverlay VisibleOverlay="VisibleOverlay" SuccessAnimation="SuccessAnimation"/>
|
||||||
|
|
||||||
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeValue"/>
|
<SelectEsito @bind-IsSheetVisible="OpenEsito" @bind-ActivityModel="ActivityModel" @bind-ActivityModel:after="OnAfterChangeEsito"/>
|
||||||
|
|
||||||
|
<AddMemo @bind-IsSheetVisible="OpenAddMemo"/>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
[CascadingParameter] private IMudDialogInstance MudDialog { get; set; }
|
||||||
@@ -176,9 +248,10 @@
|
|||||||
private List<JtbComt> Commesse { get; set; } = [];
|
private List<JtbComt> Commesse { get; set; } = [];
|
||||||
private List<AnagClie> Clienti { get; set; } = [];
|
private List<AnagClie> Clienti { get; set; } = [];
|
||||||
private List<PtbPros> Pros { get; set; } = [];
|
private List<PtbPros> Pros { get; set; } = [];
|
||||||
|
private List<ActivityFileDto>? ActivityFileList { get; set; }
|
||||||
|
|
||||||
private bool IsNew => Id.IsNullOrEmpty();
|
private bool IsNew { get; set; }
|
||||||
private bool IsView => !NetworkService.IsNetworkAvailable();
|
private bool IsView => !NetworkService.ConnectionAvailable;
|
||||||
|
|
||||||
private string? LabelSave { get; set; }
|
private string? LabelSave { get; set; }
|
||||||
|
|
||||||
@@ -186,24 +259,35 @@
|
|||||||
private bool VisibleOverlay { get; set; }
|
private bool VisibleOverlay { get; set; }
|
||||||
private bool SuccessAnimation { get; set; }
|
private bool SuccessAnimation { get; set; }
|
||||||
|
|
||||||
private bool OpenEsito { get; set; } = false;
|
private bool OpenEsito { get; set; }
|
||||||
|
private bool OpenAddMemo { get; set; }
|
||||||
|
|
||||||
|
//MessageBox
|
||||||
private MudMessageBox ConfirmDelete { get; set; }
|
private MudMessageBox ConfirmDelete { get; set; }
|
||||||
|
private MudMessageBox ConfirmMemo { get; set; }
|
||||||
|
private MudMessageBox AddNamePosition { get; set; }
|
||||||
|
|
||||||
|
//Attached
|
||||||
|
private List<AttachedDTO>? AttachedList { get; set; }
|
||||||
|
private string? NamePosition { get; set; }
|
||||||
|
private bool CanAddPosition { get; set; } = true;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
_ = LoadData();
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
|
|
||||||
LabelSave = IsNew ? "Aggiungi" : null;
|
|
||||||
|
|
||||||
if (!Id.IsNullOrEmpty())
|
|
||||||
ActivityModel = (await ManageData.GetActivity(x => x.ActivityId.Equals(Id))).Last();
|
|
||||||
|
|
||||||
if (ActivityCopied != null)
|
if (ActivityCopied != null)
|
||||||
{
|
{
|
||||||
ActivityModel = ActivityCopied.Clone();
|
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;
|
||||||
|
|
||||||
|
_ = LoadData();
|
||||||
await LoadCommesse();
|
await LoadCommesse();
|
||||||
|
|
||||||
if (IsNew)
|
if (IsNew)
|
||||||
@@ -223,6 +307,8 @@
|
|||||||
VisibleOverlay = true;
|
VisibleOverlay = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
|
await SavePosition();
|
||||||
|
|
||||||
var response = await IntegryApiService.SaveActivity(ActivityModel);
|
var response = await IntegryApiService.SaveActivity(ActivityModel);
|
||||||
|
|
||||||
if (response == null)
|
if (response == null)
|
||||||
@@ -232,6 +318,8 @@
|
|||||||
|
|
||||||
await ManageData.InsertOrUpdate(newActivity);
|
await ManageData.InsertOrUpdate(newActivity);
|
||||||
|
|
||||||
|
await SaveAttached(newActivity.ActivityId!);
|
||||||
|
|
||||||
SuccessAnimation = true;
|
SuccessAnimation = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
|
|
||||||
@@ -240,10 +328,43 @@
|
|||||||
MudDialog.Close(newActivity);
|
MudDialog.Close(newActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task SavePosition()
|
||||||
|
{
|
||||||
|
if (AttachedList != null)
|
||||||
|
{
|
||||||
|
foreach (var attached in AttachedList)
|
||||||
|
{
|
||||||
|
if (attached.Type != AttachedDTO.TypeAttached.Position) continue;
|
||||||
|
|
||||||
|
var position = new PositionDTO
|
||||||
|
{
|
||||||
|
Description = attached.Description,
|
||||||
|
Lat = attached.Lat,
|
||||||
|
Lng = attached.Lng
|
||||||
|
};
|
||||||
|
|
||||||
|
ActivityModel.Position = await IntegryApiService.SavePosition(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SaveAttached(string activityId)
|
||||||
|
{
|
||||||
|
if (AttachedList != null)
|
||||||
|
{
|
||||||
|
foreach (var attached in AttachedList)
|
||||||
|
{
|
||||||
|
if (attached.FileContent is not null && attached.Type != AttachedDTO.TypeAttached.Position)
|
||||||
|
{
|
||||||
|
await IntegryApiService.UploadFile(activityId, attached.FileBytes, attached.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool CheckPreSave()
|
private bool CheckPreSave()
|
||||||
{
|
{
|
||||||
Snackbar.Clear();
|
Snackbar.Clear();
|
||||||
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
|
||||||
|
|
||||||
if (!ActivityModel.ActivityTypeId.IsNullOrEmpty()) return true;
|
if (!ActivityModel.ActivityTypeId.IsNullOrEmpty()) return true;
|
||||||
Snackbar.Add("Tipo attività obbligatorio!", Severity.Error);
|
Snackbar.Add("Tipo attività obbligatorio!", Severity.Error);
|
||||||
@@ -253,10 +374,15 @@
|
|||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
{
|
{
|
||||||
|
if (!IsNew && Id != null)
|
||||||
|
{
|
||||||
|
ActivityFileList = await IntegryApiService.GetActivityFile(Id);
|
||||||
|
}
|
||||||
|
|
||||||
Users = await ManageData.GetTable<StbUser>();
|
Users = await ManageData.GetTable<StbUser>();
|
||||||
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
ActivityResult = await ManageData.GetTable<StbActivityResult>();
|
||||||
Clienti = await ManageData.GetTable<AnagClie>(x => x.FlagStato.Equals("A"));
|
Clienti = await ManageData.GetClienti(new WhereCondContact {FlagStato = "A"});
|
||||||
Pros = await ManageData.GetTable<PtbPros>();
|
Pros = await ManageData.GetProspect();
|
||||||
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
ActivityType = await ManageData.GetTable<StbActivityType>(x => x.FlagTipologia.Equals("A"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,9 +443,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task OnAfterChangeEsito()
|
||||||
|
{
|
||||||
|
OnAfterChangeValue();
|
||||||
|
|
||||||
|
// var result = await ConfirmMemo.ShowAsync();
|
||||||
|
|
||||||
|
// if (result is true)
|
||||||
|
// OpenAddMemo = !OpenAddMemo;
|
||||||
|
}
|
||||||
|
|
||||||
private void OpenSelectEsito()
|
private void OpenSelectEsito()
|
||||||
{
|
{
|
||||||
if (!IsNew && (ActivityModel.UserName is null || !ActivityModel.UserName.Equals(UserSession.User.Username))) 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;
|
||||||
|
}
|
||||||
|
|
||||||
OpenEsito = !OpenEsito;
|
OpenEsito = !OpenEsito;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
@@ -358,9 +498,97 @@
|
|||||||
private void Duplica()
|
private void Duplica()
|
||||||
{
|
{
|
||||||
var activityCopy = ActivityModel.Clone();
|
var activityCopy = ActivityModel.Clone();
|
||||||
|
activityCopy.ActivityId = null;
|
||||||
|
|
||||||
MudDialog.Cancel();
|
MudDialog.Cancel();
|
||||||
Messenger.Send(new CopyActivityMessage(activityCopy));
|
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;
|
||||||
|
|
||||||
|
var resultNamePosition = await AddNamePosition.ShowAsync();
|
||||||
|
|
||||||
|
if (resultNamePosition is true)
|
||||||
|
attached.Description = NamePosition;
|
||||||
|
attached.Name = NamePosition!;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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(",", ".");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
.container-chip-attached {
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
.container-button {
|
.container-button {
|
||||||
background: var(--mud-palette-background-gray) !important;
|
background: var(--mud-palette-background-gray) !important;
|
||||||
box-shadow: unset;
|
box-shadow: unset;
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
@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">
|
||||||
|
<DialogContent>
|
||||||
|
<HeaderLayout ShowProfile="false" SmallHeader="true" Cancel="true" OnCancel="() => MudDialog.Cancel()" Title="Aggiungi allegati"/>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
</DialogContent>
|
||||||
|
</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; }
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
|
|
||||||
|
_ = LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task Save()
|
||||||
|
{
|
||||||
|
VisibleOverlay = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
SuccessAnimation = true;
|
||||||
|
StateHasChanged();
|
||||||
|
|
||||||
|
await Task.Delay(1250);
|
||||||
|
|
||||||
|
MudDialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnImage()
|
||||||
|
{
|
||||||
|
Attached = await AttachedService.SelectImage();
|
||||||
|
MudDialog.Close(Attached);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnFile()
|
||||||
|
{
|
||||||
|
Attached = await AttachedService.SelectFile();
|
||||||
|
MudDialog.Close(Attached);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnPosition()
|
||||||
|
{
|
||||||
|
Attached = await AttachedService.SelectPosition();
|
||||||
|
MudDialog.Close(Attached);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
.content.attached {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2rem;
|
||||||
|
padding: 1rem;
|
||||||
|
height: unset;
|
||||||
|
}
|
||||||
@@ -0,0 +1,568 @@
|
|||||||
|
@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
|
||||||
|
@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>
|
||||||
|
|
||||||
|
@if (VtbTipi.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
<span class="warning-text">Nessun tipo cliente trovato</span>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudSelectExtended FullWidth="true" ReadOnly="@(IsView || VtbTipi.IsNullOrEmpty())" T="string?" Variant="Variant.Text" @bind-Value="ContactModel.CodVtip" @bind-Value:after="OnAfterChangeValue" Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||||
|
@foreach (var tipo in VtbTipi)
|
||||||
|
{
|
||||||
|
<MudSelectItemExtended Class="custom-item-select" Value="@tipo.CodVtip">@($"{tipo.CodVtip} - {tipo.Descrizione}")</MudSelectItemExtended>
|
||||||
|
}
|
||||||
|
</MudSelectExtended>
|
||||||
|
}
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<MudSelectExtended FullWidth="true" T="string?" Variant="Variant.Text" NoWrap="true"
|
||||||
|
@bind-Value="ContactModel.CodVage" @bind-Value:after="OnAfterChangeValue"
|
||||||
|
Class="customIcon-select" AdornmentIcon="@Icons.Material.Filled.Code">
|
||||||
|
@foreach (var user in Users)
|
||||||
|
{
|
||||||
|
<MudSelectItemExtended Class="custom-item-select" Value="@user.UserCode">@($"{user.UserCode} - {user.FullName}")</MudSelectItemExtended>
|
||||||
|
}
|
||||||
|
</MudSelectExtended>
|
||||||
|
</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>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="container-button">
|
||||||
|
@if (IsNew)
|
||||||
|
{
|
||||||
|
<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>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@if (NetworkService.ConnectionAvailable && !ContactModel.IsContact)
|
||||||
|
{
|
||||||
|
<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; }
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
Snackbar.Configuration.PositionClass = Defaults.Classes.Position.TopCenter;
|
||||||
|
|
||||||
|
await 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 async Task LoadData()
|
||||||
|
{
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
await IntegryApiService.TransferProspect(new CRMTransferProspectRequestDTO
|
||||||
|
{
|
||||||
|
CodPpro = ContactModel.CodContact
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
.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,6 +1,3 @@
|
|||||||
@using salesbook.Shared.Core.Services
|
|
||||||
@inject AppAuthenticationStateProvider AuthenticationStateProvider
|
|
||||||
|
|
||||||
<div class="container container-modal">
|
<div class="container container-modal">
|
||||||
<div class="c-modal">
|
<div class="c-modal">
|
||||||
<div class="exception-header mb-2">
|
<div class="exception-header mb-2">
|
||||||
@@ -0,0 +1,200 @@
|
|||||||
|
@using salesbook.Shared.Core.Dto
|
||||||
|
@using salesbook.Shared.Components.Layout
|
||||||
|
@using salesbook.Shared.Core.Interface
|
||||||
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
.container-button {
|
||||||
|
background: var(--mud-palette-background-gray) !important;
|
||||||
|
box-shadow: unset;
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
using salesbook.Shared.Core.Helpers.Enum;
|
using salesbook.Shared.Core.Helpers.Enum;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Dto;
|
namespace salesbook.Shared.Core.Dto.Activity;
|
||||||
|
|
||||||
public class ActivityDTO : StbActivity
|
public class ActivityDTO : StbActivity
|
||||||
{
|
{
|
||||||
@@ -12,6 +12,8 @@ public class ActivityDTO : StbActivity
|
|||||||
|
|
||||||
public bool Deleted { get; set; }
|
public bool Deleted { get; set; }
|
||||||
|
|
||||||
|
public PositionDTO? Position { get; set; }
|
||||||
|
|
||||||
public ActivityDTO Clone()
|
public ActivityDTO Clone()
|
||||||
{
|
{
|
||||||
return (ActivityDTO)MemberwiseClone();
|
return (ActivityDTO)MemberwiseClone();
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
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,7 +1,7 @@
|
|||||||
using salesbook.Shared.Core.Helpers;
|
using salesbook.Shared.Core.Helpers;
|
||||||
using salesbook.Shared.Core.Helpers.Enum;
|
using salesbook.Shared.Core.Helpers.Enum;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Dto;
|
namespace salesbook.Shared.Core.Dto.Activity;
|
||||||
|
|
||||||
public class FilterActivityDTO
|
public class FilterActivityDTO
|
||||||
{
|
{
|
||||||
11
salesbook.Shared/Core/Dto/Activity/WhereCondActivity.cs
Normal file
11
salesbook.Shared/Core/Dto/Activity/WhereCondActivity.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
24
salesbook.Shared/Core/Dto/ActivityFileDto.cs
Normal file
24
salesbook.Shared/Core/Dto/ActivityFileDto.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
28
salesbook.Shared/Core/Dto/AttachedDTO.cs
Normal file
28
salesbook.Shared/Core/Dto/AttachedDTO.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
12
salesbook.Shared/Core/Dto/AutoCompleteAddressDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/AutoCompleteAddressDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
27
salesbook.Shared/Core/Dto/CRMAttachedResponseDTO.cs
Normal file
27
salesbook.Shared/Core/Dto/CRMAttachedResponseDTO.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
24
salesbook.Shared/Core/Dto/CRMCreateContactRequestDTO.cs
Normal file
24
salesbook.Shared/Core/Dto/CRMCreateContactRequestDTO.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CRMCreateContactRequestDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("codAnag")]
|
||||||
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codVdes")]
|
||||||
|
public string? CodVdes { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codVage")]
|
||||||
|
public string? CodVage { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("tipoAnag")]
|
||||||
|
public string TipoAnag { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("cliente")]
|
||||||
|
public ContactDTO Cliente { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("persRif")]
|
||||||
|
public List<PersRifDTO>? PersRif { get; set; }
|
||||||
|
}
|
||||||
19
salesbook.Shared/Core/Dto/CRMCreateContactResponseDTO.cs
Normal file
19
salesbook.Shared/Core/Dto/CRMCreateContactResponseDTO.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using salesbook.Shared.Core.Entity;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CRMCreateContactResponseDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("anagClie")]
|
||||||
|
public AnagClie? AnagClie { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ptbPros")]
|
||||||
|
public PtbPros? PtbPros { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("vtbCliePersRif")]
|
||||||
|
public List<VtbCliePersRif> VtbCliePersRif { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ptbProsRifs")]
|
||||||
|
public List<PtbProsRif> PtbProsRif { get; set; }
|
||||||
|
}
|
||||||
12
salesbook.Shared/Core/Dto/CRMTransferProspectRequestDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/CRMTransferProspectRequestDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CRMTransferProspectRequestDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("codAnag")]
|
||||||
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codPpro")]
|
||||||
|
public string? CodPpro { get; set; }
|
||||||
|
}
|
||||||
10
salesbook.Shared/Core/Dto/CRMTransferProspectResponseDTO.cs
Normal file
10
salesbook.Shared/Core/Dto/CRMTransferProspectResponseDTO.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using salesbook.Shared.Core.Entity;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CRMTransferProspectResponseDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("anagClie")]
|
||||||
|
public AnagClie? AnagClie { get; set; }
|
||||||
|
}
|
||||||
12
salesbook.Shared/Core/Dto/CheckVatRequestDTO.cs
Normal file
12
salesbook.Shared/Core/Dto/CheckVatRequestDTO.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CheckVatRequestDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("countryCode")]
|
||||||
|
public string CountryCode { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("vatNumber")]
|
||||||
|
public string VatNumber { get; set; }
|
||||||
|
}
|
||||||
39
salesbook.Shared/Core/Dto/CheckVatResponseDTO.cs
Normal file
39
salesbook.Shared/Core/Dto/CheckVatResponseDTO.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class CheckVatResponseDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("countryCode")]
|
||||||
|
public string? CountryCode { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("vatNumber ")]
|
||||||
|
public string? VatNumber { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("requestDate")]
|
||||||
|
public string? RequestDate { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("valid")]
|
||||||
|
public bool Valid { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("name")]
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("address")]
|
||||||
|
public string? CompleteAddress { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ragSoc")]
|
||||||
|
public string? RagSoc { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("indirizzo")]
|
||||||
|
public string? Indirizzo { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("cap")]
|
||||||
|
public string? Cap { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("citta")]
|
||||||
|
public string? Citta { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("prov")]
|
||||||
|
public string? Prov { get; set; }
|
||||||
|
}
|
||||||
19
salesbook.Shared/Core/Dto/Contact/CRMAnagRequestDTO.cs
Normal file
19
salesbook.Shared/Core/Dto/Contact/CRMAnagRequestDTO.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.Contact;
|
||||||
|
|
||||||
|
public class CRMAnagRequestDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("filterDate")]
|
||||||
|
public DateTime? FilterDate { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("flagStato")]
|
||||||
|
public string? FlagStato { get; set; }
|
||||||
|
[JsonPropertyName("partitaIva")]
|
||||||
|
public string? PartIva { get; set; }
|
||||||
|
[JsonPropertyName("codAnag")]
|
||||||
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("returnPersRif")]
|
||||||
|
public bool ReturnPersRif { get; set; }
|
||||||
|
}
|
||||||
17
salesbook.Shared/Core/Dto/Contact/CRMProspectRequestDTO.cs
Normal file
17
salesbook.Shared/Core/Dto/Contact/CRMProspectRequestDTO.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.Contact;
|
||||||
|
|
||||||
|
public class CRMProspectRequestDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("filterDate")]
|
||||||
|
public DateTime? FilterDate { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("partitaIva")]
|
||||||
|
public string? PartIva { get; set; }
|
||||||
|
[JsonPropertyName("codPpro")]
|
||||||
|
public string? CodPpro { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("returnPersRif")]
|
||||||
|
public bool ReturnPersRif { get; set; }
|
||||||
|
}
|
||||||
10
salesbook.Shared/Core/Dto/Contact/WhereCondContact.cs
Normal file
10
salesbook.Shared/Core/Dto/Contact/WhereCondContact.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
namespace salesbook.Shared.Core.Dto.Contact;
|
||||||
|
|
||||||
|
public class WhereCondContact
|
||||||
|
{
|
||||||
|
public string? FlagStato { get; set; }
|
||||||
|
public string? PartIva { get; set; }
|
||||||
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
|
public bool OnlyContact { get; set; }
|
||||||
|
}
|
||||||
65
salesbook.Shared/Core/Dto/ContactDTO.cs
Normal file
65
salesbook.Shared/Core/Dto/ContactDTO.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class ContactDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("codContact")]
|
||||||
|
public string CodContact { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("isContact")]
|
||||||
|
public bool IsContact { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codVtip")]
|
||||||
|
public string? CodVtip { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codVage")]
|
||||||
|
public string? CodVage { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("ragSoc")]
|
||||||
|
public string? RagSoc { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("indirizzo")]
|
||||||
|
public string? Indirizzo { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("cap")]
|
||||||
|
public string? Cap { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("citta")]
|
||||||
|
public string? Citta { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("prov")]
|
||||||
|
public string? Prov { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("nazione")]
|
||||||
|
public string? Nazione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("telefono")]
|
||||||
|
public string? Telefono { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("fax")]
|
||||||
|
public string Fax { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("partIva")]
|
||||||
|
public string PartIva { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("codFisc")]
|
||||||
|
public string CodFisc { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("note")]
|
||||||
|
public string Note { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("personaRif")]
|
||||||
|
public string PersonaRif { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("eMail")]
|
||||||
|
public string? EMail { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("eMailPec")]
|
||||||
|
public string EMailPec { get; set; }
|
||||||
|
|
||||||
|
public ContactDTO Clone()
|
||||||
|
{
|
||||||
|
return (ContactDTO)MemberwiseClone();
|
||||||
|
}
|
||||||
|
}
|
||||||
15
salesbook.Shared/Core/Dto/FilterUserDTO.cs
Normal file
15
salesbook.Shared/Core/Dto/FilterUserDTO.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class FilterUserDTO
|
||||||
|
{
|
||||||
|
public bool ConAgente { get; set; }
|
||||||
|
public bool SenzaAgente { get; set; }
|
||||||
|
public IEnumerable<string>? Agenti { get; set; }
|
||||||
|
|
||||||
|
public string? Indirizzo { get; set; }
|
||||||
|
public string? Citta { get; set; }
|
||||||
|
public string? Nazione { get; set; }
|
||||||
|
public string? Prov { get; set; }
|
||||||
|
|
||||||
|
public bool IsInitialized { get; set; }
|
||||||
|
}
|
||||||
36
salesbook.Shared/Core/Dto/IndirizzoDTO.cs
Normal file
36
salesbook.Shared/Core/Dto/IndirizzoDTO.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class IndirizzoDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("idPosizione")]
|
||||||
|
public int IdPosizione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("via")]
|
||||||
|
public string? Via { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("numeroCivico")]
|
||||||
|
public string? NumeroCivico { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("indirizzo")]
|
||||||
|
public string? Indirizzo { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("cap")]
|
||||||
|
public string? Cap { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("citta")]
|
||||||
|
public string? Citta { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("prov")]
|
||||||
|
public string? Prov { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("nazione")]
|
||||||
|
public string? Nazione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lat")]
|
||||||
|
public decimal? Lat { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lng")]
|
||||||
|
public decimal? Lng { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.JobProgress;
|
||||||
|
|
||||||
|
public class CRMJobProgressResponseDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("steps")]
|
||||||
|
public List<CRMJobStepDTO> Steps { get; set; }
|
||||||
|
}
|
||||||
15
salesbook.Shared/Core/Dto/JobProgress/CRMJobStatusDTO.cs
Normal file
15
salesbook.Shared/Core/Dto/JobProgress/CRMJobStatusDTO.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.JobProgress;
|
||||||
|
|
||||||
|
public class CRMJobStatusDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("completed")]
|
||||||
|
public bool Completed { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("progress")]
|
||||||
|
public bool Progress { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("skip")]
|
||||||
|
public bool Skip { get; set; }
|
||||||
|
}
|
||||||
15
salesbook.Shared/Core/Dto/JobProgress/CRMJobStepDTO.cs
Normal file
15
salesbook.Shared/Core/Dto/JobProgress/CRMJobStepDTO.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.JobProgress;
|
||||||
|
|
||||||
|
public class CRMJobStepDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("stepName")]
|
||||||
|
public string? StepName { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("status")]
|
||||||
|
public CRMJobStatusDTO? Status { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("date")]
|
||||||
|
public DateTime? Date { get; set; }
|
||||||
|
}
|
||||||
8
salesbook.Shared/Core/Dto/PageState/JobSteps.cs
Normal file
8
salesbook.Shared/Core/Dto/PageState/JobSteps.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using salesbook.Shared.Core.Dto.JobProgress;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.PageState;
|
||||||
|
|
||||||
|
public class JobSteps
|
||||||
|
{
|
||||||
|
public List<CRMJobStepDTO>? Steps { get; set; }
|
||||||
|
}
|
||||||
21
salesbook.Shared/Core/Dto/PageState/UserListState.cs
Normal file
21
salesbook.Shared/Core/Dto/PageState/UserListState.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using salesbook.Shared.Core.Dto.Users;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.PageState;
|
||||||
|
|
||||||
|
public class UserListState
|
||||||
|
{
|
||||||
|
public List<UserDisplayItem>? GroupedUserList { get; set; }
|
||||||
|
public List<UserDisplayItem>? FilteredGroupedUserList { get; set; }
|
||||||
|
|
||||||
|
public bool IsLoaded { get; set; }
|
||||||
|
public bool IsLoading { get; set; }
|
||||||
|
|
||||||
|
public event Action? OnUsersLoaded;
|
||||||
|
|
||||||
|
public void NotifyUsersLoaded()
|
||||||
|
{
|
||||||
|
IsLoaded = true;
|
||||||
|
IsLoading = false;
|
||||||
|
OnUsersLoaded?.Invoke();
|
||||||
|
}
|
||||||
|
}
|
||||||
17
salesbook.Shared/Core/Dto/PageState/UserPageState.cs
Normal file
17
salesbook.Shared/Core/Dto/PageState/UserPageState.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
using salesbook.Shared.Core.Dto.JobProgress;
|
||||||
|
using salesbook.Shared.Core.Entity;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto.PageState;
|
||||||
|
|
||||||
|
public class UserPageState
|
||||||
|
{
|
||||||
|
public string? CodUser { get; set; }
|
||||||
|
|
||||||
|
public ContactDTO Anag { get; set; }
|
||||||
|
public List<PersRifDTO>? PersRif { get; set; }
|
||||||
|
public List<JtbComt> Commesse { get; set; }
|
||||||
|
public StbUser? Agente { get; set; }
|
||||||
|
public Dictionary<string, List<CRMJobStepDTO>?> Steps { get; set; }
|
||||||
|
public List<ActivityDTO> Activitys { get; set; }
|
||||||
|
}
|
||||||
38
salesbook.Shared/Core/Dto/PersRifDTO.cs
Normal file
38
salesbook.Shared/Core/Dto/PersRifDTO.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class PersRifDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("codPersRif")]
|
||||||
|
public string CodPersRif { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("idPersRif")]
|
||||||
|
public int IdPersRif { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("personaRif")]
|
||||||
|
public string PersonaRif { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("eMail")]
|
||||||
|
public string EMail { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("fax")]
|
||||||
|
public string Fax { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("mansione")]
|
||||||
|
public string? Mansione { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("numCellulare")]
|
||||||
|
public string NumCellulare { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("telefono")]
|
||||||
|
public string Telefono { get; set; }
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
|
public int TempId { get; set; }
|
||||||
|
|
||||||
|
public PersRifDTO Clone()
|
||||||
|
{
|
||||||
|
return (PersRifDTO)MemberwiseClone();
|
||||||
|
}
|
||||||
|
}
|
||||||
18
salesbook.Shared/Core/Dto/PositionDTO.cs
Normal file
18
salesbook.Shared/Core/Dto/PositionDTO.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
public class PositionDTO
|
||||||
|
{
|
||||||
|
[JsonPropertyName("id")]
|
||||||
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("description")]
|
||||||
|
public string? Description { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lat")]
|
||||||
|
public double? Lat { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("lng")]
|
||||||
|
public double? Lng { get; set; }
|
||||||
|
}
|
||||||
@@ -13,4 +13,10 @@ public class SettingsResponseDTO
|
|||||||
|
|
||||||
[JsonPropertyName("stbUsers")]
|
[JsonPropertyName("stbUsers")]
|
||||||
public List<StbUser>? StbUsers { get; set; }
|
public List<StbUser>? StbUsers { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("vtbTipi")]
|
||||||
|
public List<VtbTipi>? VtbTipi { get; set; }
|
||||||
|
|
||||||
|
[JsonPropertyName("nazioni")]
|
||||||
|
public List<Nazioni>? Nazioni { get; set; }
|
||||||
}
|
}
|
||||||
8
salesbook.Shared/Core/Dto/Users/UserDisplayItem.cs
Normal file
8
salesbook.Shared/Core/Dto/Users/UserDisplayItem.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace salesbook.Shared.Core.Dto.Users;
|
||||||
|
|
||||||
|
public class UserDisplayItem
|
||||||
|
{
|
||||||
|
public required ContactDTO User { get; set; }
|
||||||
|
public bool ShowHeader { get; set; }
|
||||||
|
public string? HeaderLetter { get; set; }
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@ using salesbook.Shared.Core.Entity;
|
|||||||
|
|
||||||
namespace salesbook.Shared.Core.Dto;
|
namespace salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
public class TaskSyncResponseDTO
|
public class UsersSyncResponseDTO
|
||||||
{
|
{
|
||||||
[JsonPropertyName("anagClie")]
|
[JsonPropertyName("anagClie")]
|
||||||
public List<AnagClie>? AnagClie { get; set; }
|
public List<AnagClie>? AnagClie { get; set; }
|
||||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
public class AnagClie
|
public class AnagClie
|
||||||
{
|
{
|
||||||
[PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")]
|
[PrimaryKey, Column("cod_anag"), JsonPropertyName("codAnag")]
|
||||||
public string CodAnag { get; set; }
|
public string? CodAnag { get; set; }
|
||||||
|
|
||||||
[Column("cod_vtip"), JsonPropertyName("codVtip")]
|
[Column("cod_vtip"), JsonPropertyName("codVtip")]
|
||||||
public string? CodVtip { get; set; }
|
public string? CodVtip { get; set; }
|
||||||
|
|||||||
@@ -107,4 +107,7 @@ public class JtbComt
|
|||||||
|
|
||||||
[Column("note_tecniche"), JsonPropertyName("noteTecniche")]
|
[Column("note_tecniche"), JsonPropertyName("noteTecniche")]
|
||||||
public string NoteTecniche { get; set; }
|
public string NoteTecniche { get; set; }
|
||||||
|
|
||||||
|
[Ignore, JsonIgnore]
|
||||||
|
public DateTime? LastUpd { get; set; }
|
||||||
}
|
}
|
||||||
23
salesbook.Shared/Core/Entity/Nazioni.cs
Normal file
23
salesbook.Shared/Core/Entity/Nazioni.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using SQLite;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Entity;
|
||||||
|
|
||||||
|
[Table("nazioni")]
|
||||||
|
public class Nazioni
|
||||||
|
{
|
||||||
|
[PrimaryKey, Column("nazione"), JsonPropertyName("nazione")]
|
||||||
|
public string Nazione { get; set; }
|
||||||
|
|
||||||
|
[Column("cod_nazione_iso"), JsonPropertyName("codNazioneIso")]
|
||||||
|
public string CodNazioneIso { get; set; }
|
||||||
|
|
||||||
|
[Column("cod_nazi_alpha_2"), JsonPropertyName("codNazioneAlpha2")]
|
||||||
|
public string CodNazioneAlpha2 { get; set; }
|
||||||
|
|
||||||
|
[Column("descrizione"), JsonPropertyName("descrizione")]
|
||||||
|
public string Descrizione { get; set; }
|
||||||
|
|
||||||
|
[Column("chk_part_iva"), JsonPropertyName("chkPartIva")]
|
||||||
|
public bool ChkPartIva { get; set; }
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
public class PtbPros
|
public class PtbPros
|
||||||
{
|
{
|
||||||
[PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")]
|
[PrimaryKey, Column("cod_ppro"), JsonPropertyName("codPpro")]
|
||||||
public string CodPpro { get; set; }
|
public string? CodPpro { get; set; }
|
||||||
|
|
||||||
[Column("agenzia_banca"), JsonPropertyName("agenziaBanca")]
|
[Column("agenzia_banca"), JsonPropertyName("agenziaBanca")]
|
||||||
public string AgenziaBanca { get; set; }
|
public string AgenziaBanca { get; set; }
|
||||||
|
|||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("ptb_pros_rif")]
|
[Table("ptb_pros_rif")]
|
||||||
public class PtbProsRif
|
public class PtbProsRif
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private string? _codPpro;
|
||||||
|
|
||||||
[Column("cod_ppro"), JsonPropertyName("codPpro"), Indexed(Name = "PtbProsRifPK", Order = 1, Unique = true)]
|
[Column("cod_ppro"), JsonPropertyName("codPpro"), Indexed(Name = "PtbProsRifPK", Order = 1, Unique = true)]
|
||||||
public string CodPpro { get; set; }
|
public string? CodPpro
|
||||||
|
{
|
||||||
|
get => _codPpro;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codPpro = value;
|
||||||
|
if (_codPpro != null && _idPersRif != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int? _idPersRif;
|
||||||
|
|
||||||
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "PtbProsRifPK", Order = 2, Unique = true)]
|
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "PtbProsRifPK", Order = 2, Unique = true)]
|
||||||
public int IdPersRif { get; set; }
|
public int? IdPersRif
|
||||||
|
{
|
||||||
|
get => _idPersRif;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_idPersRif = value;
|
||||||
|
if (_codPpro != null && _idPersRif != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
||||||
public string PersonaRif { get; set; }
|
public string PersonaRif { get; set; }
|
||||||
@@ -29,4 +54,7 @@ public class PtbProsRif
|
|||||||
|
|
||||||
[Column("telefono"), JsonPropertyName("telefono")]
|
[Column("telefono"), JsonPropertyName("telefono")]
|
||||||
public string Telefono { get; set; }
|
public string Telefono { get; set; }
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{CodPpro}::{IdPersRif}";
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
public class StbActivity
|
public class StbActivity
|
||||||
{
|
{
|
||||||
[PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")]
|
[PrimaryKey, Column("activity_id"), JsonPropertyName("activityId")]
|
||||||
public string ActivityId { get; set; }
|
public string? ActivityId { get; set; }
|
||||||
|
|
||||||
[Column("activity_result_id"), JsonPropertyName("activityResultId")]
|
[Column("activity_result_id"), JsonPropertyName("activityResultId")]
|
||||||
public string? ActivityResultId { get; set; }
|
public string? ActivityResultId { get; set; }
|
||||||
|
|||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("stb_activity_type")]
|
[Table("stb_activity_type")]
|
||||||
public class StbActivityType
|
public class StbActivityType
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private string? _activityTypeId;
|
||||||
|
|
||||||
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
|
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
|
||||||
public string ActivityTypeId { get; set; }
|
public string? ActivityTypeId
|
||||||
|
{
|
||||||
|
get => _activityTypeId;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_activityTypeId = value;
|
||||||
|
if (_activityTypeId != null && _flagTipologia != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _flagTipologia;
|
||||||
|
|
||||||
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
|
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
|
||||||
public string FlagTipologia { get; set; }
|
public string? FlagTipologia
|
||||||
|
{
|
||||||
|
get => _flagTipologia;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_flagTipologia = value;
|
||||||
|
if (_activityTypeId != null && _flagTipologia != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
|
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
|
||||||
public double? EstimatedDuration { get; set; } = 0;
|
public double? EstimatedDuration { get; set; } = 0;
|
||||||
@@ -38,4 +63,7 @@ public class StbActivityType
|
|||||||
|
|
||||||
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
|
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
|
||||||
public bool FlagViewCalendar { get; set; }
|
public bool FlagViewCalendar { get; set; }
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{ActivityTypeId}::{FlagTipologia}";
|
||||||
}
|
}
|
||||||
@@ -11,4 +11,10 @@ public class StbUser
|
|||||||
|
|
||||||
[Column("full_name"), JsonPropertyName("fullName")]
|
[Column("full_name"), JsonPropertyName("fullName")]
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
|
|
||||||
|
[Column("key_group"), JsonPropertyName("keyGroup")]
|
||||||
|
public int KeyGroup { get; set; }
|
||||||
|
|
||||||
|
[Column("user_code"), JsonPropertyName("userCode")]
|
||||||
|
public string? UserCode { get; set; }
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("vtb_clie_pers_rif")]
|
[Table("vtb_clie_pers_rif")]
|
||||||
public class VtbCliePersRif
|
public class VtbCliePersRif
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private int? _idPersRif;
|
||||||
|
|
||||||
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "VtbCliePersRifPK", Order = 1, Unique = true)]
|
[Column("id_pers_rif"), JsonPropertyName("idPersRif"), Indexed(Name = "VtbCliePersRifPK", Order = 1, Unique = true)]
|
||||||
public int IdPersRif { get; set; }
|
public int? IdPersRif
|
||||||
|
{
|
||||||
|
get => _idPersRif;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_idPersRif = value;
|
||||||
|
if (_idPersRif != null && _codAnag != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _codAnag;
|
||||||
|
|
||||||
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbCliePersRifPK", Order = 2, Unique = true)]
|
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbCliePersRifPK", Order = 2, Unique = true)]
|
||||||
public string CodAnag { get; set; }
|
public string? CodAnag
|
||||||
|
{
|
||||||
|
get => _codAnag;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codAnag = value;
|
||||||
|
if (_idPersRif != null && _codAnag != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
[Column("persona_rif"), JsonPropertyName("personaRif")]
|
||||||
public string PersonaRif { get; set; }
|
public string PersonaRif { get; set; }
|
||||||
@@ -38,4 +63,7 @@ public class VtbCliePersRif
|
|||||||
|
|
||||||
[Column("data_ult_agg"), JsonPropertyName("dataUltAgg")]
|
[Column("data_ult_agg"), JsonPropertyName("dataUltAgg")]
|
||||||
public DateTime? DataUltAgg { get; set; } = DateTime.Now;
|
public DateTime? DataUltAgg { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{IdPersRif}::{CodAnag}";
|
||||||
}
|
}
|
||||||
@@ -6,11 +6,36 @@ namespace salesbook.Shared.Core.Entity;
|
|||||||
[Table("vtb_dest")]
|
[Table("vtb_dest")]
|
||||||
public class VtbDest
|
public class VtbDest
|
||||||
{
|
{
|
||||||
|
[PrimaryKey, Column("composite_key")]
|
||||||
|
public string CompositeKey { get; set; }
|
||||||
|
|
||||||
|
private string? _codAnag;
|
||||||
|
|
||||||
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbDestPK", Order = 1, Unique = true)]
|
[Column("cod_anag"), JsonPropertyName("codAnag"), Indexed(Name = "VtbDestPK", Order = 1, Unique = true)]
|
||||||
public string CodAnag { get; set; }
|
public string? CodAnag
|
||||||
|
{
|
||||||
|
get => _codAnag;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codAnag = value;
|
||||||
|
if (_codAnag != null && _codVdes != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string? _codVdes;
|
||||||
|
|
||||||
[Column("cod_vdes"), JsonPropertyName("codVdes"), Indexed(Name = "VtbDestPK", Order = 2, Unique = true)]
|
[Column("cod_vdes"), JsonPropertyName("codVdes"), Indexed(Name = "VtbDestPK", Order = 2, Unique = true)]
|
||||||
public string CodVdes { get; set; }
|
public string? CodVdes
|
||||||
|
{
|
||||||
|
get => _codVdes;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_codVdes = value;
|
||||||
|
if (_codAnag != null && _codVdes != null)
|
||||||
|
UpdateCompositeKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Column("destinatario"), JsonPropertyName("destinatario")]
|
[Column("destinatario"), JsonPropertyName("destinatario")]
|
||||||
public string Destinatario { get; set; }
|
public string Destinatario { get; set; }
|
||||||
@@ -194,4 +219,7 @@ public class VtbDest
|
|||||||
|
|
||||||
[Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")]
|
[Column("cod_fisc_legale"), JsonPropertyName("codFiscLegale")]
|
||||||
public string CodFiscLegale { get; set; }
|
public string CodFiscLegale { get; set; }
|
||||||
|
|
||||||
|
private void UpdateCompositeKey() =>
|
||||||
|
CompositeKey = $"{CodAnag}::{CodVdes}";
|
||||||
}
|
}
|
||||||
14
salesbook.Shared/Core/Entity/VtbTipi.cs
Normal file
14
salesbook.Shared/Core/Entity/VtbTipi.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using SQLite;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Entity;
|
||||||
|
|
||||||
|
[Table("vtb_tipi")]
|
||||||
|
public class VtbTipi
|
||||||
|
{
|
||||||
|
[PrimaryKey, Column("cod_vtip"), JsonPropertyName("codVtip")]
|
||||||
|
public string CodVtip { get; set; }
|
||||||
|
|
||||||
|
[Column("descrizione"), JsonPropertyName("descrizione")]
|
||||||
|
public string Descrizione { get; set; }
|
||||||
|
}
|
||||||
@@ -7,5 +7,7 @@ class IconConstants
|
|||||||
public const string Stato = "ri-list-check-3 fa-fw fa-chip";
|
public const string Stato = "ri-list-check-3 fa-fw fa-chip";
|
||||||
public const string User = "ri-user-fill fa-fw fa-chip";
|
public const string User = "ri-user-fill fa-fw fa-chip";
|
||||||
public const string Time = "ri-time-line fa-fw fa-chip";
|
public const string Time = "ri-time-line fa-fw fa-chip";
|
||||||
|
public const string FileTextLine = "ri-file-text-line fa-fw fa-chip";
|
||||||
|
public const string Tag = "ri-price-tag-3-fill fa-fw fa-chip";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Helpers;
|
namespace salesbook.Shared.Core.Helpers;
|
||||||
@@ -9,5 +10,23 @@ public class MappingProfile : Profile
|
|||||||
public MappingProfile()
|
public MappingProfile()
|
||||||
{
|
{
|
||||||
CreateMap<StbActivity, ActivityDTO>();
|
CreateMap<StbActivity, ActivityDTO>();
|
||||||
|
|
||||||
|
// Mapping da AnagClie a ContactDTO
|
||||||
|
CreateMap<AnagClie, ContactDTO>()
|
||||||
|
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodAnag))
|
||||||
|
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => true));
|
||||||
|
|
||||||
|
// Mapping da PtbPros a ContactDTO
|
||||||
|
CreateMap<PtbPros, ContactDTO>()
|
||||||
|
.ForMember(dest => dest.CodContact, opt => opt.MapFrom(src => src.CodPpro))
|
||||||
|
.ForMember(dest => dest.IsContact, opt => opt.MapFrom(src => false));
|
||||||
|
|
||||||
|
//Mapping da VtbCliePersRif a PersRifDTO
|
||||||
|
CreateMap<VtbCliePersRif, PersRifDTO>()
|
||||||
|
.ForMember(x => x.CodPersRif, y => y.MapFrom(z => z.CodAnag));
|
||||||
|
|
||||||
|
//Mapping da PtbProsRif a PersRifDTO
|
||||||
|
CreateMap<PtbProsRif, PersRifDTO>()
|
||||||
|
.ForMember(x => x.CodPersRif, y => y.MapFrom(z => z.CodPpro));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using MudBlazor;
|
using MudBlazor;
|
||||||
using salesbook.Shared.Components.SingleElements.Modal;
|
using salesbook.Shared.Components.SingleElements.Modal;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Helpers;
|
namespace salesbook.Shared.Core.Helpers;
|
||||||
|
|
||||||
@@ -25,4 +26,64 @@ public class ModalHelpers
|
|||||||
|
|
||||||
return await modal.Result;
|
return await modal.Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async Task<DialogResult?> OpenUserForm(IDialogService dialog, ContactDTO? anag)
|
||||||
|
{
|
||||||
|
var modal = await dialog.ShowAsync<ContactForm>(
|
||||||
|
"User form",
|
||||||
|
new DialogParameters<ContactForm>
|
||||||
|
{
|
||||||
|
{ x => x.OriginalModel, anag }
|
||||||
|
},
|
||||||
|
new DialogOptions
|
||||||
|
{
|
||||||
|
FullScreen = true,
|
||||||
|
CloseButton = false,
|
||||||
|
NoHeader = true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return await modal.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<DialogResult?> OpenPersRifForm(IDialogService dialog, PersRifDTO? persRif,
|
||||||
|
ContactDTO? contactModel = null, List<PersRifDTO>? persRifList = null)
|
||||||
|
{
|
||||||
|
var modal = await dialog.ShowAsync<PersRifForm>(
|
||||||
|
"Pers rif form",
|
||||||
|
new DialogParameters<PersRifForm>
|
||||||
|
{
|
||||||
|
{ x => x.OriginalModel, persRif },
|
||||||
|
{ x => x.ContactModel, contactModel},
|
||||||
|
{ x => x.PersRifList, persRifList }
|
||||||
|
},
|
||||||
|
new DialogOptions
|
||||||
|
{
|
||||||
|
FullScreen = true,
|
||||||
|
CloseButton = false,
|
||||||
|
NoHeader = true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return await modal.Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task<DialogResult?> OpenAddAttached(IDialogService dialog, bool canAddPosition)
|
||||||
|
{
|
||||||
|
var modal = await dialog.ShowAsync<AddAttached>(
|
||||||
|
"Add attached",
|
||||||
|
new DialogParameters<AddAttached>
|
||||||
|
{
|
||||||
|
{ x => x.CanAddPosition, canAddPosition}
|
||||||
|
},
|
||||||
|
new DialogOptions
|
||||||
|
{
|
||||||
|
FullScreen = false,
|
||||||
|
CloseButton = false,
|
||||||
|
NoHeader = true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return await modal.Result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
11
salesbook.Shared/Core/Interface/IAttachedService.cs
Normal file
11
salesbook.Shared/Core/Interface/IAttachedService.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
|
public interface IAttachedService
|
||||||
|
{
|
||||||
|
Task<AttachedDTO?> SelectImage();
|
||||||
|
Task<AttachedDTO?> SelectFile();
|
||||||
|
Task<AttachedDTO?> SelectPosition();
|
||||||
|
Task OpenFile(Stream file, string fileName);
|
||||||
|
}
|
||||||
@@ -1,17 +1,42 @@
|
|||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
using salesbook.Shared.Core.Dto.Contact;
|
||||||
|
using salesbook.Shared.Core.Dto.JobProgress;
|
||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Interface;
|
namespace salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
public interface IIntegryApiService
|
public interface IIntegryApiService
|
||||||
{
|
{
|
||||||
Task<List<StbActivity>?> RetrieveActivity(string? dateFilter = null);
|
Task<bool> SystemOk();
|
||||||
|
|
||||||
|
Task<List<StbActivity>?> RetrieveActivity(CRMRetrieveActivityRequestDTO activityRequest);
|
||||||
Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter = null);
|
Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter = null);
|
||||||
Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter = null);
|
Task<UsersSyncResponseDTO> RetrieveAnagClie(CRMAnagRequestDTO request);
|
||||||
Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter = null);
|
Task<UsersSyncResponseDTO> RetrieveProspect(CRMProspectRequestDTO request);
|
||||||
Task<SettingsResponseDTO> RetrieveSettings();
|
Task<SettingsResponseDTO> RetrieveSettings();
|
||||||
|
Task<List<CRMAttachedResponseDTO>?> RetrieveAttached(string codJcom);
|
||||||
|
|
||||||
Task DeleteActivity(string activityId);
|
Task DeleteActivity(string activityId);
|
||||||
|
|
||||||
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
Task<List<StbActivity>?> SaveActivity(ActivityDTO activity);
|
||||||
|
Task<CRMCreateContactResponseDTO?> SaveContact(CRMCreateContactRequestDTO request);
|
||||||
|
Task<CheckVatResponseDTO> CheckVat(CheckVatRequestDTO request);
|
||||||
|
Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request);
|
||||||
|
|
||||||
|
Task UploadFile(string id, byte[] file, string fileName);
|
||||||
|
Task<List<ActivityFileDto>> GetActivityFile(string activityId);
|
||||||
|
Task<Stream> DownloadFile(string activityId, string fileName);
|
||||||
|
Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName);
|
||||||
|
|
||||||
|
Task<CRMJobProgressResponseDTO> RetrieveJobProgress(string codJcom);
|
||||||
|
|
||||||
|
//Position
|
||||||
|
Task<PositionDTO> SavePosition(PositionDTO position);
|
||||||
|
Task<PositionDTO> RetrievePosition(string id);
|
||||||
|
|
||||||
|
//Google
|
||||||
|
Task<List<IndirizzoDTO>?> Geocode(string address);
|
||||||
|
Task<List<AutoCompleteAddressDTO>?> AutoCompleteAddress(string address, string language, string uuid);
|
||||||
|
Task<IndirizzoDTO?> PlaceDetails(string placeId, string uuid);
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,24 @@
|
|||||||
using System.Linq.Expressions;
|
using salesbook.Shared.Core.Dto;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
using salesbook.Shared.Core.Dto.Contact;
|
||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Interface;
|
namespace salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
public interface IManageDataService
|
public interface IManageDataService
|
||||||
{
|
{
|
||||||
Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new();
|
Task<List<T>> GetTable<T>(Expression<Func<T, bool>>? whereCond = null) where T : new();
|
||||||
Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
|
|
||||||
|
Task<List<AnagClie>> GetClienti(WhereCondContact? whereCond = null);
|
||||||
|
Task<List<PtbPros>> GetProspect(WhereCondContact? whereCond = null);
|
||||||
|
Task<List<ContactDTO>> GetContact(WhereCondContact whereCond);
|
||||||
|
Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact);
|
||||||
|
|
||||||
|
Task<List<ActivityDTO>> GetActivity(WhereCondActivity whereCond, bool useLocalDb = false);
|
||||||
|
|
||||||
Task InsertOrUpdate<T>(T objectToSave);
|
Task InsertOrUpdate<T>(T objectToSave);
|
||||||
|
Task InsertOrUpdate<T>(List<T> listToSave);
|
||||||
|
|
||||||
Task Delete<T>(T objectToDelete);
|
Task Delete<T>(T objectToDelete);
|
||||||
Task DeleteActivity(ActivityDTO activity);
|
Task DeleteActivity(ActivityDTO activity);
|
||||||
|
|||||||
@@ -2,5 +2,7 @@
|
|||||||
|
|
||||||
public interface INetworkService
|
public interface INetworkService
|
||||||
{
|
{
|
||||||
|
public bool ConnectionAvailable { get; set; }
|
||||||
|
|
||||||
public bool IsNetworkAvailable();
|
public bool IsNetworkAvailable();
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user