Completato form attività e filtri

This commit is contained in:
2025-06-16 11:58:49 +02:00
parent 0032648e76
commit 7ca4de628b
44 changed files with 1241 additions and 924 deletions

View File

@@ -10,88 +10,89 @@ public class ActivityDTO : StbActivity
public ActivityCategoryEnum Category { get; set; }
public bool Complete { get; set; }
private sealed class ActivityDtoEqualityComparer : IEqualityComparer<ActivityDTO>
{
public bool Equals(ActivityDTO? x, ActivityDTO? y)
{
if (ReferenceEquals(x, y)) return true;
if (x is null) return false;
if (y is null) return false;
if (x.GetType() != y.GetType()) return false;
return x.ActivityId == y.ActivityId && x.ActivityResultId == y.ActivityResultId && x.ActivityTypeId == y.ActivityTypeId && x.DataInsAct.Equals(y.DataInsAct) && x.ActivityDescription == y.ActivityDescription && x.ParentActivityId == y.ParentActivityId && x.TipoAnag == y.TipoAnag && x.CodAnag == y.CodAnag && x.CodJcom == y.CodJcom && x.CodJfas == y.CodJfas && Nullable.Equals(x.EstimatedDate, y.EstimatedDate) && Nullable.Equals(x.EstimatedTime, y.EstimatedTime) && Nullable.Equals(x.AlarmDate, y.AlarmDate) && Nullable.Equals(x.AlarmTime, y.AlarmTime) && Nullable.Equals(x.EffectiveDate, y.EffectiveDate) && Nullable.Equals(x.EffectiveTime, y.EffectiveTime) && x.ResultDescription == y.ResultDescription && Nullable.Equals(x.EstimatedEnddate, y.EstimatedEnddate) && Nullable.Equals(x.EstimatedEndtime, y.EstimatedEndtime) && Nullable.Equals(x.EffectiveEnddate, y.EffectiveEnddate) && Nullable.Equals(x.EffectiveEndtime, y.EffectiveEndtime) && x.UserCreator == y.UserCreator && x.UserName == y.UserName && Nullable.Equals(x.PercComp, y.PercComp) && Nullable.Equals(x.EstimatedHours, y.EstimatedHours) && x.CodMart == y.CodMart && x.PartitaMag == y.PartitaMag && x.Matricola == y.Matricola && x.Priorita == y.Priorita && Nullable.Equals(x.ActivityPlayCounter, y.ActivityPlayCounter) && x.ActivityEvent == y.ActivityEvent && x.Guarantee == y.Guarantee && x.Note == y.Note && x.Rfid == y.Rfid && x.IdLotto == y.IdLotto && x.PersonaRif == y.PersonaRif && x.HrNum == y.HrNum && x.Gestione == y.Gestione && Nullable.Equals(x.DataOrd, y.DataOrd) && x.NumOrd == y.NumOrd && x.IdStep == y.IdStep && x.IdRiga == y.IdRiga && Nullable.Equals(x.OraInsAct, y.OraInsAct) && x.IndiceGradimento == y.IndiceGradimento && x.NoteGradimento == y.NoteGradimento && x.FlagRisolto == y.FlagRisolto && x.FlagTipologia == y.FlagTipologia && x.OreRapportino == y.OreRapportino && x.UserModifier == y.UserModifier && Nullable.Equals(x.OraModAct, y.OraModAct) && Nullable.Equals(x.OraViewAct, y.OraViewAct) && x.CodVdes == y.CodVdes && x.CodCmac == y.CodCmac && x.WrikeId == y.WrikeId && x.CodMgrp == y.CodMgrp && x.PlanId == y.PlanId && x.Commessa == y.Commessa && x.Cliente == y.Cliente && x.Category == y.Category && x.Complete == y.Complete;
}
public int GetHashCode(ActivityDTO obj)
{
var hashCode = new HashCode();
hashCode.Add(obj.ActivityId);
hashCode.Add(obj.ActivityResultId);
hashCode.Add(obj.ActivityTypeId);
hashCode.Add(obj.DataInsAct);
hashCode.Add(obj.ActivityDescription);
hashCode.Add(obj.ParentActivityId);
hashCode.Add(obj.TipoAnag);
hashCode.Add(obj.CodAnag);
hashCode.Add(obj.CodJcom);
hashCode.Add(obj.CodJfas);
hashCode.Add(obj.EstimatedDate);
hashCode.Add(obj.EstimatedTime);
hashCode.Add(obj.AlarmDate);
hashCode.Add(obj.AlarmTime);
hashCode.Add(obj.EffectiveDate);
hashCode.Add(obj.EffectiveTime);
hashCode.Add(obj.ResultDescription);
hashCode.Add(obj.EstimatedEnddate);
hashCode.Add(obj.EstimatedEndtime);
hashCode.Add(obj.EffectiveEnddate);
hashCode.Add(obj.EffectiveEndtime);
hashCode.Add(obj.UserCreator);
hashCode.Add(obj.UserName);
hashCode.Add(obj.PercComp);
hashCode.Add(obj.EstimatedHours);
hashCode.Add(obj.CodMart);
hashCode.Add(obj.PartitaMag);
hashCode.Add(obj.Matricola);
hashCode.Add(obj.Priorita);
hashCode.Add(obj.ActivityPlayCounter);
hashCode.Add(obj.ActivityEvent);
hashCode.Add(obj.Guarantee);
hashCode.Add(obj.Note);
hashCode.Add(obj.Rfid);
hashCode.Add(obj.IdLotto);
hashCode.Add(obj.PersonaRif);
hashCode.Add(obj.HrNum);
hashCode.Add(obj.Gestione);
hashCode.Add(obj.DataOrd);
hashCode.Add(obj.NumOrd);
hashCode.Add(obj.IdStep);
hashCode.Add(obj.IdRiga);
hashCode.Add(obj.OraInsAct);
hashCode.Add(obj.IndiceGradimento);
hashCode.Add(obj.NoteGradimento);
hashCode.Add(obj.FlagRisolto);
hashCode.Add(obj.FlagTipologia);
hashCode.Add(obj.OreRapportino);
hashCode.Add(obj.UserModifier);
hashCode.Add(obj.OraModAct);
hashCode.Add(obj.OraViewAct);
hashCode.Add(obj.CodVdes);
hashCode.Add(obj.CodCmac);
hashCode.Add(obj.WrikeId);
hashCode.Add(obj.CodMgrp);
hashCode.Add(obj.PlanId);
hashCode.Add(obj.Commessa);
hashCode.Add(obj.Cliente);
hashCode.Add((int)obj.Category);
hashCode.Add(obj.Complete);
return hashCode.ToHashCode();
}
}
public static IEqualityComparer<ActivityDTO> ActivityDtoComparer { get; } = new ActivityDtoEqualityComparer();
public ActivityDTO Clone()
{
return (ActivityDTO)MemberwiseClone();
}
private bool Equals(ActivityDTO other)
{
return Commessa == other.Commessa &&
Cliente == other.Cliente &&
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;
}
public override bool Equals(object? obj)
{
if (obj is null) return false;
if (ReferenceEquals(this, obj)) return true;
return obj.GetType() == GetType() && Equals((ActivityDTO)obj);
}
public override int GetHashCode()
{
var hashCode = new HashCode();
hashCode.Add(ActivityId);
hashCode.Add(ActivityResultId);
hashCode.Add(ActivityTypeId);
hashCode.Add(DataInsAct);
hashCode.Add(ActivityDescription);
hashCode.Add(ParentActivityId);
hashCode.Add(TipoAnag);
hashCode.Add(CodAnag);
hashCode.Add(CodJcom);
hashCode.Add(CodJfas);
hashCode.Add(EstimatedDate);
hashCode.Add(EstimatedTime);
hashCode.Add(AlarmDate);
hashCode.Add(AlarmTime);
hashCode.Add(EffectiveDate);
hashCode.Add(EffectiveTime);
hashCode.Add(ResultDescription);
hashCode.Add(EstimatedEnddate);
hashCode.Add(EstimatedEndtime);
hashCode.Add(EffectiveEnddate);
hashCode.Add(EffectiveEndtime);
hashCode.Add(UserCreator);
hashCode.Add(UserName);
hashCode.Add(PercComp);
hashCode.Add(EstimatedHours);
hashCode.Add(CodMart);
hashCode.Add(PartitaMag);
hashCode.Add(Matricola);
hashCode.Add(Priorita);
hashCode.Add(ActivityPlayCounter);
hashCode.Add(ActivityEvent);
hashCode.Add(Guarantee);
hashCode.Add(Note);
hashCode.Add(Rfid);
hashCode.Add(IdLotto);
hashCode.Add(PersonaRif);
hashCode.Add(HrNum);
hashCode.Add(Gestione);
hashCode.Add(DataOrd);
hashCode.Add(NumOrd);
hashCode.Add(IdStep);
hashCode.Add(IdRiga);
hashCode.Add(OraInsAct);
hashCode.Add(IndiceGradimento);
hashCode.Add(NoteGradimento);
hashCode.Add(FlagRisolto);
hashCode.Add(FlagTipologia);
hashCode.Add(OreRapportino);
hashCode.Add(UserModifier);
hashCode.Add(OraModAct);
hashCode.Add(OraViewAct);
hashCode.Add(CodVdes);
hashCode.Add(CodCmac);
hashCode.Add(WrikeId);
hashCode.Add(CodMgrp);
hashCode.Add(PlanId);
hashCode.Add(Commessa);
hashCode.Add(Cliente);
hashCode.Add(Category);
hashCode.Add(Complete);
return hashCode.ToHashCode();
}
}

