Fix: corregir permisos en Cultivos y limpiar código
- Agregar canEdit prop a Cultivos.tsx para controlar botones - Reescribir Cultivos.tsx eliminando código duplicado - Corregir App.tsx para que cultivos case funcione correctamente - Hacer patient prop opcional en Cultivos.tsx
This commit is contained in:
+16
-8
@@ -113,21 +113,29 @@ function AppContent() {
|
||||
getPacienteById={store.getPacienteById}
|
||||
/>
|
||||
);
|
||||
case 'cultivos':
|
||||
case 'cultivos': {
|
||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
||||
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>
|
||||
<Button onClick={() => store.setVista('internaciones')}>Volver a Internaciones</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Cultivos
|
||||
cultivos={store.cultivos}
|
||||
pacientes={store.pacientes}
|
||||
internaciones={store.internaciones}
|
||||
camas={store.camas}
|
||||
cultivos={store.cultivos.filter(c => c.pacienteId === paciente.id)}
|
||||
patient={paciente}
|
||||
internacionId={internacion.id}
|
||||
onAgregarCultivo={store.agregarCultivo}
|
||||
onActualizarCultivo={store.actualizarCultivo}
|
||||
onEliminarCultivo={store.eliminarCultivo}
|
||||
getPacienteById={store.getPacienteById}
|
||||
getCamaById={store.getCamaById}
|
||||
getInternacionActivaByPaciente={store.getInternacionActivaByPaciente}
|
||||
canEdit={store.canEditInternacion(internacion.id)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
case 'historiaclinica': {
|
||||
const internacion = store.getInternacionById(store.currentInternacionId || '');
|
||||
const paciente = internacion ? store.getPacienteById(internacion.pacienteId) : undefined;
|
||||
|
||||
Reference in New Issue
Block a user