Add debug logging for internacion not found errors
This commit is contained in:
+22
-7
@@ -114,12 +114,24 @@ function AppContent() {
|
||||
/>
|
||||
);
|
||||
case 'cultivos': {
|
||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
||||
const internacionId = store.currentInternacionId || '';
|
||||
console.log('Cultivos - currentInternacionId:', internacionId);
|
||||
const internacion = store.getInternacionById(internacionId);
|
||||
console.log('Cultivos - internacion:', internacion);
|
||||
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
||||
if (!internacion || !paciente) {
|
||||
console.log('Cultivos - paciente:', paciente);
|
||||
if (!internacion) {
|
||||
return (
|
||||
<div className="p-4 text-center">
|
||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada</p>
|
||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada (id: {internacionId})</p>
|
||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (!paciente) {
|
||||
return (
|
||||
<div className="p-4 text-center">
|
||||
<p className="text-gray-500 dark:text-gray-400">Paciente no encontrado para internación</p>
|
||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||
</div>
|
||||
);
|
||||
@@ -137,12 +149,14 @@ function AppContent() {
|
||||
);
|
||||
}
|
||||
case 'historiaclinica': {
|
||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
||||
const internacionId = store.currentInternacionId || '';
|
||||
const internacion = store.getInternacionById(internacionId);
|
||||
const { datosVitales, evoluciones, laboratorios, acidosBase, cultivos, estudios, interconsultas, atb, indicaciones } = store;
|
||||
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
||||
if (!internacion || !paciente) {
|
||||
return (
|
||||
<div className="p-4 text-center">
|
||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada</p>
|
||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada (id: {internacionId})</p>
|
||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||
</div>
|
||||
);
|
||||
@@ -209,12 +223,13 @@ function AppContent() {
|
||||
);
|
||||
|
||||
case 'editaringreso': {
|
||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
||||
const internacionId = store.currentInternacionId || '';
|
||||
const internacion = store.getInternacionById(internacionId);
|
||||
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
||||
if (!internacion || !paciente) {
|
||||
return (
|
||||
<div className="p-4 text-center">
|
||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada</p>
|
||||
<p className="text-gray-500 dark:text-gray-400">Internación no encontrada (id: {internacionId})</p>
|
||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user