View File

@@ -1,6 +0,0 @@
namespace Template.Shared.Core.Dto;
public class ActivityResultDTO
{
public string ActivityResultId { get; set; }
}

View File

@@ -0,0 +1,20 @@
using Template.Shared.Core.Helpers;
using Template.Shared.Core.Helpers.Enum;
namespace Template.Shared.Core.Dto;
public class FilterActivityDTO
{
public string? Text { get; set; }
public IEnumerable<string>? User { get; set; }
public string? Type { get; set; }
public string? Result { get; set; }
public ActivityCategoryEnum? Category { get; set; }
public bool ClearFilter =>
Text.IsNullOrEmpty() &&
User.IsNullOrEmpty() &&
Type.IsNullOrEmpty() &&
Result.IsNullOrEmpty() &&
Category == null;
}

View File

@@ -0,0 +1,16 @@
using System.Text.Json.Serialization;
using Template.Shared.Core.Entity;
namespace Template.Shared.Core.Dto;
public class SettingsResponseDTO
{
[JsonPropertyName("activityTypes")]
public List<StbActivityType>? ActivityTypes { get; set; }
[JsonPropertyName("activityResults")]
public List<StbActivityResult>? ActivityResults { get; set; }
[JsonPropertyName("stbUsers")]
public List<StbUser>? StbUsers { get; set; }
}

