Add motivo field to interconsultas with dark mode badges
This commit is contained in:
@@ -2081,6 +2081,7 @@ function SeccionInterconsultas({ interconsultas, pacienteId, internacionId, add,
|
||||
const [dialog, setDialog] = useState(false);
|
||||
const [fecha, setFecha] = useState(new Date().toISOString().split('T')[0]);
|
||||
const [servicioInterconsultado, setServicioInterconsultado] = useState('');
|
||||
const [motivo, setMotivo] = useState('');
|
||||
const [respuestaInterconsulta, setRespuestaInterconsulta] = useState('');
|
||||
const [respuestaFecha, setRespuestaFecha] = useState('');
|
||||
const [edit, setEdit] = useState<Interconsulta | null>(null);
|
||||
@@ -2088,6 +2089,7 @@ function SeccionInterconsultas({ interconsultas, pacienteId, internacionId, add,
|
||||
const reset = () => {
|
||||
setFecha(new Date().toISOString().split('T')[0]);
|
||||
setServicioInterconsultado('');
|
||||
setMotivo('');
|
||||
setRespuestaInterconsulta('');
|
||||
setRespuestaFecha('');
|
||||
setEdit(null);
|
||||
@@ -2095,7 +2097,7 @@ function SeccionInterconsultas({ interconsultas, pacienteId, internacionId, add,
|
||||
|
||||
const handleGuardar = () => {
|
||||
if (!servicioInterconsultado) return;
|
||||
const datos: any = { fecha, servicioInterconsultado, respuestaInterconsulta };
|
||||
const datos: any = { fecha, servicioInterconsultado, motivo, respuestaInterconsulta };
|
||||
if (respuestaInterconsulta) {
|
||||
datos.respuestaFecha = respuestaFecha || new Date().toISOString().split('T')[0];
|
||||
}
|
||||
@@ -2112,6 +2114,7 @@ function SeccionInterconsultas({ interconsultas, pacienteId, internacionId, add,
|
||||
setEdit(ic);
|
||||
setFecha(ic.fecha);
|
||||
setServicioInterconsultado(ic.servicioInterconsultado);
|
||||
setMotivo(ic.motivo || '');
|
||||
setRespuestaInterconsulta(ic.respuestaInterconsulta || '');
|
||||
setRespuestaFecha(ic.respuestaFecha || '');
|
||||
setDialog(true);
|
||||
@@ -2146,6 +2149,14 @@ function SeccionInterconsultas({ interconsultas, pacienteId, internacionId, add,
|
||||
placeholder="Ej: Cardiología, Neurología, Infectología, etc."
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Label>Motivo</Label>
|
||||
<Input
|
||||
value={motivo}
|
||||
onChange={e => setMotivo(e.target.value)}
|
||||
placeholder="Motivo de la interconsulta"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Label>Fecha de Respuesta</Label>
|
||||
@@ -2190,16 +2201,21 @@ function SeccionInterconsultas({ interconsultas, pacienteId, internacionId, add,
|
||||
{!ic.respuestaInterconsulta ? (
|
||||
<Badge className="bg-orange-500 text-white hover:bg-orange-600">Pendiente</Badge>
|
||||
) : (
|
||||
<Badge className="bg-green-600 text-white hover:bg-green-700">Respondida</Badge>
|
||||
<Badge className="bg-green-600 text-white hover:bg-green-700 dark:bg-green-700 dark:hover:bg-green-600">Respondida</Badge>
|
||||
)}
|
||||
</div>
|
||||
<h4 className="font-semibold text-gray-900 dark:text-white">{ic.servicioInterconsultado}</h4>
|
||||
{ic.motivo && (
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1">{ic.motivo}</p>
|
||||
)}
|
||||
{ic.respuestaInterconsulta && (
|
||||
<>
|
||||
{ic.respuestaFecha && (
|
||||
<p className="text-xs text-green-600 font-medium">Fecha de respuesta: {ic.respuestaFecha}</p>
|
||||
<Badge variant="outline" className="mt-2 bg-green-50 text-green-700 border-green-200 dark:bg-green-950 dark:text-green-300 dark:border-green-800">
|
||||
Respuesta: {ic.respuestaFecha}
|
||||
</Badge>
|
||||
)}
|
||||
<p className="text-sm text-gray-600 dark:text-gray-300 mt-1 whitespace-pre-wrap">{ic.respuestaInterconsulta}</p>
|
||||
<p className="text-sm text-gray-600 dark:text-gray-300 mt-2 whitespace-pre-wrap">{ic.respuestaInterconsulta}</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user