Fix: Organizacion de Editar Ingreso igual a Nuevo Ingreso, corregido formato de fecha

This commit is contained in:
2026-04-14 00:04:40 -03:00
parent 88bfefc782
commit d43163590c
11 changed files with 708 additions and 30 deletions
+6 -4
View File
@@ -18,7 +18,7 @@ interface InternacionesProps {
laboratorios?: Laboratorio[];
cultivos?: Cultivo[];
areas: Area[];
onIniciarInternacion: (internacion: Omit<Internacion, 'id' | 'fechaIngreso' | 'activa'>) => void;
onIniciarInternacion: (internacion: Omit<Internacion, 'id' | 'activa'>) => void;
onFinalizarInternacion: (internacionId: string, datos: {
fechaEgreso: string;
diagnosticoEgreso: string;
@@ -27,6 +27,7 @@ interface InternacionesProps {
getPacienteById: (id: string) => Paciente | undefined;
getCamaById: (id: string) => Cama | undefined;
onVerHC?: (internacionId: string) => void;
onNuevoIngreso?: () => void;
}
export function Internaciones({
@@ -39,6 +40,7 @@ export function Internaciones({
getCamaById,
areas,
onVerHC,
onNuevoIngreso,
}: InternacionesProps) {
const [filtroEstado, setFiltroEstado] = useState<'todas' | 'activas' | 'finalizadas'>('todas');
const [dialogoNuevaAbierto, setDialogoNuevaAbierto] = useState(false);
@@ -116,7 +118,7 @@ export function Internaciones({
(filtroEstado === 'finalizadas' && !i.activa);
return cumpleBusqueda && cumpleEstado;
}).sort((a, b) => new Date(b.fechaIngreso).getTime() - new Date(a.fechaIngreso).getTime());
}).sort((a, b) => new Date(b.fechaIngresoClinica || '').getTime() - new Date(a.fechaIngresoClinica || '').getTime());
const pacientesSinInternar = pacientes.filter(p => {
const internacionActiva = internaciones.find(i => i.pacienteId === p.id && i.activa);
@@ -143,7 +145,7 @@ export function Internaciones({
</div>
<Dialog open={dialogoNuevaAbierto} onOpenChange={setDialogoNuevaAbierto}>
<DialogTrigger asChild>
<Button onClick={resetFormularioNueva}>
<Button onClick={() => onNuevoIngreso ? onNuevoIngreso() : setDialogoNuevaAbierto(true)}>
<Plus className="h-4 w-4 mr-2" />
Nuevo Ingreso
</Button>
@@ -334,7 +336,7 @@ export function Internaciones({
</div>
<div className="flex items-center gap-2 text-gray-600">
<Calendar className="h-4 w-4" />
<span>Ingreso: {formatDateDDMMYYYY(internacion.fechaIngreso)}</span>
<span>Ingreso: {internacion.fechaIngresoClinica ? formatDateDDMMYYYY(internacion.fechaIngresoClinica) : 'N/A'}</span>
</div>
<div className="flex items-center gap-2 text-gray-600">
<Stethoscope className="h-4 w-4" />