This commit is contained in:
2025-12-25 13:54:49 -06:00
parent d405b61ddd
commit 3457721238
26 changed files with 3509 additions and 139 deletions

View File

@@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
namespace MieSystem.Models
{
public class Asistencia
{
public int Id { get; set; }
public int ExpedienteId { get; set; }
public DateTime Fecha { get; set; }
public string Estado { get; set; } // P, T, F
public TimeSpan? HoraEntrada { get; set; }
public TimeSpan? HoraSalida { get; set; }
public string Observaciones { get; set; }
public DateTime FechaRegistro { get; set; }
public string UsuarioRegistro { get; set; }
// Propiedades calculadas
public string EstadoTexto => Estado switch
{
"P" => "Presente",
"T" => "Tarde",
"F" => "Falto",
_ => "Desconocido"
};
public string ColorEstado => Estado switch
{
"P" => "success",
"T" => "warning",
"F" => "danger",
_ => "secondary"
};
}
}

View File

@@ -0,0 +1,13 @@
namespace MieSystem.Models
{
public class EstadisticasMes
{
public int Total { get; set; }
public int Presentes { get; set; }
public int Tardes { get; set; }
public int Faltas { get; set; }
public decimal PorcentajePresentes { get; set; }
public decimal PorcentajeTardes { get; set; }
public decimal PorcentajeFaltas { get; set; }
}
}

View File

@@ -51,5 +51,57 @@ namespace MieSystem.Models
[Column("activo")]
public bool Activo { get; set; }
// Propiedades calculadas (solo lectura)
public string NombreCompleto => $"{Nombre} {Apellidos}".Trim();
public int Edad
{
get
{
var today = DateTime.Today;
var age = today.Year - FechaNacimiento.Year;
// Si aún no ha cumplido años este año, restar 1
if (FechaNacimiento.Date > today.AddYears(-age))
{
age--;
}
return age;
}
}
// Otra propiedad útil para mostrar
public string EdadConMeses
{
get
{
var today = DateTime.Today;
var age = today.Year - FechaNacimiento.Year;
var months = today.Month - FechaNacimiento.Month;
if (today.Day < FechaNacimiento.Day)
{
months--;
}
if (months < 0)
{
age--;
months += 12;
}
return $"{age} años, {months} meses";
}
}
// Para mostrar en selectores
public string NombreConEdad => $"{NombreCompleto} ({Edad} años)";
// Para mostrar en listas
public string InformacionBasica => $"{NombreCompleto} | {Edad} años | {Sexo}";
}
}

View File

@@ -0,0 +1,20 @@
namespace MieSystem.Models.ViewModels
{
public class AsistenciaViewModel
{
public int Año { get; set; }
public int Mes { get; set; }
public string NombreMes { get; set; }
public string DiasSemanaSeleccionados { get; set; }
public List<Expediente> Expedientes { get; set; }
public List<DateTime> DiasDelMes { get; set; }
public Dictionary<string, string> Asistencias { get; set; }
}
public class AsistenciaMasivaDto
{
public int ExpedienteId { get; set; }
public DateTime Fecha { get; set; }
public string Estado { get; set; }
}
}

View File

@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
namespace MieSystem.Models
namespace MieSystem.Models.ViewModels
{
public class ExpedienteViewModel
{