From ead941b395c3cafa9073256a8ba5777b005ad0cc Mon Sep 17 00:00:00 2001 From: JCedillo Date: Thu, 16 Oct 2025 17:14:47 -0500 Subject: [PATCH] Se agrega boton para mandar a procesar todos los pedimentos --- src/pages/Expedientes.jsx | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/pages/Expedientes.jsx b/src/pages/Expedientes.jsx index 401be41..2d8453f 100644 --- a/src/pages/Expedientes.jsx +++ b/src/pages/Expedientes.jsx @@ -82,6 +82,9 @@ export default function Documents() { const [selectedContributor, setSelectedContributor] = useState(''); const [loadingContributors, setLoadingContributors] = useState(false); + // Estado para agendar todo + const [isScheduling, setIsScheduling] = useState(false); + // Estado para controlar la animación de entrada const [showAnimation, setShowAnimation] = useState(false); const [hasAnimated, setHasAnimated] = useState(false); @@ -508,6 +511,26 @@ export default function Documents() { } }; + // Función para agendar todo + const handleScheduleAll = async () => { + setIsScheduling(true); + + try { + const endpoint = `${API_URL}/customs/auditor/procesar-pedimentos/organizaciones/`; + const result = await postWithAuth(endpoint, {}); + + showMessage('Pedimentos agendados exitosamente', 'success'); + + // Refrescar la lista después de agendar + refetch(); + } catch (error) { + console.error('Error al agendar pedimentos:', error); + showMessage(`Error al agendar pedimentos: ${error.message}`, 'error'); + } finally { + setIsScheduling(false); + } + }; + // Actualizar isSelectAll cuando cambia la selección useEffect(() => { if (currentDocuments.length > 0) { @@ -815,6 +838,23 @@ export default function Documents() { Agregar Expedientes +