7 Commits

Author SHA1 Message Date
11e7b04a88 Finish v2.0.3(10) 2025-10-15 10:33:10 +02:00
27588097a3 -> v2.0.3 (10) 2025-10-15 10:33:04 +02:00
934258d422 Fix sync 2025-10-15 10:32:24 +02:00
c3e646403b Aggiunta possibilità di rimozione allegati 2025-10-15 09:57:01 +02:00
effdc317c2 Fix date 2025-10-13 15:14:02 +02:00
9f95bb23e6 Fix vari 2025-10-03 16:32:16 +02:00
5016b3ed8d Finish v2.0.2(9) 2025-10-03 00:02:13 +02:00
12 changed files with 122 additions and 66 deletions

View File

@@ -179,9 +179,9 @@ public class ManageDataService(
activities = await localDb.Get<StbActivity>(x => activities = await localDb.Get<StbActivity>(x =>
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) || (whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null && (whereCond.Start != null && whereCond.End != null && x.EffectiveTime == null &&
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) || x.EstimatedTime >= whereCond.Start && x.EstimatedTime <= whereCond.End) ||
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) || (x.EffectiveTime >= whereCond.Start && x.EffectiveTime <= whereCond.End) ||
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null)) (whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
); );
@@ -223,9 +223,9 @@ public class ManageDataService(
{ {
activities = await localDb.Get<StbActivity>(x => activities = await localDb.Get<StbActivity>(x =>
(whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) || (whereCond.ActivityId != null && x.ActivityId != null && whereCond.ActivityId.Equals(x.ActivityId)) ||
(whereCond.Start != null && whereCond.End != null && x.EffectiveDate == null && (whereCond.Start != null && whereCond.End != null && x.EffectiveTime == null &&
x.EstimatedDate >= whereCond.Start && x.EstimatedDate <= whereCond.End) || x.EstimatedTime >= whereCond.Start && x.EstimatedTime <= whereCond.End) ||
(x.EffectiveDate >= whereCond.Start && x.EffectiveDate <= whereCond.End) || (x.EffectiveTime >= whereCond.Start && x.EffectiveTime <= whereCond.End) ||
(whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null)) (whereCond.ActivityId == null && (whereCond.Start == null || whereCond.End == null))
); );
} }
@@ -308,6 +308,8 @@ public class ManageDataService(
private Task UpdateDbUsers(UsersSyncResponseDTO response) private Task UpdateDbUsers(UsersSyncResponseDTO response)
{ {
return Task.Run(async () => return Task.Run(async () =>
{
try
{ {
if (response.AnagClie != null) if (response.AnagClie != null)
{ {
@@ -323,6 +325,13 @@ public class ManageDataService(
if (response.PtbProsRif != null) await localDb.InsertOrUpdate(response.PtbProsRif); if (response.PtbProsRif != null) await localDb.InsertOrUpdate(response.PtbProsRif);
} }
}
catch (Exception e)
{
Console.WriteLine(e.Message);
SentrySdk.CaptureException(e);
throw;
}
}); });
} }

View File

@@ -29,8 +29,8 @@
<ApplicationId>it.integry.salesbook</ApplicationId> <ApplicationId>it.integry.salesbook</ApplicationId>
<!-- Versions --> <!-- Versions -->
<ApplicationDisplayVersion>2.0.2</ApplicationDisplayVersion> <ApplicationDisplayVersion>2.0.3</ApplicationDisplayVersion>
<ApplicationVersion>9</ApplicationVersion> <ApplicationVersion>10</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion> <SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'"> <!--<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">

View File

@@ -181,7 +181,7 @@
private string _headerTitle = string.Empty; private string _headerTitle = string.Empty;
private readonly Dictionary<DateTime, List<ActivityDTO>> _eventsCache = new(); private readonly Dictionary<DateTime, List<ActivityDTO>> _eventsCache = new();
private readonly Dictionary<DateTime, CategoryData[]> _categoriesCache = new(); private readonly Dictionary<DateTime, CategoryData[]> _categoriesCache = new();
private bool _isInitialized = false; private bool _isInitialized;
// Stato UI // Stato UI
private bool Expanded { get; set; } private bool Expanded { get; set; }
@@ -278,7 +278,7 @@
// Raggruppa le attività per data // Raggruppa le attività per data
var activitiesByDate = MonthActivities var activitiesByDate = MonthActivities
.GroupBy(x => (x.EffectiveDate ?? x.EstimatedDate!).Value.Date) .GroupBy(x => (x.EffectiveTime ?? x.EstimatedTime!).Value.Date)
.ToDictionary(g => g.Key, g => g.ToList()); .ToDictionary(g => g.Key, g => g.ToList());
foreach (var (date, activities) in activitiesByDate) foreach (var (date, activities) in activitiesByDate)
@@ -482,7 +482,7 @@
var start = CurrentMonth; var start = CurrentMonth;
var end = start.AddDays(DaysInMonth - 1); var end = start.AddDays(DaysInMonth - 1);
var activities = await ManageData.GetActivity(new WhereCondActivity{Start = start, End = end}); var activities = await ManageData.GetActivity(new WhereCondActivity{Start = start, End = end});
MonthActivities = activities.OrderBy(x => x.EffectiveDate ?? x.EstimatedDate).ToList(); MonthActivities = activities.OrderBy(x => x.EffectiveTime ?? x.EstimatedTime).ToList();
PrepareRenderingData(); PrepareRenderingData();
IsLoading = false; IsLoading = false;
@@ -574,7 +574,7 @@
return; return;
} }
var date = activity.EffectiveDate ?? activity.EstimatedDate; var date = activity.EffectiveTime ?? activity.EstimatedTime;
if (CurrentMonth.Month != date!.Value.Month) if (CurrentMonth.Month != date!.Value.Month)
{ {

View File

@@ -85,21 +85,21 @@
FullWidth="true" FullWidth="true"
StartIcon="@Icons.Material.Outlined.Sync" StartIcon="@Icons.Material.Outlined.Sync"
Size="Size.Medium" Size="Size.Medium"
OnClick="() => UpdateDb(true)" OnClick="() => UpdateDb()"
Variant="Variant.Outlined"> Variant="Variant.Outlined">
Sincronizza Sincronizza
</MudButton> </MudButton>
<div class="divider"></div> @* <div class="divider"></div> *@
<MudButton Class="button-settings red-icon" @* <MudButton Class="button-settings red-icon"
FullWidth="true" FullWidth="true"
StartIcon="@Icons.Material.Outlined.Sync" StartIcon="@Icons.Material.Outlined.Sync"
Size="Size.Medium" Size="Size.Medium"
OnClick="() => UpdateDb()" OnClick="() => UpdateDb()"
Variant="Variant.Outlined"> Variant="Variant.Outlined">
Ripristina dati Ripristina dati
</MudButton> </MudButton> *@
</div> </div>
<div class="container-button"> <div class="container-button">

View File

@@ -425,7 +425,7 @@ else
set set
{ {
_filteredActivity = value; _filteredActivity = value;
StateHasChanged(); InvokeAsync(StateHasChanged);
} }
} }

