This commit is contained in:
2025-10-05 22:48:15 -06:00
parent bb0b11edbc
commit d09c99f1a9
6 changed files with 1136 additions and 132 deletions

View File

@@ -124,6 +124,7 @@ export default function PedimentoDetail() {
const [selected, setSelected] = useState([]);
const [downloading, setDownloading] = useState(false);
const [downloadingAll, setDownloadingAll] = useState(false);
const [dashboardSummary, setDashboardSummary] = useState(null);
const [showFilters, setShowFilters] = useState(false);
// Filtros simplificados de documentos (nuevo diseño)
@@ -205,6 +206,27 @@ export default function PedimentoDetail() {
const [processingEdoc, setProcessingEdoc] = useState(null);
const [processingAcuseEdoc, setProcessingAcuseEdoc] = useState(null);
// Función para obtener el resumen del dashboard
const fetchDashboardSummary = async () => {
try {
if (!pedimento) return;
const url = `${import.meta.env.VITE_EFC_API_URL}/reports/dashboard/summary/?organizacion_id=${pedimento.organizacion}&pedimento_app=${pedimento.pedimento_app}`;
const res = await fetchWithAuth(url);
if (!res.ok) {
throw new Error('Error al obtener el resumen del dashboard');
}
const data = await res.json();
setDashboardSummary(data);
} catch (err) {
console.error('Error obteniendo el resumen del dashboard:', err);
showMessage('Error al obtener el resumen del dashboard: ' + err.message, 'error');
}
};
// Función para obtener credenciales VUCEM
const fetchCredenciales = async (contribuyente) => {
try {
@@ -385,6 +407,9 @@ export default function PedimentoDetail() {
// Función para cambiar de pestaña
const handleTabChange = (tab) => {
setActiveTab(tab);
if (tab === 'auditor') {
fetchDashboardSummary();
}
};
// Handler SPA para paginación
@@ -3623,6 +3648,8 @@ export default function PedimentoDetail() {
Análisis Completo
</span>
</div>
{/* Botones de Auditoría */}
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-2 sm:gap-3 w-full lg:w-auto">
@@ -3720,63 +3747,255 @@ export default function PedimentoDetail() {
{/* Contenido del Auditor */}
<div className="space-y-6">
{/* Resumen de Estado */}
<div className="bg-gradient-to-r from-green-50 to-blue-50 rounded-xl p-6 border border-green-200">
<h4 className="text-lg font-semibold text-gray-900 mb-4 flex items-center">
<svg className="w-5 h-5 mr-2 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<div className="bg-gradient-to-b from-white to-gray-50 rounded-xl p-6 border border-gray-200 shadow-lg">
<h4 className="text-lg font-semibold text-gray-900 mb-6 flex items-center border-b pb-4">
<svg className="w-5 h-5 mr-2 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
Resumen de Estado del Pedimento
</h4>
{dashboardSummary ? (
<>
{/* Indicador de Cumplimiento Principal */}
<div className="mb-8">
<div className="flex items-center justify-between mb-2">
<span className="text-sm font-medium text-gray-600">Cumplimiento Total</span>
<span className="text-2xl font-bold text-blue-600">{dashboardSummary.cumplimiento_total.toFixed(1)}%</span>
</div>
<div className="w-full bg-gray-200 rounded-full h-2.5">
<div
className="bg-blue-600 h-2.5 rounded-full transition-all duration-500"
style={{ width: `${dashboardSummary.cumplimiento_total}%` }}
/>
</div>
</div>
{/* Grid de Estadísticas */}
<div className="grid grid-cols-2 lg:grid-cols-3 gap-6">
{/* Pedimentos */}
<div className="flex flex-col bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<div className="flex items-center justify-between mb-4">
<span className="text-sm font-medium text-gray-600">Pedimentos</span>
<div className="h-8 w-8 rounded-full bg-green-100 flex items-center justify-center">
<svg className="w-4 h-4 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
</div>
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Completos</span>
<span className="font-medium">{dashboardSummary.pedimentos.completos}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Pendientes</span>
<span className="font-medium text-yellow-600">{dashboardSummary.pedimentos.pendientes}</span>
</div>
<div className="pt-2 border-t">
<div className="flex justify-between items-center">
<span className="text-xs text-gray-500">Cumplimiento</span>
<span className="text-sm font-semibold text-green-600">{dashboardSummary.pedimentos.cumplimiento.toFixed(1)}%</span>
</div>
<div className="w-full bg-gray-100 rounded-full h-1.5 mt-1">
<div className="bg-green-500 h-1.5 rounded-full" style={{ width: `${dashboardSummary.pedimentos.cumplimiento}%` }} />
</div>
</div>
</div>
</div>
{/* COVEs */}
<div className="flex flex-col bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<div className="flex items-center justify-between mb-4">
<span className="text-sm font-medium text-gray-600">COVEs</span>
<div className="h-8 w-8 rounded-full bg-purple-100 flex items-center justify-center">
<svg className="w-4 h-4 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
</div>
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Procesados</span>
<span className="font-medium">{dashboardSummary?.coves?.coves_procesados || 0}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Pendientes</span>
<span className="font-medium text-yellow-600">{dashboardSummary?.coves?.coves_pendientes || 0}</span>
</div>
<div className="pt-2 border-t">
<div className="flex justify-between items-center">
<span className="text-xs text-gray-500">Cumplimiento</span>
<span className="text-sm font-semibold text-purple-600">{(dashboardSummary?.coves?.coves_cumplimiento || 0).toFixed(1)}%</span>
</div>
<div className="w-full bg-gray-100 rounded-full h-1.5 mt-1">
<div className="bg-purple-500 h-1.5 rounded-full" style={{ width: `${dashboardSummary?.coves?.coves_cumplimiento || 0}%` }} />
</div>
</div>
</div>
</div>
{/* Acuses de COVEs */}
<div className="flex flex-col bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<div className="flex items-center justify-between mb-4">
<span className="text-sm font-medium text-gray-600">Acuses de COVEs</span>
<div className="h-8 w-8 rounded-full bg-indigo-100 flex items-center justify-center">
<svg className="w-4 h-4 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M5 13l4 4L19 7" />
</svg>
</div>
</div>
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Procesados</span>
<span className="font-medium">{dashboardSummary?.acuse_coves?.acuse_coves_procesados || 0}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Pendientes</span>
<span className="font-medium text-yellow-600">{dashboardSummary?.acuse_coves?.acuse_coves_pendientes || 0}</span>
</div>
<div className="pt-2 border-t">
<div className="flex justify-between items-center">
<span className="text-xs text-gray-500">Cumplimiento</span>
<span className="text-sm font-semibold text-indigo-600">{(dashboardSummary?.acuse_coves?.acuse_coves_cumplimiento || 0).toFixed(1)}%</span>
</div>
<div className="w-full bg-gray-100 rounded-full h-1.5 mt-1">
<div className="bg-indigo-500 h-1.5 rounded-full" style={{ width: `${dashboardSummary?.acuse_coves?.acuse_coves_cumplimiento || 0}%` }} />
</div>
</div>
</div>
</div>
{/* E-Documents */}
<div className="flex flex-col bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<div className="flex items-center justify-between mb-4">
<span className="text-sm font-medium text-gray-600">E-Documents</span>
<div className="h-8 w-8 rounded-full bg-blue-100 flex items-center justify-center">
<svg className="w-4 h-4 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
</div>
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Descargados</span>
<span className="font-medium">{dashboardSummary.edocuments.edocs_descargados}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Pendientes</span>
<span className="font-medium text-yellow-600">{dashboardSummary.edocuments.edocs_pendientes}</span>
</div>
<div className="pt-2 border-t">
<div className="flex justify-between items-center">
<span className="text-xs text-gray-500">Cumplimiento</span>
<span className="text-sm font-semibold text-blue-600">{dashboardSummary.edocuments.edocs_cumplimiento.toFixed(1)}%</span>
</div>
<div className="w-full bg-gray-100 rounded-full h-1.5 mt-1">
<div className="bg-blue-500 h-1.5 rounded-full" style={{ width: `${dashboardSummary.edocuments.edocs_cumplimiento}%` }} />
</div>
</div>
</div>
</div>
{/* Acuses */}
<div className="flex flex-col bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<div className="flex items-center justify-between mb-4">
<span className="text-sm font-medium text-gray-600">Acuses</span>
<div className="h-8 w-8 rounded-full bg-indigo-100 flex items-center justify-center">
<svg className="w-4 h-4 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M5 13l4 4L19 7" />
</svg>
</div>
</div>
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Descargados</span>
<span className="font-medium">{dashboardSummary?.acuses?.acuse_descargados || 0}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Pendientes</span>
<span className="font-medium text-yellow-600">{dashboardSummary?.acuses?.acuses_pendientes || 0}</span>
</div>
<div className="pt-2 border-t">
<div className="flex justify-between items-center">
<span className="text-xs text-gray-500">Cumplimiento</span>
<span className="text-sm font-semibold text-indigo-600">{(dashboardSummary?.acuses?.acuses_cumplimiento || 0).toFixed(1)}%</span>
</div>
<div className="w-full bg-gray-100 rounded-full h-1.5 mt-1">
<div className="bg-indigo-500 h-1.5 rounded-full" style={{ width: `${dashboardSummary?.acuses?.acuses_cumplimiento || 0}%` }} />
</div>
</div>
</div>
</div>
{/* Partidas */}
<div className="flex flex-col bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<div className="flex items-center justify-between mb-4">
<span className="text-sm font-medium text-gray-600">Partidas</span>
<div className="h-8 w-8 rounded-full bg-orange-100 flex items-center justify-center">
<svg className="w-4 h-4 text-orange-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
</div>
<div className="space-y-2">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Descargadas</span>
<span className="font-medium">{dashboardSummary.partidas.partidas_descargadas}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Pendientes</span>
<span className="font-medium text-yellow-600">{dashboardSummary.partidas.partidas_pendientes}</span>
</div>
<div className="pt-2 border-t">
<div className="flex justify-between items-center">
<span className="text-xs text-gray-500">Cumplimiento</span>
<span className="text-sm font-semibold text-orange-600">{dashboardSummary.partidas.cumplimiento.toFixed(1)}%</span>
</div>
<div className="w-full bg-gray-100 rounded-full h-1.5 mt-1">
<div className="bg-orange-500 h-1.5 rounded-full" style={{ width: `${dashboardSummary.partidas.cumplimiento}%` }} />
</div>
</div>
</div>
</div>
{/* Estadísticas Generales */}
<div className="flex flex-col bg-white rounded-lg p-4 border border-gray-200 shadow-sm">
<div className="flex items-center justify-between mb-4">
<span className="text-sm font-medium text-gray-600">Estadísticas Generales</span>
<div className="h-8 w-8 rounded-full bg-gray-100 flex items-center justify-center">
<svg className="w-4 h-4 text-gray-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
</svg>
</div>
</div>
<div className="space-y-3">
<div className="flex justify-between text-sm">
<span className="text-gray-600">Total Documentos</span>
<span className="font-medium">{dashboardSummary.documentos.descargados}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Total Remesas</span>
<span className="font-medium">{dashboardSummary.remesas.total}</span>
</div>
<div className="flex justify-between text-sm">
<span className="text-gray-600">Total Partidas</span>
<span className="font-medium">{dashboardSummary.partidas.total}</span>
</div>
</div>
</div>
</div>
</>
) : (
<div className="text-center py-4">
<svg className="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<h3 className="mt-2 text-sm font-medium text-gray-900">No hay datos disponibles</h3>
<p className="mt-1 text-sm text-gray-500">Intente recargar la página o contacte a soporte si el problema persiste.</p>
</div>
)}
<div className="grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4">
<div className="bg-white rounded-lg p-4 shadow-sm border">
<div className="flex items-center justify-between">
<div>
<p className="text-sm font-medium text-gray-600">Documentos</p>
<p className="text-2xl font-bold text-blue-600">{docsCount || 0}</p>
</div>
<svg className="w-8 h-8 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
</div>
<div className="bg-white rounded-lg p-4 shadow-sm border">
<div className="flex items-center justify-between">
<div>
<p className="text-sm font-medium text-gray-600">COVEs</p>
<p className="text-2xl font-bold text-purple-600">{covesCount || 0}</p>
</div>
<svg className="w-8 h-8 text-purple-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 17V7m0 10a2 2 0 01-2 2H5a2 2 0 01-2-2V7a2 2 0 012-2h2a2 2 0 012 2m0 10a2 2 0 002 2h2a2 2 0 002-2M9 7a2 2 0 012-2h2a2 2 0 012 2m0 0V17m0-10a2 2 0 012-2h2a2 2 0 002-2M13 7h2a2 2 0 012 2v6a2 2 0 01-2 2h-2v4" />
</svg>
</div>
</div>
<div className="bg-white rounded-lg p-4 shadow-sm border">
<div className="flex items-center justify-between">
<div>
<p className="text-sm font-medium text-gray-600">EDocs</p>
<p className="text-2xl font-bold text-teal-600">{edocsCount || 0}</p>
</div>
<svg className="w-8 h-8 text-teal-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
</div>
<div className="bg-white rounded-lg p-4 shadow-sm border">
<div className="flex items-center justify-between">
<div>
<p className="text-sm font-medium text-gray-600">Procesos</p>
<p className="text-2xl font-bold text-orange-600">{procesosCount || 0}</p>
</div>
<svg className="w-8 h-8 text-orange-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 5H7a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4" />
</svg>
</div>
</div>
</div>
</div>
{/* Análisis de Integridad */}
@@ -3788,36 +4007,193 @@ export default function PedimentoDetail() {
Análisis de Integridad
</h4>
<div className="space-y-4">
<div className="flex items-center justify-between p-4 bg-green-50 border border-green-200 rounded-lg">
<div className="flex items-center">
<svg className="w-5 h-5 text-green-600 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M5 13l4 4L19 7" />
</svg>
<span className="font-medium text-green-800">Documentos Requeridos</span>
</div>
<span className="text-green-600 font-semibold">Completo</span>
</div>
<div className="flex items-center justify-between p-4 bg-blue-50 border border-blue-200 rounded-lg">
<div className="flex items-center">
<svg className="w-5 h-5 text-blue-600 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span className="font-medium text-blue-800">Validación de Estructura</span>
</div>
<span className="text-blue-600 font-semibold">Verificado</span>
</div>
<div className="flex items-center justify-between p-4 bg-purple-50 border border-purple-200 rounded-lg">
<div className="flex items-center">
<svg className="w-5 h-5 text-purple-600 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z" />
</svg>
<span className="font-medium text-purple-800">Seguridad y Firmas</span>
</div>
<span className="text-purple-600 font-semibold">Auditado</span>
</div>
<div className="space-y-6">
{dashboardSummary && (
<>
{/* Estado General del Pedimento */}
<div className="flex items-center justify-between p-4 bg-gray-50 border border-gray-200 rounded-lg">
<div className="flex items-center space-x-4">
<div className={`p-2 rounded-full ${
dashboardSummary.cumplimiento_total >= 100 ? 'bg-green-100' :
dashboardSummary.cumplimiento_total >= 75 ? 'bg-yellow-100' :
'bg-red-100'
}`}>
<svg className={`w-6 h-6 ${
dashboardSummary.cumplimiento_total >= 100 ? 'text-green-600' :
dashboardSummary.cumplimiento_total >= 75 ? 'text-yellow-600' :
'text-red-600'
}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2"
d={dashboardSummary.cumplimiento_total >= 100
? "M5 13l4 4L19 7" // check mark
: dashboardSummary.cumplimiento_total >= 75
? "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" // warning
: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" // error
}
/>
</svg>
</div>
<div>
<h5 className="font-medium text-gray-900">Estado del Pedimento</h5>
<p className="text-sm text-gray-500">
{dashboardSummary.cumplimiento_total >= 100
? 'Todos los documentos y validaciones están completos'
: dashboardSummary.cumplimiento_total >= 75
? 'El pedimento requiere atención en algunos aspectos'
: 'Se requiere atención urgente en varios aspectos'}
</p>
</div>
</div>
<div className="text-right">
<span className={`inline-flex items-center px-3 py-1 rounded-full text-sm font-medium ${
dashboardSummary.cumplimiento_total >= 100 ? 'bg-green-100 text-green-800' :
dashboardSummary.cumplimiento_total >= 75 ? 'bg-yellow-100 text-yellow-800' :
'bg-red-100 text-red-800'
}`}>
{dashboardSummary.cumplimiento_total.toFixed(1)}% Completado
</span>
</div>
</div>
{/* Análisis Detallado */}
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{/* Documentos Base */}
<div className={`p-4 rounded-lg border ${
dashboardSummary.pedimentos.cumplimiento >= 100 ? 'bg-green-50 border-green-200' : 'bg-yellow-50 border-yellow-200'
}`}>
<div className="flex items-start">
<svg className={`w-5 h-5 mt-0.5 mr-3 ${
dashboardSummary.pedimentos.cumplimiento >= 100 ? 'text-green-600' : 'text-yellow-600'
}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
<div>
<h6 className={`font-medium ${
dashboardSummary.pedimentos.cumplimiento >= 100 ? 'text-green-800' : 'text-yellow-800'
}`}>Documentos Base</h6>
<p className="text-sm text-gray-600 mt-1">
{`${dashboardSummary.pedimentos.completos} de ${dashboardSummary.pedimentos.total} documentos procesados`}
</p>
</div>
</div>
</div>
{/* Validación de COVEs */}
<div className={`p-4 rounded-lg border ${
(dashboardSummary.coves.coves_cumplimiento >= 100 &&
dashboardSummary.acuse_coves.acuse_coves_cumplimiento >= 100) ?
'bg-green-50 border-green-200' : 'bg-yellow-50 border-yellow-200'
}`}>
<div className="flex items-start">
<svg className={`w-5 h-5 mt-0.5 mr-3 ${
(dashboardSummary.coves.coves_cumplimiento >= 100 &&
dashboardSummary.acuse_coves.acuse_coves_cumplimiento >= 100) ?
'text-green-600' : 'text-yellow-600'
}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<div>
<h6 className={`font-medium ${
(dashboardSummary.coves.coves_cumplimiento >= 100 &&
dashboardSummary.acuse_coves.acuse_coves_cumplimiento >= 100) ?
'text-green-800' : 'text-yellow-800'
}`}>Validación de COVEs</h6>
<div className="space-y-1 mt-1">
<p className="text-sm text-gray-600">
{`COVEs: ${dashboardSummary.coves.coves_procesados} de ${dashboardSummary.coves.total} procesados`}
</p>
<p className="text-sm text-gray-600">
{`Acuses: ${dashboardSummary.acuse_coves.acuse_coves_procesados} de ${dashboardSummary.acuse_coves.total} procesados`}
</p>
</div>
</div>
</div>
</div>
{/* E-Documents y Acuses */}
<div className={`p-4 rounded-lg border ${
(dashboardSummary.edocuments.edocs_cumplimiento >= 100 &&
dashboardSummary.acuses.acuses_cumplimiento >= 100) ?
'bg-green-50 border-green-200' : 'bg-yellow-50 border-yellow-200'
}`}>
<div className="flex items-start">
<svg className={`w-5 h-5 mt-0.5 mr-3 ${
(dashboardSummary.edocuments.edocs_cumplimiento >= 100 &&
dashboardSummary.acuses.acuses_cumplimiento >= 100) ?
'text-green-600' : 'text-yellow-600'
}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M8 7v8a2 2 0 002 2h6M8 7V5a2 2 0 012-2h4.586a1 1 0 01.707.293l4.414 4.414a1 1 0 01.293.707V15a2 2 0 01-2 2h-2M8 7H6a2 2 0 00-2 2v10a2 2 0 002 2h8a2 2 0 002-2v-2" />
</svg>
<div>
<h6 className={`font-medium ${
(dashboardSummary.edocuments.edocs_cumplimiento >= 100 &&
dashboardSummary.acuses.acuses_cumplimiento >= 100) ?
'text-green-800' : 'text-yellow-800'
}`}>E-Documents y Acuses</h6>
<div className="space-y-1 mt-1">
<p className="text-sm text-gray-600">
{`E-Docs: ${dashboardSummary.edocuments.edocs_descargados} de ${dashboardSummary.edocuments.total} descargados`}
</p>
<p className="text-sm text-gray-600">
{`Acuses: ${dashboardSummary.acuses.acuse_descargados} de ${dashboardSummary.acuses.total} descargados`}
</p>
</div>
</div>
</div>
</div>
{/* Partidas */}
<div className={`p-4 rounded-lg border ${
dashboardSummary.partidas.cumplimiento >= 100 ? 'bg-green-50 border-green-200' : 'bg-yellow-50 border-yellow-200'
}`}>
<div className="flex items-start">
<svg className={`w-5 h-5 mt-0.5 mr-3 ${
dashboardSummary.partidas.cumplimiento >= 100 ? 'text-green-600' : 'text-yellow-600'
}`} fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
<div>
<h6 className={`font-medium ${
dashboardSummary.partidas.cumplimiento >= 100 ? 'text-green-800' : 'text-yellow-800'
}`}>Validación de Partidas</h6>
<p className="text-sm text-gray-600 mt-1">
{`${dashboardSummary.partidas.partidas_descargadas} de ${dashboardSummary.partidas.total} partidas procesadas`}
</p>
</div>
</div>
</div>
</div>
{/* Recomendaciones */}
{(dashboardSummary.cumplimiento_total < 100) && (
<div className="mt-4 p-4 bg-blue-50 border border-blue-200 rounded-lg">
<h6 className="font-medium text-blue-800 mb-2 flex items-center">
<svg className="w-5 h-5 mr-2 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
Recomendaciones
</h6>
<ul className="space-y-2 text-sm text-blue-900">
{dashboardSummary.coves.coves_cumplimiento < 100 && (
<li> Procesar los COVEs pendientes ({dashboardSummary.coves.coves_pendientes} restantes)</li>
)}
{dashboardSummary.acuse_coves.acuse_coves_cumplimiento < 100 && (
<li> Obtener los acuses de COVEs faltantes ({dashboardSummary.acuse_coves.acuse_coves_pendientes} restantes)</li>
)}
{dashboardSummary.edocuments.edocs_cumplimiento < 100 && (
<li> Completar la descarga de E-Documents ({dashboardSummary.edocuments.edocs_pendientes} pendientes)</li>
)}
{dashboardSummary.acuses.acuses_cumplimiento < 100 && (
<li> Obtener los acuses de E-Documents ({dashboardSummary.acuses.acuses_pendientes} pendientes)</li>
)}
{dashboardSummary.partidas.cumplimiento < 100 && (
<li> Procesar las partidas pendientes ({dashboardSummary.partidas.partidas_pendientes} restantes)</li>
)}
</ul>
</div>
)}
</>
)}
</div>
</div>
@@ -3829,52 +4205,16 @@ export default function PedimentoDetail() {
</svg>
Timeline de Actividades Recientes
</h4>
<div className="space-y-4">
<div className="flex items-start">
<div className="flex-shrink-0">
<div className="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center">
<svg className="w-4 h-4 text-green-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M5 13l4 4L19 7" />
</svg>
</div>
</div>
<div className="ml-4 flex-1">
<p className="text-sm font-medium text-gray-900">Pedimento procesado correctamente</p>
<p className="text-sm text-gray-500">Todos los documentos han sido validados y procesados</p>
<p className="text-xs text-gray-400 mt-1">{new Date().toLocaleDateString('es-ES')}</p>
</div>
</div>
<div className="flex items-start">
<div className="flex-shrink-0">
<div className="w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center">
<svg className="w-4 h-4 text-blue-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
</svg>
</div>
</div>
<div className="ml-4 flex-1">
<p className="text-sm font-medium text-gray-900">Documentos cargados</p>
<p className="text-sm text-gray-500">Se han cargado {docsCount || 0} documentos al expediente</p>
<p className="text-xs text-gray-400 mt-1">{pedimento?.created_at ? new Date(pedimento.created_at).toLocaleDateString('es-ES') : 'Fecha no disponible'}</p>
</div>
</div>
<div className="flex items-start">
<div className="flex-shrink-0">
<div className="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center">
<svg className="w-4 h-4 text-purple-600" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
</svg>
</div>
</div>
<div className="ml-4 flex-1">
<p className="text-sm font-medium text-gray-900">Expediente creado</p>
<p className="text-sm text-gray-500">Expediente #{pedimento?.pedimento_app || 'N/A'} iniciado</p>
<p className="text-xs text-gray-400 mt-1">{pedimento?.created_at ? new Date(pedimento.created_at).toLocaleDateString('es-ES') : 'Fecha no disponible'}</p>
</div>
<div className="flex flex-col items-center justify-center py-6">
<div className="w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mb-4">
<svg className="w-8 h-8 text-blue-600 animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
</div>
<p className="text-lg font-medium text-gray-900">Trabajando en ello</p>
<p className="text-sm text-gray-500 mt-2">Estamos preparando el historial de actividades</p>
<p className="text-sm text-blue-600 mt-4">Esta funcionalidad estará disponible próximamente</p>
</div>
</div>
</div>