cambios en datastage

This commit is contained in:
2025-08-21 12:11:50 -06:00
parent 6eea8c8ac1
commit da454447a9
3 changed files with 130 additions and 10 deletions

View File

@@ -84,6 +84,8 @@ async function procesarDatastage(item, setDatastages, setSuccess, setError, setR
} else {
setSuccess('Procesado correctamente');
}
// El modal de éxito se debe mostrar en el componente principal después de setSuccess
// No se llama aquí
if (data && data.registros_cargados) {
setRegistrosCargados(data.registros_cargados);
setShowRegistrosModal(true);
@@ -136,6 +138,10 @@ export default function Datastage() {
useLayoutEffect(() => { setShowAnimation(true); }, []);
useEffect(() => { if (showAnimation && !hasAnimated) setTimeout(() => setHasAnimated(true), 800); }, [showAnimation, hasAnimated]);
// Mostrar modal de éxito cuando cambia el mensaje de success
useEffect(() => {
if (success) setShowSuccessModal(true);
}, [success]);
// Cargar lista
const load = async () => {
setLoading(true);
@@ -409,9 +415,9 @@ export default function Datastage() {
</button>
<button
onClick={() => procesarDatastage(item, setDatastages, setSuccess, setError, setRegistrosCargados, setShowRegistrosModal)}
className={`inline-flex items-center justify-center w-9 h-9 rounded-lg border transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-1 ${item.procesado ? 'bg-gray-100 border-gray-200 cursor-not-allowed opacity-50' : 'bg-green-50 border-green-200 hover:bg-green-100 hover:border-green-300 focus:ring-green-500 cursor-pointer'}`}
title={item.procesado ? 'Ya procesado' : 'Procesar'}
disabled={item.procesado}
className={`inline-flex items-center justify-center w-9 h-9 rounded-lg border transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-1 ${item.procesado ? 'bg-gray-100 border-gray-200 cursor-not-allowed opacity-50' : 'bg-green-50 border-green-200 hover:bg-green-100 hover:border-green-300 focus:ring-green-500 cursor-pointer'}`}
title={item.procesado ? 'Ya procesado' : 'Procesar'}
disabled={item.procesado}
>
<svg className="w-5 h-5 text-green-600" fill="currentColor" viewBox="0 0 24 24">
<path d="M8 5v14l11-7z"/>