View File

@@ -183,7 +183,7 @@
{ {
foreach (var file in ActivityFileList) foreach (var file in ActivityFileList)
{ {
<MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" Color="Color.Default"> <MudChip T="string" OnClick="() => OpenAttached(file.Id, file.FileName)" OnClose="() => DeleteAttach(file)" Color="Color.Default">
@file.FileName @file.FileName
</MudChip> </MudChip>
} }
@@ -400,7 +400,25 @@
SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName)); SelectedUser = Users.FindLast(x => x.UserName.Equals(ActivityModel.UserName));
if (!IsNew && Id != null) if (!IsNew && Id != null)
{
ActivityFileList = await IntegryApiService.GetActivityFile(Id); ActivityFileList = await IntegryApiService.GetActivityFile(Id);
if (ActivityModel.IdPosizione != null)
{
ActivityModel.Position = await IntegryApiService.RetrievePosition(ActivityModel.IdPosizione.Value);
CanAddPosition = false;
AttachedList ??= [];
AttachedList.Add(
new AttachedDTO
{
Name = ActivityModel.Position.Description!,
Lat = ActivityModel.Position.Lat,
Lng = ActivityModel.Position.Lng,
Type = AttachedDTO.TypeAttached.Position
}
);
}
}
ActivityResult = await ManageData.GetTable<StbActivityResult>(); ActivityResult = await ManageData.GetTable<StbActivityResult>();
Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" }); Clienti = await ManageData.GetClienti(new WhereCondContact { FlagStato = "A" });
@@ -682,6 +700,33 @@
} }
} }
private async Task DeleteAttach(ActivityFileDto file)
{
Snackbar.Clear();
if (ActivityFileList == null) return;
try
{
ActivityFileList.Remove(file);
StateHasChanged();
await IntegryApiService.DeleteFile(ActivityModel.ActivityId!, file.FileName);
}
catch (Exception ex)
{
ActivityFileList.Add(file);
StateHasChanged();
Snackbar.Add("Impossibile eliminare il file", Severity.Error);
Console.WriteLine($"Impossibile eliminare il file: {ex.Message}");
}
finally
{
Snackbar.Add($"{file.FileName} eliminato con successo", Severity.Info);
}
}
private async Task OpenAttached(AttachedDTO attached) private async Task OpenAttached(AttachedDTO attached)
{ {
if (attached is { FileContent: not null, MimeType: not null }) if (attached is { FileContent: not null, MimeType: not null })

View File

@@ -150,6 +150,8 @@
} }
private void OnNewName() private void OnNewName()
{
if (Attached != null)
{ {
switch (Attached.Type) switch (Attached.Type)
{ {
@@ -174,6 +176,7 @@
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
}
MudDialog.Close(Attached); MudDialog.Close(Attached);
} }

View File

@@ -34,7 +34,7 @@ public class ActivityDTO : StbActivity
MinuteBefore == other.MinuteBefore && MinuteBefore == other.MinuteBefore &&
NotificationDate == other.NotificationDate && NotificationDate == other.NotificationDate &&
Category == other.Category && Category == other.Category &&
Complete == other.Complete && ActivityId == other.ActivityId && ActivityResultId == other.ActivityResultId && ActivityTypeId == other.ActivityTypeId && DataInsAct.Equals(other.DataInsAct) && ActivityDescription == other.ActivityDescription && ParentActivityId == other.ParentActivityId && TipoAnag == other.TipoAnag && CodAnag == other.CodAnag && CodJcom == other.CodJcom && CodJfas == other.CodJfas && Nullable.Equals(EstimatedDate, other.EstimatedDate) && Nullable.Equals(EstimatedTime, other.EstimatedTime) && Nullable.Equals(AlarmDate, other.AlarmDate) && Nullable.Equals(AlarmTime, other.AlarmTime) && Nullable.Equals(EffectiveDate, other.EffectiveDate) && Nullable.Equals(EffectiveTime, other.EffectiveTime) && ResultDescription == other.ResultDescription && Nullable.Equals(EstimatedEnddate, other.EstimatedEnddate) && Nullable.Equals(EstimatedEndtime, other.EstimatedEndtime) && Nullable.Equals(EffectiveEnddate, other.EffectiveEnddate) && Nullable.Equals(EffectiveEndtime, other.EffectiveEndtime) && UserCreator == other.UserCreator && UserName == other.UserName && Nullable.Equals(PercComp, other.PercComp) && Nullable.Equals(EstimatedHours, other.EstimatedHours) && CodMart == other.CodMart && PartitaMag == other.PartitaMag && Matricola == other.Matricola && Priorita == other.Priorita && Nullable.Equals(ActivityPlayCounter, other.ActivityPlayCounter) && ActivityEvent == other.ActivityEvent && Guarantee == other.Guarantee && Note == other.Note && Rfid == other.Rfid && IdLotto == other.IdLotto && PersonaRif == other.PersonaRif && HrNum == other.HrNum && Gestione == other.Gestione && Nullable.Equals(DataOrd, other.DataOrd) && NumOrd == other.NumOrd && IdStep == other.IdStep && IdRiga == other.IdRiga && Nullable.Equals(OraInsAct, other.OraInsAct) && IndiceGradimento == other.IndiceGradimento && NoteGradimento == other.NoteGradimento && FlagRisolto == other.FlagRisolto && FlagTipologia == other.FlagTipologia && OreRapportino == other.OreRapportino && UserModifier == other.UserModifier && Nullable.Equals(OraModAct, other.OraModAct) && Nullable.Equals(OraViewAct, other.OraViewAct) && CodVdes == other.CodVdes && CodCmac == other.CodCmac && WrikeId == other.WrikeId && CodMgrp == other.CodMgrp && PlanId == other.PlanId; Complete == other.Complete && ActivityId == other.ActivityId && ActivityResultId == other.ActivityResultId && ActivityTypeId == other.ActivityTypeId && DataInsAct.Equals(other.DataInsAct) && ActivityDescription == other.ActivityDescription && ParentActivityId == other.ParentActivityId && TipoAnag == other.TipoAnag && CodAnag == other.CodAnag && CodJcom == other.CodJcom && CodJfas == other.CodJfas && Nullable.Equals(EstimatedTime, other.EstimatedTime) && Nullable.Equals(AlarmDate, other.AlarmDate) && Nullable.Equals(AlarmTime, other.AlarmTime) && Nullable.Equals(EffectiveTime, other.EffectiveTime) && ResultDescription == other.ResultDescription && Nullable.Equals(EstimatedEndtime, other.EstimatedEndtime) && Nullable.Equals(EffectiveEndtime, other.EffectiveEndtime) && UserCreator == other.UserCreator && UserName == other.UserName && Nullable.Equals(PercComp, other.PercComp) && Nullable.Equals(EstimatedHours, other.EstimatedHours) && CodMart == other.CodMart && PartitaMag == other.PartitaMag && Matricola == other.Matricola && Priorita == other.Priorita && Nullable.Equals(ActivityPlayCounter, other.ActivityPlayCounter) && ActivityEvent == other.ActivityEvent && Guarantee == other.Guarantee && Note == other.Note && Rfid == other.Rfid && IdLotto == other.IdLotto && PersonaRif == other.PersonaRif && HrNum == other.HrNum && Gestione == other.Gestione && Nullable.Equals(DataOrd, other.DataOrd) && NumOrd == other.NumOrd && IdStep == other.IdStep && IdRiga == other.IdRiga && Nullable.Equals(OraInsAct, other.OraInsAct) && IndiceGradimento == other.IndiceGradimento && NoteGradimento == other.NoteGradimento && FlagRisolto == other.FlagRisolto && FlagTipologia == other.FlagTipologia && OreRapportino == other.OreRapportino && UserModifier == other.UserModifier && Nullable.Equals(OraModAct, other.OraModAct) && Nullable.Equals(OraViewAct, other.OraViewAct) && CodVdes == other.CodVdes && CodCmac == other.CodCmac && WrikeId == other.WrikeId && CodMgrp == other.CodMgrp && PlanId == other.PlanId;
} }
public override bool Equals(object? obj) public override bool Equals(object? obj)
@@ -57,16 +57,12 @@ public class ActivityDTO : StbActivity
hashCode.Add(CodAnag); hashCode.Add(CodAnag);
hashCode.Add(CodJcom); hashCode.Add(CodJcom);
hashCode.Add(CodJfas); hashCode.Add(CodJfas);
hashCode.Add(EstimatedDate);
hashCode.Add(EstimatedTime); hashCode.Add(EstimatedTime);
hashCode.Add(AlarmDate); hashCode.Add(AlarmDate);
hashCode.Add(AlarmTime); hashCode.Add(AlarmTime);
hashCode.Add(EffectiveDate);
hashCode.Add(EffectiveTime); hashCode.Add(EffectiveTime);
hashCode.Add(ResultDescription); hashCode.Add(ResultDescription);
hashCode.Add(EstimatedEnddate);
hashCode.Add(EstimatedEndtime); hashCode.Add(EstimatedEndtime);
hashCode.Add(EffectiveEnddate);
hashCode.Add(EffectiveEndtime); hashCode.Add(EffectiveEndtime);
hashCode.Add(UserCreator); hashCode.Add(UserCreator);
hashCode.Add(UserName); hashCode.Add(UserName);

