import React, { useState, useEffect } from 'react'; export default function Reports() { const tabs = [ { key: 'pedimentos', label: 'Generar Reporte de Pedimentos' }, { key: 'datastage', label: 'Generar Reporte de Datastage' }, { key: 'minimos', label: 'Generar Reporte de Mínimos' }, { key: 'coves', label: 'Generar Reporte de COVES' }, ]; // Columnas por tipo de reporte y tipo de registro para datastage const columnasPorTab = { pedimentos: [ { key: 'id', label: 'ID' }, { key: 'nombre', label: 'Nombre' }, { key: 'pedimento', label: 'Pedimento' }, { key: 'fecha', label: 'Fecha' }, { key: 'estado', label: 'Estado' }, ], datastage: { entrada: [ { key: 'id', label: 'ID' }, { key: 'nombre', label: 'Nombre' }, { key: 'fecha', label: 'Fecha' }, { key: 'usuario', label: 'Usuario' }, { key: 'entrada', label: 'Entrada' }, ], salida: [ { key: 'id', label: 'ID' }, { key: 'nombre', label: 'Nombre' }, { key: 'fecha', label: 'Fecha' }, { key: 'usuario', label: 'Usuario' }, { key: 'salida', label: 'Salida' }, ], proceso: [ { key: 'id', label: 'ID' }, { key: 'nombre', label: 'Nombre' }, { key: 'fecha', label: 'Fecha' }, { key: 'usuario', label: 'Usuario' }, { key: 'proceso', label: 'Proceso' }, ], default: [ { key: 'id', label: 'ID' }, { key: 'nombre', label: 'Nombre' }, { key: 'fecha', label: 'Fecha' }, { key: 'usuario', label: 'Usuario' }, ], }, minimos: [ { key: 'id', label: 'ID' }, { key: 'nombre', label: 'Nombre' }, { key: 'minimo', label: 'Mínimo' }, { key: 'fecha', label: 'Fecha' }, ], coves: [ { key: 'id', label: 'ID' }, { key: 'nombre', label: 'Nombre' }, { key: 'cove', label: 'COVE' }, { key: 'fecha', label: 'Fecha' }, ], }; const [activeTab, setActiveTab] = useState('pedimentos'); const [nombreReporte, setNombreReporte] = useState(''); const [columnas, setColumnas] = useState(['id', 'nombre']); const [fechaInicio, setFechaInicio] = useState(''); const [fechaFin, setFechaFin] = useState(''); const [pedimento, setPedimento] = useState(''); const [tipoRegistro, setTipoRegistro] = useState(''); const handleColumnaChange = (col) => { setColumnas((prev) => prev.includes(col) ? prev.filter((c) => c !== col) : [...prev, col] ); }; const handleGenerarReporte = (e) => { e.preventDefault(); alert(`Generando reporte: ${nombreReporte}\nTipo: ${activeTab}\nColumnas: ${columnas.join(', ')}\nPedimento: ${pedimento}\nFecha: ${fechaInicio} a ${fechaFin}`); }; // Reset columnas al cambiar de tab o tipo de registro en datastage useEffect(() => { if (activeTab === 'datastage') { if (tipoRegistro && columnasPorTab.datastage[tipoRegistro]) { setColumnas(['id', 'nombre']); } else { setColumnas(['id', 'nombre']); } } else { setColumnas(['id', 'nombre']); } }, [activeTab, tipoRegistro]); return (
Consulta y descarga reportes relacionados con el sistema.
Selecciona los campos y filtros que deseas incluir en tu reporte personalizado.
| ID | Nombre | Tipo | Pedimento | Fecha | Acciones |
|---|---|---|---|---|---|
| 1 | Reporte de usuarios | Usuarios | 12345678 | 2025-07-22 | |
| 2 | Reporte de documentos | Documentos | 87654321 | 2025-07-21 |