feat: introduce training module with new entities, migrations, API, and frontend application, and add article type and validity days.
This commit is contained in:
@@ -24,8 +24,21 @@ public class Articolo : BaseEntity
|
||||
public string? MimeType { get; set; }
|
||||
public string? Note { get; set; }
|
||||
public bool Attivo { get; set; } = true;
|
||||
public int? GiorniValidita { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Classificazione specifica dell'articolo (Standard, Corso, Servizio)
|
||||
/// </summary>
|
||||
public TipoArticolo Tipo { get; set; } = TipoArticolo.Standard;
|
||||
|
||||
public TipoMateriale? TipoMateriale { get; set; }
|
||||
public CodiceCategoria? Categoria { get; set; }
|
||||
public ICollection<EventoDettaglioPrelievo> DettagliPrelievo { get; set; } = new List<EventoDettaglioPrelievo>();
|
||||
}
|
||||
|
||||
public enum TipoArticolo
|
||||
{
|
||||
Standard = 0,
|
||||
Corso = 1,
|
||||
Servizio = 2
|
||||
}
|
||||
|
||||
@@ -28,4 +28,5 @@ public class Cliente : BaseEntity
|
||||
|
||||
public ICollection<Evento> Eventi { get; set; } = new List<Evento>();
|
||||
public ICollection<Zentral.Domain.Entities.Sales.SalesOrder> SalesOrders { get; set; } = new List<Zentral.Domain.Entities.Sales.SalesOrder>();
|
||||
public ICollection<ClienteContatto> Contatti { get; set; } = new List<ClienteContatto>();
|
||||
}
|
||||
|
||||
12
src/backend/Zentral.Domain/Entities/ClienteContatto.cs
Normal file
12
src/backend/Zentral.Domain/Entities/ClienteContatto.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Zentral.Domain.Entities;
|
||||
|
||||
public class ClienteContatto : BaseEntity
|
||||
{
|
||||
public string Nome { get; set; } = string.Empty;
|
||||
public string Cognome { get; set; } = string.Empty;
|
||||
public string? Email { get; set; }
|
||||
public string? Ruolo { get; set; }
|
||||
public string? Telefono { get; set; }
|
||||
public int ClienteId { get; set; }
|
||||
public Cliente Cliente { get; set; } = null!;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Zentral.Domain.Entities.Training;
|
||||
|
||||
public enum TrainingStatus
|
||||
{
|
||||
Valid,
|
||||
Expiring,
|
||||
Expired
|
||||
}
|
||||
|
||||
public class TrainingRecord : BaseEntity
|
||||
{
|
||||
public int ClienteContattoId { get; set; }
|
||||
public ClienteContatto ClienteContatto { get; set; } = null!;
|
||||
|
||||
public int ArticoloId { get; set; }
|
||||
public Articolo Articolo { get; set; } = null!;
|
||||
|
||||
public DateTime DataEsecuzione { get; set; }
|
||||
public DateTime? DataScadenza { get; set; }
|
||||
|
||||
public string? AttestatoUrl { get; set; }
|
||||
public string? Note { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public TrainingStatus Stato
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!DataScadenza.HasValue) return TrainingStatus.Valid; // Or unknown? Assuming valid if no expiration.
|
||||
var days = (DataScadenza.Value - DateTime.Today).TotalDays;
|
||||
if (days < 0) return TrainingStatus.Expired;
|
||||
if (days <= 30) return TrainingStatus.Expiring;
|
||||
return TrainingStatus.Valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user