View File

@@ -7,7 +7,7 @@ namespace salesbook.Shared.Core.Entity;
public class PtbProsRif public class PtbProsRif
{ {
[PrimaryKey, Column("composite_key")] [PrimaryKey, Column("composite_key")]
public string CompositeKey { get; set; } public string CompositeKey { get; set; } = null!;
private string? _codPpro; private string? _codPpro;

View File

@@ -36,9 +36,6 @@ public class StbActivity
[Column("cod_jfas"), JsonPropertyName("codJfas")] [Column("cod_jfas"), JsonPropertyName("codJfas")]
public string? CodJfas { get; set; } public string? CodJfas { get; set; }
[Column("estimated_date"), JsonPropertyName("estimatedDate")]
public DateTime? EstimatedDate { get; set; }
[Column("estimated_time"), JsonPropertyName("estimatedTime")] [Column("estimated_time"), JsonPropertyName("estimatedTime")]
public DateTime? EstimatedTime { get; set; } public DateTime? EstimatedTime { get; set; }
@@ -48,24 +45,15 @@ public class StbActivity
[Column("alarm_time"), JsonPropertyName("alarmTime")] [Column("alarm_time"), JsonPropertyName("alarmTime")]
public DateTime? AlarmTime { get; set; } public DateTime? AlarmTime { get; set; }
[Column("effective_date"), JsonPropertyName("effectiveDate")]
public DateTime? EffectiveDate { get; set; }
[Column("effective_time"), JsonPropertyName("effectiveTime")] [Column("effective_time"), JsonPropertyName("effectiveTime")]
public DateTime? EffectiveTime { get; set; } public DateTime? EffectiveTime { get; set; }
[Column("result_description"), JsonPropertyName("resultDescription")] [Column("result_description"), JsonPropertyName("resultDescription")]
public string? ResultDescription { get; set; } public string? ResultDescription { get; set; }
[Column("estimated_enddate"), JsonPropertyName("estimatedEnddate")]
public DateTime? EstimatedEnddate { get; set; }
[Column("estimated_endtime"), JsonPropertyName("estimatedEndtime")] [Column("estimated_endtime"), JsonPropertyName("estimatedEndtime")]
public DateTime? EstimatedEndtime { get; set; } public DateTime? EstimatedEndtime { get; set; }
[Column("effective_enddate"), JsonPropertyName("effectiveEnddate")]
public DateTime? EffectiveEnddate { get; set; }
[Column("effective_endtime"), JsonPropertyName("effectiveEndtime")] [Column("effective_endtime"), JsonPropertyName("effectiveEndtime")]
public DateTime? EffectiveEndtime { get; set; } public DateTime? EffectiveEndtime { get; set; }
@@ -173,4 +161,7 @@ public class StbActivity
[Column("plan_id"), JsonPropertyName("planId")] [Column("plan_id"), JsonPropertyName("planId")]
public long? PlanId { get; set; } public long? PlanId { get; set; }
[Column("id_posizione"), JsonPropertyName("idPosizione")]
public long? IdPosizione { get; set; }
} }

