Compare commits
6 Commits
v1.1.0
...
8508820350
| Author | SHA1 | Date | |
|---|---|---|---|
| 8508820350 | |||
| 374b99501e | |||
| 8be3fa9f9e | |||
| 588dbe308a | |||
| 9957229e70 | |||
| cd88c79b32 |
@@ -57,9 +57,53 @@ public class AttachedService : IAttachedService
|
|||||||
Name = file.FileName,
|
Name = file.FileName,
|
||||||
Path = file.FullPath,
|
Path = file.FullPath,
|
||||||
MimeType = file.ContentType,
|
MimeType = file.ContentType,
|
||||||
DimensionBytes= ms.Length,
|
DimensionBytes = ms.Length,
|
||||||
FileContent = ms.ToArray(),
|
FileBytes = ms.ToArray(),
|
||||||
Type = type
|
Type = type
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static async Task<string?> SaveToTempStorage(Stream file, string fileName)
|
||||||
|
{
|
||||||
|
var cacheDirectory = FileSystem.CacheDirectory;
|
||||||
|
var targetDirectory = Path.Combine(cacheDirectory, "file");
|
||||||
|
|
||||||
|
if (!Directory.Exists(targetDirectory)) Directory.CreateDirectory(targetDirectory);
|
||||||
|
|
||||||
|
var tempFilePath = Path.Combine(targetDirectory, fileName + ".temp");
|
||||||
|
var filePath = Path.Combine(targetDirectory, fileName);
|
||||||
|
|
||||||
|
if (File.Exists(filePath)) return filePath;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await using var fileStream =
|
||||||
|
new FileStream(tempFilePath, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||||
|
await file.CopyToAsync(fileStream);
|
||||||
|
|
||||||
|
File.Move(tempFilePath, filePath);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Errore durante il salvataggio dello stream: {e.Message}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (File.Exists(tempFilePath)) File.Delete(tempFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task OpenFile(Stream file, string fileName)
|
||||||
|
{
|
||||||
|
var filePath = await SaveToTempStorage(file, fileName);
|
||||||
|
|
||||||
|
if (filePath is null) return;
|
||||||
|
await Launcher.OpenAsync(new OpenFileRequest
|
||||||
|
{
|
||||||
|
File = new ReadOnlyFile(filePath)
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,131 @@
|
|||||||
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<ContactDTO>> GetContact()
|
public async Task<List<AnagClie>> GetClienti(WhereCondContact? whereCond)
|
||||||
{
|
{
|
||||||
var contactList = await localDb.Get<AnagClie>(x => x.FlagStato.Equals("A"));
|
List<AnagClie> clienti = [];
|
||||||
var prospectList = await localDb.Get<PtbPros>();
|
whereCond ??= new WhereCondContact();
|
||||||
|
whereCond.OnlyContact = true;
|
||||||
|
|
||||||
|
if (networkService.IsNetworkAvailable())
|
||||||
|
{
|
||||||
|
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.IsNetworkAvailable())
|
||||||
|
{
|
||||||
|
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.IsNetworkAvailable())
|
||||||
|
{
|
||||||
|
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
|
// Mappa i contatti
|
||||||
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
var contactMapper = mapper.Map<List<ContactDTO>>(contactList);
|
||||||
@@ -46,9 +156,35 @@ public class ManageDataService(LocalDbService localDb, IMapper mapper) : IManage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
public async Task<List<ActivityDTO>> GetActivity(WhereCondActivity whereCond, bool useLocalDb)
|
||||||
{
|
{
|
||||||
var activities = await localDb.Get(whereCond);
|
List<StbActivity>? activities;
|
||||||
|
|
||||||
|
if (networkService.IsNetworkAvailable() && !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)
|
||||||
@@ -103,6 +239,36 @@ 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) =>
|
public Task InsertOrUpdate<T>(List<T> listToSave) =>
|
||||||
localDb.InsertOrUpdate(listToSave);
|
localDb.InsertOrUpdate(listToSave);
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ 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;
|
||||||
|
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;
|
||||||
@@ -57,6 +58,13 @@ namespace salesbook.Maui
|
|||||||
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>();
|
||||||
@@ -73,7 +81,6 @@ namespace salesbook.Maui
|
|||||||
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
builder.Services.AddSingleton<IFormFactor, FormFactor>();
|
||||||
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
builder.Services.AddSingleton<IAttachedService, AttachedService>();
|
||||||
builder.Services.AddSingleton<LocalDbService>();
|
builder.Services.AddSingleton<LocalDbService>();
|
||||||
builder.Services.AddSingleton<FilterUserDTO>();
|
|
||||||
|
|
||||||
return builder.Build();
|
return builder.Build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@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
|
||||||
@@ -67,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;
|
||||||
|
|||||||
@@ -1,10 +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.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
|
||||||
@@ -471,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();
|
||||||
@@ -541,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)
|
||||||
{
|
{
|
||||||
@@ -558,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)
|
||||||
{
|
{
|
||||||
@@ -583,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
170
salesbook.Shared/Components/Pages/Commessa.razor
Normal file
170
salesbook.Shared/Components/Pages/Commessa.razor
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
@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 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);
|
||||||
|
});
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
@attribute [Authorize]
|
@attribute [Authorize]
|
||||||
@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.Services
|
||||||
@inject IFormFactor FormFactor
|
@inject IFormFactor FormFactor
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
|
@inject PreloadService PreloadService
|
||||||
|
|
||||||
<SpinnerLayout FullScreen="true" />
|
<SpinnerLayout FullScreen="true" />
|
||||||
|
|
||||||
@@ -19,6 +21,15 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_ = StartSyncUser();
|
||||||
NavigationManager.NavigateTo("/Calendar");
|
NavigationManager.NavigateTo("/Calendar");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Task StartSyncUser()
|
||||||
|
{
|
||||||
|
return Task.Run(() =>
|
||||||
|
{
|
||||||
|
_ = PreloadService.PreloadUsersAsync();
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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); });
|
||||||
|
|||||||
@@ -7,12 +7,15 @@
|
|||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Core.Dto
|
@using salesbook.Shared.Core.Dto
|
||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
|
@using salesbook.Shared.Core.Dto.JobProgress
|
||||||
|
@using salesbook.Shared.Core.Dto.PageState
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject IMapper Mapper
|
@inject IMapper Mapper
|
||||||
@inject IDialogService Dialog
|
@inject IDialogService Dialog
|
||||||
@inject INetworkService NetworkService
|
@inject IIntegryApiService IntegryApiService
|
||||||
|
@inject UserPageState UserState
|
||||||
|
|
||||||
<HeaderLayout BackTo="Indietro" LabelSave="Modifica" OnSave="() => OpenUserForm(Anag)" 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)
|
||||||
{
|
{
|
||||||
@@ -89,11 +92,27 @@ else
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<MudTabs TabPanelClass="custom-tab-panel" Elevation="2" Rounded="true" PanelClass="pt-2" Centered="true">
|
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab1" checked>
|
||||||
<MudTabPanel Text="Contatti">
|
<input type="radio" class="tab-toggle" name="tab-toggle" id="tab2">
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<ul class="tab-list">
|
||||||
|
<li class="tab-item">
|
||||||
|
<label class="tab-trigger" for="tab1">Contatti</label>
|
||||||
|
</li>
|
||||||
|
<li class="tab-item">
|
||||||
|
<label class="tab-trigger" for="tab2">Commesse</label>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- contenuti -->
|
||||||
|
<div class="tab-container">
|
||||||
|
<div class="tab-content">
|
||||||
|
<!-- Contatti -->
|
||||||
@if (PersRif is { Count: > 0 })
|
@if (PersRif is { Count: > 0 })
|
||||||
{
|
{
|
||||||
<div style="margin-top: 1rem;" class="container-pers-rif">
|
<div class="container-pers-rif">
|
||||||
<Virtualize Items="PersRif" Context="person">
|
<Virtualize Items="PersRif" Context="person">
|
||||||
@{
|
@{
|
||||||
var index = PersRif.IndexOf(person);
|
var index = PersRif.IndexOf(person);
|
||||||
@@ -117,20 +136,30 @@ else
|
|||||||
Aggiungi contatto
|
Aggiungi contatto
|
||||||
</MudButton>
|
</MudButton>
|
||||||
</div>
|
</div>
|
||||||
</MudTabPanel>
|
</div>
|
||||||
<MudTabPanel Text="Commesse">
|
<div class="tab-content">
|
||||||
@if (Commesse.IsNullOrEmpty())
|
<!-- Commesse -->
|
||||||
|
@if (LoadCommessa)
|
||||||
{
|
{
|
||||||
<NoDataAvailable Text="Nessuna commessa presente"/>
|
<MudProgressLinear Color="Color.Primary" Indeterminate="true" Class="my-7"/>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<Virtualize Items="Commesse" Context="commessa">
|
@if (Commesse.IsNullOrEmpty())
|
||||||
<CommessaCard Commessa="commessa"/>
|
{
|
||||||
</Virtualize>
|
<NoDataAvailable Text="Nessuna commessa presente"/>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<div class="commesse-container">
|
||||||
|
<Virtualize Items="Commesse" Context="commessa">
|
||||||
|
<CommessaCard Steps="@Steps[commessa.CodJcom]" RagSoc="@Anag.RagSoc" Commessa="commessa"/>
|
||||||
|
</Virtualize>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</MudTabPanel>
|
</div>
|
||||||
</MudTabs>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,14 +169,26 @@ else
|
|||||||
|
|
||||||
private ContactDTO Anag { get; set; } = new();
|
private ContactDTO Anag { get; set; } = new();
|
||||||
private List<PersRifDTO>? PersRif { get; set; }
|
private List<PersRifDTO>? PersRif { get; set; }
|
||||||
private List<JtbComt> Commesse { get; set; }
|
private List<JtbComt>? Commesse { get; set; }
|
||||||
private StbUser? Agente { get; set; }
|
private StbUser? Agente { get; set; }
|
||||||
|
private Dictionary<string, List<CRMJobStepDTO>?> Steps { get; set; } = [];
|
||||||
|
|
||||||
private bool IsLoading { get; set; } = true;
|
private bool IsLoading { get; set; } = true;
|
||||||
|
private bool LoadCommessa { get; set; } = true;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
await LoadData();
|
if (UserState.CodUser != null && UserState.CodUser.Equals(CodContact))
|
||||||
|
{
|
||||||
|
LoadDataFromSession();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
IsLoading = false;
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task LoadData()
|
private async Task LoadData()
|
||||||
@@ -164,18 +205,64 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
await LoadPersRif();
|
await LoadPersRif();
|
||||||
|
_ = LoadCommesse();
|
||||||
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodContact));
|
|
||||||
|
|
||||||
if (Anag.CodVage != null)
|
if (Anag.CodVage != null)
|
||||||
{
|
{
|
||||||
Agente = (await ManageData.GetTable<StbUser>(x => x.UserCode != null && x.UserCode.Equals(Anag.CodVage))).LastOrDefault();
|
Agente = (await ManageData.GetTable<StbUser>(x => x.UserCode != null && x.UserCode.Equals(Anag.CodVage))).LastOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
IsLoading = false;
|
SetDataSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadDataFromSession()
|
||||||
|
{
|
||||||
|
Anag = UserState.Anag;
|
||||||
|
PersRif = UserState.PersRif;
|
||||||
|
Commesse = UserState.Commesse;
|
||||||
|
Agente = UserState.Agente;
|
||||||
|
Steps = UserState.Steps;
|
||||||
|
|
||||||
|
SortCommesse();
|
||||||
|
|
||||||
|
LoadCommessa = false;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetDataSession()
|
||||||
|
{
|
||||||
|
UserState.CodUser = CodContact;
|
||||||
|
UserState.Anag = Anag;
|
||||||
|
UserState.PersRif = PersRif;
|
||||||
|
UserState.Agente = Agente;
|
||||||
|
UserState.Steps = Steps;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadCommesse()
|
||||||
|
{
|
||||||
|
await Task.Run(async () =>
|
||||||
|
{
|
||||||
|
Commesse = await ManageData.GetTable<JtbComt>(x => x.CodAnag != null && x.CodAnag.Equals(CodContact));
|
||||||
|
UserState.Commesse = Commesse;
|
||||||
|
|
||||||
|
foreach (var commessa in Commesse)
|
||||||
|
{
|
||||||
|
var steps = (await IntegryApiService.RetrieveJobProgress(commessa.CodJcom)).Steps;
|
||||||
|
Steps.Add(commessa.CodJcom, steps);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadCommessa = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
SortCommesse();
|
||||||
|
StateHasChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SortCommesse()
|
||||||
|
{
|
||||||
|
Commesse = Commesse?.OrderBy(x => x.LastUpd.HasValue).ThenBy(x => x.LastUpd).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task LoadPersRif()
|
private async Task LoadPersRif()
|
||||||
{
|
{
|
||||||
if (IsContact)
|
if (IsContact)
|
||||||
|
|||||||
@@ -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 {
|
||||||
@@ -157,3 +158,120 @@
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.commesse-container {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.commesse-container ::deep > div:first-child:not(.activity-card) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*--------------
|
||||||
|
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% / 2);
|
||||||
|
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) {
|
||||||
|
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%); }
|
||||||
|
|
||||||
|
.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;
|
||||||
|
}
|
||||||
|
|
||||||
|
.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) { display: block; }
|
||||||
|
|
||||||
|
@keyframes fade {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
transform: translateY(5px);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,11 +6,15 @@
|
|||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
@using salesbook.Shared.Components.Layout.Spinner
|
@using salesbook.Shared.Components.Layout.Spinner
|
||||||
@using salesbook.Shared.Components.SingleElements
|
@using salesbook.Shared.Components.SingleElements
|
||||||
|
@using salesbook.Shared.Core.Dto.PageState
|
||||||
|
@using salesbook.Shared.Core.Dto.Users
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Core.Messages.Contact
|
@using salesbook.Shared.Core.Messages.Contact
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject NewContactService NewContact
|
@inject NewContactService NewContact
|
||||||
@inject FilterUserDTO Filter
|
@inject FilterUserDTO Filter
|
||||||
|
@inject UserListState UserState
|
||||||
|
@implements IDisposable
|
||||||
|
|
||||||
<HeaderLayout Title="Contatti"/>
|
<HeaderLayout Title="Contatti"/>
|
||||||
|
|
||||||
@@ -67,25 +71,47 @@
|
|||||||
private bool OpenFilter { get; set; }
|
private bool OpenFilter { get; set; }
|
||||||
private string TypeUser { get; set; } = "all";
|
private string TypeUser { get; set; } = "all";
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
NewContact.OnContactCreated += async response => await OnUserCreated(response);
|
IsLoading = true;
|
||||||
Console.WriteLine($"Filter HashCode: {Filter.GetHashCode()} - IsInitialized: {Filter.IsInitialized}");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
if (!UserState.IsLoaded)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
UserState.OnUsersLoaded += OnUsersLoaded;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
await LoadData();
|
await LoadData();
|
||||||
|
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()
|
||||||
{
|
{
|
||||||
IsLoading = true;
|
|
||||||
StateHasChanged();
|
|
||||||
|
|
||||||
if (!Filter.IsInitialized)
|
if (!Filter.IsInitialized)
|
||||||
{
|
{
|
||||||
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
var loggedUser = (await ManageData.GetTable<StbUser>(x => x.UserName.Equals(UserSession.User.Username))).Last();
|
||||||
@@ -95,50 +121,6 @@
|
|||||||
|
|
||||||
Filter.IsInitialized = true;
|
Filter.IsInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var users = await ManageData.GetContact();
|
|
||||||
|
|
||||||
var sortedUsers = users
|
|
||||||
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
|
||||||
.OrderBy(u =>
|
|
||||||
{
|
|
||||||
var firstChar = char.ToUpper(u.RagSoc[0]);
|
|
||||||
return char.IsLetter(firstChar) ? firstChar.ToString() : "ZZZ";
|
|
||||||
})
|
|
||||||
.ThenBy(u => u.RagSoc)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
GroupedUserList = [];
|
|
||||||
|
|
||||||
string? lastHeader = null;
|
|
||||||
foreach (var user in sortedUsers)
|
|
||||||
{
|
|
||||||
var 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();
|
|
||||||
|
|
||||||
IsLoading = false;
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private class UserDisplayItem
|
|
||||||
{
|
|
||||||
public required ContactDTO User { get; set; }
|
|
||||||
public bool ShowHeader { get; set; }
|
|
||||||
public string? HeaderLetter { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FilterUsers() => FilterUsers(false);
|
private void FilterUsers() => FilterUsers(false);
|
||||||
@@ -205,6 +187,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
FilteredGroupedUserList = result;
|
FilteredGroupedUserList = result;
|
||||||
|
|
||||||
|
IsLoading = false;
|
||||||
|
StateHasChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnUserCreated(CRMCreateContactResponseDTO response)
|
private async Task OnUserCreated(CRMCreateContactResponseDTO response)
|
||||||
|
|||||||
@@ -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,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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -1,24 +1,68 @@
|
|||||||
|
@using salesbook.Shared.Core.Dto.JobProgress
|
||||||
|
@using salesbook.Shared.Core.Dto.PageState
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
|
@inject JobSteps JobSteps
|
||||||
|
|
||||||
<div style="margin-top: 1rem;" class="activity-card">
|
<div @onclick="OpenPageCommessa" class="activity-card">
|
||||||
<div class="activity-left-section">
|
<div class="activity-left-section">
|
||||||
<div class="activity-body-section">
|
<div class="activity-body-section">
|
||||||
<div class="title-section">
|
<div class="title-section">
|
||||||
<MudText Class="activity-title" Typo="Typo.body1" HtmlTag="h3">@Commessa.Descrizione</MudText>
|
<MudText Class="activity-title" Typo="Typo.body1" HtmlTag="h3">@Commessa.CodJcom</MudText>
|
||||||
<div class="activity-hours-section">
|
<div class="activity-hours-section">
|
||||||
<span class="activity-hours">
|
@if (LastUpd is not null)
|
||||||
@Commessa.CodJcom
|
{
|
||||||
</span>
|
<span class="activity-hours">Aggiornato il @($"{LastUpd:d}")</span>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<span class="activity-title">@Commessa.Descrizione</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="activity-info-section">
|
<div class="activity-info-section">
|
||||||
<MudChip T="string" Icon="@IconConstants.Chip.User" Size="Size.Small">Stato</MudChip>
|
@if (Stato is not null)
|
||||||
|
{
|
||||||
|
<MudChip T="string" Variant="Variant.Outlined" Icon="@IconConstants.Chip.Stato" Size="Size.Small">@Stato</MudChip>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
[Parameter] public JtbComt Commessa { get; set; } = new();
|
[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}");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -28,8 +28,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.activity-hours {
|
.activity-hours {
|
||||||
font-weight: 700;
|
color: var(--mud-palette-gray-darker);
|
||||||
color: var(--mud-palette-text-primary);
|
font-weight: 600;
|
||||||
|
font-size: .8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
|
.activity-hours-section ::deep .mud-chip { margin: 5px 0 0 !important; }
|
||||||
@@ -40,13 +41,18 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-section ::deep > .activity-title {
|
.activity-title {
|
||||||
font-weight: 800 !important;
|
font-weight: 800 !important;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
line-height: normal !important;
|
line-height: normal !important;
|
||||||
color: var(--mud-palette-text-primary);
|
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 {
|
.activity-body-section ::deep > .activity-subtitle {
|
||||||
color: var(--mud-palette-gray-darker);
|
color: var(--mud-palette-gray-darker);
|
||||||
margin: .2rem 0 !important;
|
margin: .2rem 0 !important;
|
||||||
@@ -55,5 +61,7 @@
|
|||||||
|
|
||||||
.activity-info-section {
|
.activity-info-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-top: .25rem;
|
||||||
}
|
}
|
||||||
@@ -1,19 +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 Java.Util.Jar
|
|
||||||
@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 IDialogService Dialog
|
||||||
|
@inject IAttachedService AttachedService
|
||||||
|
|
||||||
<MudDialog Class="customDialog-form">
|
<MudDialog Class="customDialog-form">
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
@@ -126,13 +128,13 @@
|
|||||||
{
|
{
|
||||||
@if (item.p.Type == AttachedDTO.TypeAttached.Position)
|
@if (item.p.Type == AttachedDTO.TypeAttached.Position)
|
||||||
{
|
{
|
||||||
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success" OnClose="() => OnRemoveAttached(item.index)">
|
<MudChip T="string" Icon="@Icons.Material.Rounded.LocationOn" Color="Color.Success" OnClick="() => OpenPosition(item.p)" OnClose="() => OnRemoveAttached(item.index)">
|
||||||
@item.p.Description
|
@item.p.Description
|
||||||
</MudChip>
|
</MudChip>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<MudChip T="string" Color="Color.Default" OnClose="() => OnRemoveAttached(item.index)">
|
<MudChip T="string" Color="Color.Default" OnClick="() => OpenAttached(item.p)" OnClose="() => OnRemoveAttached(item.index)">
|
||||||
@item.p.Name
|
@item.p.Name
|
||||||
</MudChip>
|
</MudChip>
|
||||||
}
|
}
|
||||||
@@ -143,7 +145,7 @@
|
|||||||
{
|
{
|
||||||
foreach (var file in ActivityFileList)
|
foreach (var file in ActivityFileList)
|
||||||
{
|
{
|
||||||
<MudChip T="string" Color="Color.Default">
|
<MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" Color="Color.Default">
|
||||||
@file.FileName
|
@file.FileName
|
||||||
</MudChip>
|
</MudChip>
|
||||||
}
|
}
|
||||||
@@ -279,7 +281,7 @@
|
|||||||
LabelSave = IsNew ? "Aggiungi" : null;
|
LabelSave = IsNew ? "Aggiungi" : null;
|
||||||
|
|
||||||
if (!Id.IsNullOrEmpty())
|
if (!Id.IsNullOrEmpty())
|
||||||
ActivityModel = (await ManageData.GetActivity(x => x.ActivityId.Equals(Id))).Last();
|
ActivityModel = (await ManageData.GetActivity(new WhereCondActivity { ActivityId = Id }, true)).Last();
|
||||||
|
|
||||||
if (ActivityCopied != null)
|
if (ActivityCopied != null)
|
||||||
{
|
{
|
||||||
@@ -316,7 +318,7 @@
|
|||||||
|
|
||||||
await ManageData.InsertOrUpdate(newActivity);
|
await ManageData.InsertOrUpdate(newActivity);
|
||||||
|
|
||||||
await SaveAttached(newActivity.ActivityId);
|
await SaveAttached(newActivity.ActivityId!);
|
||||||
|
|
||||||
SuccessAnimation = true;
|
SuccessAnimation = true;
|
||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
@@ -354,7 +356,7 @@
|
|||||||
{
|
{
|
||||||
if (attached.FileContent is not null && attached.Type != AttachedDTO.TypeAttached.Position)
|
if (attached.FileContent is not null && attached.Type != AttachedDTO.TypeAttached.Position)
|
||||||
{
|
{
|
||||||
await IntegryApiService.UploadFile(activityId, attached.FileContent, attached.Name);
|
await IntegryApiService.UploadFile(activityId, attached.FileBytes, attached.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,8 +381,8 @@
|
|||||||
|
|
||||||
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"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,7 +520,7 @@
|
|||||||
|
|
||||||
if (resultNamePosition is true)
|
if (resultNamePosition is true)
|
||||||
attached.Description = NamePosition;
|
attached.Description = NamePosition;
|
||||||
attached.Name = NamePosition!;
|
attached.Name = NamePosition!;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttachedList ??= [];
|
AttachedList ??= [];
|
||||||
@@ -542,4 +544,51 @@
|
|||||||
StateHasChanged();
|
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(",", ".");
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
@using salesbook.Shared.Components.Layout.Overlay
|
@using salesbook.Shared.Components.Layout.Overlay
|
||||||
@using salesbook.Shared.Core.Entity
|
@using salesbook.Shared.Core.Entity
|
||||||
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
@using salesbook.Shared.Components.SingleElements.BottomSheet
|
||||||
|
@using salesbook.Shared.Core.Dto.Contact
|
||||||
@inject IManageDataService ManageData
|
@inject IManageDataService ManageData
|
||||||
@inject INetworkService NetworkService
|
@inject INetworkService NetworkService
|
||||||
@inject IIntegryApiService IntegryApiService
|
@inject IIntegryApiService IntegryApiService
|
||||||
@@ -473,11 +474,11 @@
|
|||||||
|
|
||||||
var pIva = ContactModel.PartIva.Trim();
|
var pIva = ContactModel.PartIva.Trim();
|
||||||
|
|
||||||
var clie = (await ManageData.GetTable<AnagClie>(x => x.PartIva.Equals(pIva))).LastOrDefault();
|
var clie = (await ManageData.GetClienti(new WhereCondContact {PartIva = pIva})).LastOrDefault();
|
||||||
|
|
||||||
if (clie == null)
|
if (clie == null)
|
||||||
{
|
{
|
||||||
var pros = (await ManageData.GetTable<PtbPros>(x => x.PartIva.Equals(pIva))).LastOrDefault();
|
var pros = (await ManageData.GetProspect(new WhereCondContact {PartIva = pIva})).LastOrDefault();
|
||||||
|
|
||||||
if (pros == null)
|
if (pros == null)
|
||||||
{
|
{
|
||||||
@@ -559,6 +560,9 @@
|
|||||||
|
|
||||||
private async Task ConvertProspectToContact()
|
private async Task ConvertProspectToContact()
|
||||||
{
|
{
|
||||||
|
await IntegryApiService.TransferProspect(new CRMTransferProspectRequestDTO
|
||||||
|
{
|
||||||
|
CodPpro = ContactModel.CodContact
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
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("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; }
|
||||||
|
}
|
||||||
@@ -8,7 +8,11 @@ public class AttachedDTO
|
|||||||
public string? MimeType { get; set; }
|
public string? MimeType { get; set; }
|
||||||
public long? DimensionBytes { get; set; }
|
public long? DimensionBytes { get; set; }
|
||||||
public string? Path { get; set; }
|
public string? Path { get; set; }
|
||||||
public byte[]? FileContent { get; set; }
|
|
||||||
|
public byte[]? FileBytes { get; set; }
|
||||||
|
|
||||||
|
public Stream? FileContent =>
|
||||||
|
FileBytes is null ? null : new MemoryStream(FileBytes);
|
||||||
|
|
||||||
public double? Lat { get; set; }
|
public double? Lat { get; set; }
|
||||||
public double? Lng { get; set; }
|
public double? Lng { 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; }
|
||||||
|
}
|
||||||
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; }
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
15
salesbook.Shared/Core/Dto/PageState/UserPageState.cs
Normal file
15
salesbook.Shared/Core/Dto/PageState/UserPageState.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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; }
|
||||||
|
}
|
||||||
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; }
|
||||||
@@ -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; }
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ public interface IAttachedService
|
|||||||
Task<AttachedDTO?> SelectImage();
|
Task<AttachedDTO?> SelectImage();
|
||||||
Task<AttachedDTO?> SelectFile();
|
Task<AttachedDTO?> SelectFile();
|
||||||
Task<AttachedDTO?> SelectPosition();
|
Task<AttachedDTO?> SelectPosition();
|
||||||
|
Task OpenFile(Stream file, string fileName);
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,19 @@
|
|||||||
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<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);
|
||||||
|
|
||||||
@@ -21,6 +25,9 @@ public interface IIntegryApiService
|
|||||||
Task UploadFile(string id, byte[] file, string fileName);
|
Task UploadFile(string id, byte[] file, string fileName);
|
||||||
Task<List<ActivityFileDto>> GetActivityFile(string activityId);
|
Task<List<ActivityFileDto>> GetActivityFile(string activityId);
|
||||||
Task<Stream> DownloadFile(string activityId, string fileName);
|
Task<Stream> DownloadFile(string activityId, string fileName);
|
||||||
|
Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName);
|
||||||
|
|
||||||
|
Task<CRMJobProgressResponseDTO> RetrieveJobProgress(string codJcom);
|
||||||
|
|
||||||
//Position
|
//Position
|
||||||
Task<PositionDTO> SavePosition(PositionDTO position);
|
Task<PositionDTO> SavePosition(PositionDTO position);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -8,10 +10,13 @@ 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<ContactDTO>> GetContact();
|
Task<List<PtbPros>> GetProspect(WhereCondContact? whereCond = null);
|
||||||
|
Task<List<ContactDTO>> GetContact(WhereCondContact whereCond);
|
||||||
Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact);
|
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 InsertOrUpdate<T>(List<T> listToSave);
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
public interface ISyncDbService
|
public interface ISyncDbService
|
||||||
{
|
{
|
||||||
Task GetAndSaveActivity(string? dateFilter = null);
|
|
||||||
Task GetAndSaveCommesse(string? dateFilter = null);
|
Task GetAndSaveCommesse(string? dateFilter = null);
|
||||||
Task GetAndSaveProspect(string? dateFilter = null);
|
|
||||||
Task GetAndSaveClienti(string? dateFilter = null);
|
|
||||||
Task GetAndSaveSettings(string? dateFilter = null);
|
Task GetAndSaveSettings(string? dateFilter = null);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Messages.Activity.Copy;
|
namespace salesbook.Shared.Core.Messages.Activity.Copy;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using CommunityToolkit.Mvvm.Messaging;
|
using CommunityToolkit.Mvvm.Messaging;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Messages.Activity.Copy;
|
namespace salesbook.Shared.Core.Messages.Activity.Copy;
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,20 @@
|
|||||||
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
using IntegryApiClient.Core.Domain.Abstraction.Contracts.Account;
|
||||||
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
using IntegryApiClient.Core.Domain.RestClient.Contacts;
|
||||||
using salesbook.Shared.Core.Dto;
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Dto.Activity;
|
||||||
|
using salesbook.Shared.Core.Dto.JobProgress;
|
||||||
using salesbook.Shared.Core.Entity;
|
using salesbook.Shared.Core.Entity;
|
||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
using System.Net.Http.Headers;
|
using System.Net.Http.Headers;
|
||||||
|
using salesbook.Shared.Core.Dto.Contact;
|
||||||
|
|
||||||
namespace salesbook.Shared.Core.Services;
|
namespace salesbook.Shared.Core.Services;
|
||||||
|
|
||||||
public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession)
|
public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession)
|
||||||
: IIntegryApiService
|
: IIntegryApiService
|
||||||
{
|
{
|
||||||
public Task<List<StbActivity>?> RetrieveActivity(string? dateFilter)
|
public Task<List<StbActivity>?> RetrieveActivity(CRMRetrieveActivityRequestDTO activityRequest) =>
|
||||||
{
|
integryApiRestClient.AuthorizedPost<List<StbActivity>?>("crm/retrieveActivity", activityRequest);
|
||||||
var queryParams = new Dictionary<string, object> { { "dateFilter", dateFilter ?? "2020-01-01" } };
|
|
||||||
|
|
||||||
return integryApiRestClient.AuthorizedGet<List<StbActivity>?>("crm/retrieveActivity", queryParams);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter)
|
public Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter)
|
||||||
{
|
{
|
||||||
@@ -29,33 +28,26 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
|||||||
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("crm/retrieveCommesse", queryParams);
|
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("crm/retrieveCommesse", queryParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter)
|
public Task<UsersSyncResponseDTO> RetrieveAnagClie(CRMAnagRequestDTO request) =>
|
||||||
{
|
integryApiRestClient.AuthorizedPost<UsersSyncResponseDTO>("crm/retrieveClienti", request)!;
|
||||||
var queryParams = new Dictionary<string, object>();
|
|
||||||
|
|
||||||
if (dateFilter != null)
|
public Task<UsersSyncResponseDTO> RetrieveProspect(CRMProspectRequestDTO request) =>
|
||||||
{
|
integryApiRestClient.AuthorizedPost<UsersSyncResponseDTO>("crm/retrieveProspect", request)!;
|
||||||
queryParams.Add("dateFilter", dateFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveClienti", queryParams)!;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter)
|
|
||||||
{
|
|
||||||
var queryParams = new Dictionary<string, object>();
|
|
||||||
|
|
||||||
if (dateFilter != null)
|
|
||||||
{
|
|
||||||
queryParams.Add("dateFilter", dateFilter);
|
|
||||||
}
|
|
||||||
|
|
||||||
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveProspect", queryParams)!;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<SettingsResponseDTO> RetrieveSettings() =>
|
public Task<SettingsResponseDTO> RetrieveSettings() =>
|
||||||
integryApiRestClient.AuthorizedGet<SettingsResponseDTO>("crm/retrieveSettings")!;
|
integryApiRestClient.AuthorizedGet<SettingsResponseDTO>("crm/retrieveSettings")!;
|
||||||
|
|
||||||
|
public Task<List<CRMAttachedResponseDTO>?> RetrieveAttached(string codJcom)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ "codJcom", codJcom }
|
||||||
|
};
|
||||||
|
|
||||||
|
return integryApiRestClient.AuthorizedGet<List<CRMAttachedResponseDTO>?>("crm/retrieveAttachedForCodJcom",
|
||||||
|
queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
public Task DeleteActivity(string activityId)
|
public Task DeleteActivity(string activityId)
|
||||||
{
|
{
|
||||||
var queryParams = new Dictionary<string, object>
|
var queryParams = new Dictionary<string, object>
|
||||||
@@ -137,6 +129,17 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
|||||||
public Task<Stream> DownloadFile(string activityId, string fileName) =>
|
public Task<Stream> DownloadFile(string activityId, string fileName) =>
|
||||||
integryApiRestClient.Download($"downloadStbFileAttachment/{activityId}/{fileName}")!;
|
integryApiRestClient.Download($"downloadStbFileAttachment/{activityId}/{fileName}")!;
|
||||||
|
|
||||||
|
public Task<Stream> DownloadFileFromRefUuid(string refUuid, string fileName)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{ "refUuid", refUuid },
|
||||||
|
{ "fileName", fileName }
|
||||||
|
};
|
||||||
|
|
||||||
|
return integryApiRestClient.Download("downloadFileFromRefUuid", queryParams);
|
||||||
|
}
|
||||||
|
|
||||||
public Task<PositionDTO> SavePosition(PositionDTO position) =>
|
public Task<PositionDTO> SavePosition(PositionDTO position) =>
|
||||||
integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
|
integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
|
||||||
|
|
||||||
@@ -146,4 +149,11 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
|
|||||||
|
|
||||||
return integryApiRestClient.Get<PositionDTO>("retrievePosition", queryParams)!;
|
return integryApiRestClient.Get<PositionDTO>("retrievePosition", queryParams)!;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<CRMJobProgressResponseDTO> RetrieveJobProgress(string codJcom)
|
||||||
|
{
|
||||||
|
var queryParams = new Dictionary<string, object> { { "codJcom", codJcom } };
|
||||||
|
|
||||||
|
return integryApiRestClient.Get<CRMJobProgressResponseDTO>("crm/retrieveJobProgress", queryParams)!;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
55
salesbook.Shared/Core/Services/PreloadService.cs
Normal file
55
salesbook.Shared/Core/Services/PreloadService.cs
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
using salesbook.Shared.Core.Dto;
|
||||||
|
using salesbook.Shared.Core.Dto.Contact;
|
||||||
|
using salesbook.Shared.Core.Dto.PageState;
|
||||||
|
using salesbook.Shared.Core.Dto.Users;
|
||||||
|
using salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
|
namespace salesbook.Shared.Core.Services;
|
||||||
|
|
||||||
|
public class PreloadService(IManageDataService manageData, UserListState userState)
|
||||||
|
{
|
||||||
|
public async Task PreloadUsersAsync()
|
||||||
|
{
|
||||||
|
if (userState.IsLoaded || userState.IsLoading)
|
||||||
|
return;
|
||||||
|
|
||||||
|
userState.IsLoading = true;
|
||||||
|
|
||||||
|
var users = await manageData.GetContact(new WhereCondContact { FlagStato = "A" });
|
||||||
|
|
||||||
|
var sorted = users
|
||||||
|
.Where(u => !string.IsNullOrWhiteSpace(u.RagSoc))
|
||||||
|
.OrderBy(u => char.IsLetter(char.ToUpper(u.RagSoc[0])) ? char.ToUpper(u.RagSoc[0]).ToString() : "ZZZ")
|
||||||
|
.ThenBy(u => u.RagSoc)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
userState.GroupedUserList = BuildGroupedList(sorted);
|
||||||
|
userState.FilteredGroupedUserList = userState.GroupedUserList;
|
||||||
|
|
||||||
|
userState.NotifyUsersLoaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<UserDisplayItem> BuildGroupedList(List<ContactDTO> users)
|
||||||
|
{
|
||||||
|
var grouped = new List<UserDisplayItem>();
|
||||||
|
string? lastHeader = null;
|
||||||
|
|
||||||
|
foreach (var user in users)
|
||||||
|
{
|
||||||
|
var firstChar = char.ToUpper(user.RagSoc[0]);
|
||||||
|
var currentLetter = char.IsLetter(firstChar) ? firstChar.ToString() : "#";
|
||||||
|
|
||||||
|
var showHeader = currentLetter != lastHeader;
|
||||||
|
lastHeader = currentLetter;
|
||||||
|
|
||||||
|
grouped.Add(new UserDisplayItem
|
||||||
|
{
|
||||||
|
User = user,
|
||||||
|
ShowHeader = showHeader,
|
||||||
|
HeaderLetter = currentLetter
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return grouped;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,11 +31,11 @@ a, .btn-link {
|
|||||||
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; }
|
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus { box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb; }
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
/*padding-top: 1.1rem;*/
|
padding-top: 1rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 84vh;
|
height: 90vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1:focus { outline: none; }
|
h1:focus { outline: none; }
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Linq.Expressions;
|
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.Interface;
|
using salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
@@ -12,17 +14,27 @@ public class ManageDataService : IManageDataService
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<ActivityDTO>> GetActivity(Expression<Func<StbActivity, bool>>? whereCond = null)
|
public Task<List<AnagClie>> GetClienti(WhereCondContact? whereCond)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<List<ContactDTO>> GetContact()
|
public Task<List<PtbPros>> GetProspect(WhereCondContact? whereCond)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ContactDTO> GetSpecificContact(string codAnag, bool IsContact)
|
public Task<List<ContactDTO>> GetContact(WhereCondContact whereCond)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<ContactDTO?> GetSpecificContact(string codAnag, bool IsContact)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<List<ActivityDTO>> GetActivity(WhereCondActivity whereCond, bool useLocalDb = false)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
using salesbook.Shared.Core.Interface;
|
using salesbook.Shared.Core.Entity;
|
||||||
|
using salesbook.Shared.Core.Interface;
|
||||||
|
|
||||||
namespace salesbook.Web.Core.Services;
|
namespace salesbook.Web.Core.Services;
|
||||||
|
|
||||||
public class SyncDbService : ISyncDbService
|
public class SyncDbService : ISyncDbService
|
||||||
{
|
{
|
||||||
public Task GetAndSaveActivity(string? dateFilter = null)
|
public Task GetAndSaveActivity(List<StbActivity>? allActivity)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user