View File

@@ -0,0 +1,32 @@
using SQLite;
using System.Text.Json.Serialization;
namespace Template.Shared.Core.Entity;
[Table("stb_activity_result")]
public class StbActivityResult
{
[PrimaryKey, Column("activity_result_id"), JsonPropertyName("activityResultId")]
public string ActivityResultId { get; set; }
[Column("path_icona"), JsonPropertyName("pathIcona")]
public string? PathIcona { get; set; }
[Column("flag_save_rap_lav"), JsonPropertyName("flagSaveRapLav")]
public string FlagSaveRapLav { get; set; } = "N";
[Column("flag_activity_result"), JsonPropertyName("flagActivityResult")]
public int? FlagActivityResult { get; set; } = 1;
[Column("flag_insert_activity"), JsonPropertyName("flagInsertActivity")]
public string FlagInsertActivity { get; set; } = "N";
[Column("flag_attivo"), JsonPropertyName("flagAttivo")]
public string FlagAttivo { get; set; } = "S";
[Column("flag_invio_notifica"), JsonPropertyName("flagInvioNotifica")]
public string FlagInvioNotifica { get; set; } = "N";
[Column("flag_stato_attivita"), JsonPropertyName("flagStatoAttivita")]
public string FlagStatoAttivita { get; set; } = "N";
}

View File