View File

@@ -25,6 +25,7 @@ public interface IIntegryApiService
Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request); Task<CRMTransferProspectResponseDTO> TransferProspect(CRMTransferProspectRequestDTO request);
Task UploadFile(string id, byte[] file, string fileName); Task UploadFile(string id, byte[] file, string fileName);
Task DeleteFile(string activityId, 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<Stream> DownloadFileFromRefUuid(string refUuid, string fileName);
@@ -33,7 +34,7 @@ public interface IIntegryApiService
//Position //Position
Task<PositionDTO> SavePosition(PositionDTO position); Task<PositionDTO> SavePosition(PositionDTO position);
Task<PositionDTO> RetrievePosition(string id); Task<PositionDTO> RetrievePosition(long id);
//Google //Google
Task<List<IndirizzoDTO>?> Geocode(string address); Task<List<IndirizzoDTO>?> Geocode(string address);

View File

@@ -134,7 +134,18 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data"); fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
content.Add(fileContent, "files", fileName); content.Add(fileContent, "files", fileName);
return integryApiRestClient.Post<object>($"uploadStbActivityFileAttachment", content, queryParams); return integryApiRestClient.Post<object>("uploadStbActivityFileAttachment", content, queryParams);
}
public Task DeleteFile(string activityId, string fileName)
{
var queryParams = new Dictionary<string, object>
{
{ "activityId", activityId },
{ "fileName", fileName }
};
return integryApiRestClient.Get<object>("activity/removeAttachment", queryParams);
} }
public Task<List<ActivityFileDto>> GetActivityFile(string activityId) public Task<List<ActivityFileDto>> GetActivityFile(string activityId)
@@ -164,7 +175,7 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
public Task<PositionDTO> SavePosition(PositionDTO position) => public Task<PositionDTO> SavePosition(PositionDTO position) =>
integryApiRestClient.Post<PositionDTO>("savePosition", position)!; integryApiRestClient.Post<PositionDTO>("savePosition", position)!;
public Task<PositionDTO> RetrievePosition(string id) public Task<PositionDTO> RetrievePosition(long id)
{ {
var queryParams = new Dictionary<string, object> { { "id", id } }; var queryParams = new Dictionary<string, object> { { "id", id } };