@@ -0,0 +1,41 @@
using SQLite;
using System.Text.Json.Serialization;
namespace Template.Shared.Core.Entity;
[Table("stb_activity_type")]
public class StbActivityType
{
[Column("activity_type_id"), JsonPropertyName("activityTypeId"), Indexed(Name = "ActivityTypePK", Order = 1, Unique = true)]
public string ActivityTypeId { get; set; }
[Column("flag_tipologia"), JsonPropertyName("flagTipologia"), Indexed(Name = "ActivityTypePK", Order = 2, Unique = true)]
public string FlagTipologia { get; set; }
[Column("estimated_duration"), JsonPropertyName("estimatedDuration")]
public double? EstimatedDuration { get; set; } = 0;
[Column("link_gest"), JsonPropertyName("linkGest")]
public string? LinkGest { get; set; }
[Column("cod_jfas"), JsonPropertyName("codJfas")]
public string? CodJfas { get; set; }
[Column("user_name"), JsonPropertyName("userName")]
public string? UserName { get; set; }
[Column("flag_sal"), JsonPropertyName("flagSal")]
public string FlagSal { get; set; } = "N";
[Column("flag_set_alarm"), JsonPropertyName("flagSetAlarm")]
public string FlagSetAlarm { get; set; } = "N";
[Column("flag_attiva"), JsonPropertyName("flagAttiva")]
public string FlagAttiva { get; set; } = "S";
[Column("flag_generate_mov"), JsonPropertyName("flagGenerateMov")]
public string FlagGenerateMov { get; set; } = "S";
[Column("flag_view_calendar"), JsonPropertyName("flagViewCalendar")]
public bool FlagViewCalendar { get; set; }
}

View File

@@ -0,0 +1,14 @@
using SQLite;
using System.Text.Json.Serialization;
namespace Template.Shared.Core.Entity;
[Table("stb_user")]
public class StbUser
{
[PrimaryKey, Column("user_name"), JsonPropertyName("userName")]
public string UserName { get; set; }
[Column("full_name"), JsonPropertyName("fullName")]
public string FullName { get; set; }
}

View File

@@ -4,14 +4,21 @@ namespace Template.Shared.Core.Helpers;
public static class ActivityCategoryHelper
{
public static string ConvertToHumanReadable(this ActivityCategoryEnum activityType)
public static string ConvertToHumanReadable(this ActivityCategoryEnum activityCategory)
{
return activityType switch
return activityCategory switch
{
ActivityCategoryEnum.Memo => "memo",
ActivityCategoryEnum.Interna => "interna",
ActivityCategoryEnum.Commessa => "commessa",
_ => throw new ArgumentOutOfRangeException(nameof(activityType), activityType, null)
_ => throw new ArgumentOutOfRangeException(nameof(activityCategory), activityCategory, null)
};
}
public static List<ActivityCategoryEnum> AllActivityCategory =>
[
ActivityCategoryEnum.Memo,
ActivityCategoryEnum.Interna,
ActivityCategoryEnum.Commessa
];
}

View File

@@ -1,6 +0,0 @@
namespace Template.Shared.Core.Helpers.Enum;
public enum ActivityStatusEnum
{
}

View File

@@ -1,16 +1,17 @@
using MudBlazor;
using Template.Shared.Components.Pages;
using Template.Shared.Components.SingleElements.Modal;
namespace Template.Shared.Core.Helpers;
public class ModalHelpers
{
public static Task OpenActivityForm(IDialogService dialog ,string? id = null) =>
dialog.ShowAsync<ActivityForm>(
public static async Task<DialogResult?> OpenActivityForm(IDialogService dialog, string? id = null)
{
var modal = await dialog.ShowAsync<ActivityForm>(
"Activity form",
new DialogParameters<ActivityForm>
{
{ x => x.Id, id}
{ x => x.Id, id }
},
new DialogOptions
{
@@ -19,4 +20,7 @@ public class ModalHelpers
NoHeader = true
}
);
return await modal.Result;
}
}

View File

@@ -10,4 +10,10 @@ public static class ObjectExtensions
public static bool IsNullOrEmpty(this string? obj) =>
string.IsNullOrEmpty(obj);
}
public static bool EqualsIgnoreCase(this string obj, string anotherString) =>
string.Equals(obj, anotherString, StringComparison.OrdinalIgnoreCase);
public static bool ContainsIgnoreCase(this string obj, string anotherString) =>
obj.Contains(anotherString, StringComparison.OrdinalIgnoreCase);
}

View File

@@ -5,8 +5,11 @@ namespace Template.Shared.Core.Interface;
public interface IIntegryApiService
{
Task<List<StbActivity>?> GetActivity(string? dateFilter = null);
Task<List<JtbComt>?> GetAllCommesse(string? dateFilter = null);
Task<TaskSyncResponseDTO> GetAnagClie(string? dateFilter = null);
Task<TaskSyncResponseDTO> GetProspect(string? dateFilter = null);
Task<List<StbActivity>?> RetrieveActivity(string? dateFilter = null);
Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter = null);
Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter = null);
Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter = null);
Task<SettingsResponseDTO> RetrieveSettings();
Task<StbActivity?> SaveActivity(ActivityDTO activity);
}

View File

@@ -6,15 +6,10 @@ namespace Template.Shared.Core.Interface;
public interface IManageDataService
{
Task<List<AnagClie>> GetAnagClie(Expression<Func<AnagClie, bool>>? whereCond = null);
Task<List<JtbComt>> GetJtbComt(Expression<Func<JtbComt, bool>>? whereCond = null);
Task<List<PtbPros>> GetPtbPros(Expression<Func<PtbPros, bool>>? whereCond = null);
Task<List<PtbProsRif>> GetPtbProsRif(Expression<Func<PtbProsRif, bool>>? whereCond = null);
Task<List<StbActivity>> GetStbActivity(Expression<Func<StbActivity, bool>>? whereCond = null);
Task<List<VtbCliePersRif>> GetVtbCliePersRif(Expression<Func<VtbCliePersRif, bool>>? whereCond = null);
Task<List<VtbDest>> GetVtbDest(Expression<Func<VtbDest, bool>>? whereCond = null);
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 InsertOrUpdate<T>(T objectToSave);
Task ClearDb();
}

View File

@@ -6,4 +6,5 @@ public interface ISyncDbService
Task GetAndSaveCommesse(string? dateFilter = null);
Task GetAndSaveProspect(string? dateFilter = null);
Task GetAndSaveClienti(string? dateFilter = null);
Task GetAndSaveSettings(string? dateFilter = null);
}

View File

@@ -9,14 +9,14 @@ namespace Template.Shared.Core.Services;
public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUserSession userSession)
: IIntegryApiService
{
public Task<List<StbActivity>?> GetActivity(string? dateFilter)
public Task<List<StbActivity>?> RetrieveActivity(string? dateFilter)
{
var queryParams = new Dictionary<string, object> { { "dateFilter", dateFilter ?? "2020-01-01" } };
return integryApiRestClient.AuthorizedGet<List<StbActivity>?>("getActivityCrm", queryParams);
return integryApiRestClient.AuthorizedGet<List<StbActivity>?>("crm/retrieveActivity", queryParams);
}
public Task<List<JtbComt>?> GetAllCommesse(string? dateFilter)
public Task<List<JtbComt>?> RetrieveAllCommesse(string? dateFilter)
{
var queryParams = new Dictionary<string, object>();
@@ -25,10 +25,10 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
queryParams.Add("dateFilter", dateFilter);
}
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("getCommesseCrm", queryParams);
return integryApiRestClient.AuthorizedGet<List<JtbComt>?>("crm/retrieveCommesse", queryParams);
}
public Task<TaskSyncResponseDTO> GetAnagClie(string? dateFilter)
public Task<TaskSyncResponseDTO> RetrieveAnagClie(string? dateFilter)
{
var queryParams = new Dictionary<string, object>();
@@ -37,10 +37,10 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
queryParams.Add("dateFilter", dateFilter);
}
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("getAnagClieCrm", queryParams)!;
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveClienti", queryParams)!;
}
public Task<TaskSyncResponseDTO> GetProspect(string? dateFilter)
public Task<TaskSyncResponseDTO> RetrieveProspect(string? dateFilter)
{
var queryParams = new Dictionary<string, object>();
@@ -49,6 +49,12 @@ public class IntegryApiService(IIntegryApiRestClient integryApiRestClient, IUser
queryParams.Add("dateFilter", dateFilter);
}
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("getProspectCrm", queryParams)!;
return integryApiRestClient.AuthorizedGet<TaskSyncResponseDTO>("crm/retrieveProspect", queryParams)!;
}
public Task<SettingsResponseDTO> RetrieveSettings() =>
integryApiRestClient.AuthorizedGet<SettingsResponseDTO>("crm/retrieveSettings", null)!;
public Task<StbActivity?> SaveActivity(ActivityDTO activity) =>
integryApiRestClient.AuthorizedPost<StbActivity?>("crm/saveActivity", activity);
}