150 lines
7.2 KiB
PHP
150 lines
7.2 KiB
PHP
<?php include __DIR__ . '/../partials/sidebar_importador.php'; ?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>📁 Expediente Electrónico</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
|
|
<style>
|
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f6f8fb; }
|
|
.content { margin-top: 56px; padding: 32px 20px; background-color: #f6f8fb; }
|
|
@media (min-width: 768px) { .content { margin-left: var(--sidebar-width, 280px); } }
|
|
.title { font-weight: 700; }
|
|
.kpi-card { border: 1px solid #e9ecef; border-radius: 12px; background: #fff; }
|
|
.kpi-value { font-size: 1.25rem; font-weight: 700; }
|
|
.search-wrap { gap: .75rem; }
|
|
.card-exp { border: 1px solid #eef1f5; border-radius: 14px; transition: box-shadow .2s ease, transform .2s ease; }
|
|
.card-exp:hover { box-shadow: 0 .75rem 1.5rem rgba(0,0,0,.08); transform: translateY(-2px); }
|
|
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .5rem; border-radius: 999px; font-size: .78rem; border: 1px solid #e5e7eb; background: #f8fafc; color: #334155; }
|
|
.chip i { font-size: .85rem; }
|
|
.muted { color: #6b7280; }
|
|
.ped-code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; letter-spacing: .5px; }
|
|
.actions .btn { border-radius: 10px; }
|
|
.empty-state { border: 2px dashed #cbd5e1; border-radius: 14px; padding: 32px; background: #fff; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<?php
|
|
$totalPed = count($expedientes ?? []);
|
|
$totalArch = 0; $totalSize = 0;
|
|
foreach(($expedientes ?? []) as $e){ $totalArch += (int)($e['total_archivos'] ?? 0); $totalSize += (float)($e['total_tamano'] ?? 0); }
|
|
?>
|
|
|
|
<div class="content">
|
|
<div class="d-flex flex-wrap align-items-end justify-content-between mb-3">
|
|
<div>
|
|
<h3 class="title mb-1">📁 Expediente electrónico</h3>
|
|
<div class="text-muted">Consulta y organiza los documentos por pedimento</div>
|
|
</div>
|
|
<div class="search-wrap d-flex align-items-center">
|
|
<input id="searchExp" type="search" class="form-control" placeholder="Buscar pedimento, proveedor o aduana">
|
|
<select id="filterArch" class="form-select">
|
|
<option value="all">Todos</option>
|
|
<option value="with">Con archivos</option>
|
|
<option value="without">Sin archivos</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row g-3 mb-4">
|
|
<div class="col-6 col-md-3">
|
|
<div class="kpi-card p-3">
|
|
<div class="muted">Pedimentos</div>
|
|
<div class="kpi-value"><?= (int)$totalPed ?></div>
|
|
</div>
|
|
</div>
|
|
<div class="col-6 col-md-3">
|
|
<div class="kpi-card p-3">
|
|
<div class="muted">Archivos</div>
|
|
<div class="kpi-value"><?= (int)$totalArch ?></div>
|
|
</div>
|
|
</div>
|
|
<div class="col-12 col-md-6">
|
|
<div class="kpi-card p-3 d-flex align-items-center justify-content-between">
|
|
<div>
|
|
<div class="muted">Tamaño total</div>
|
|
<div class="kpi-value"><?= number_format($totalSize, 2) ?> KB</div>
|
|
</div>
|
|
<div class="text-muted small">Incluye todos los archivos subidos a los pedimentos</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php if (empty($expedientes)): ?>
|
|
<div class="empty-state text-center">
|
|
<div class="mb-2">Aún no hay pedimentos listados.</div>
|
|
<div class="text-muted">Cuando importes pedimentos, podrás cargar y consultar documentos desde aquí.</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="row" id="gridExp">
|
|
<?php foreach ($expedientes as $exp):
|
|
$ff = $exp['fecha_factura'] ?? null;
|
|
$fecha = '-';
|
|
if ($ff instanceof DateTime) { $fecha = $ff->format('Y-m-d'); }
|
|
else if (is_array($ff) && isset($ff['date'])) { $fecha = substr($ff['date'],0,10); }
|
|
elseif ($ff) { $fecha = htmlspecialchars((string)$ff); }
|
|
$archCount = (int)($exp['total_archivos'] ?? 0);
|
|
$hasFiles = $archCount > 0;
|
|
?>
|
|
<div class="col-12 col-md-6 col-xl-4 exp-card"
|
|
data-key="<?= htmlspecialchars(($exp['pedimento_display'] ?? $exp['numero_pedimento'] ?? '').' '.($exp['proveedor'] ?? '').' '.($exp['aduana'] ?? '')) ?>"
|
|
data-files="<?= $hasFiles ? 'with' : 'without' ?>">
|
|
<div class="card-exp bg-white p-3 h-100">
|
|
<div class="d-flex align-items-center justify-content-between mb-2">
|
|
<div class="ped-code h5 mb-0"><?= htmlspecialchars($exp['pedimento_display'] ?? ($exp['numero_pedimento'] ?? '')) ?></div>
|
|
<span class="chip <?= $hasFiles ? 'border-success text-success' : ''?>">
|
|
<i class="fa-solid fa-paperclip"></i><?= $archCount ?> archivos
|
|
</span>
|
|
</div>
|
|
<div class="d-flex flex-wrap gap-2 mb-2">
|
|
<span class="chip"><i class="fa-solid fa-user-tie"></i><?= htmlspecialchars($exp['proveedor'] ?? '-') ?></span>
|
|
<span class="chip"><i class="fa-regular fa-calendar"></i><?= $fecha ?></span>
|
|
<span class="chip"><i class="fa-solid fa-warehouse"></i><?= htmlspecialchars($exp['aduana'] ?? '-') ?></span>
|
|
<span class="chip"><i class="fa-id-badge"></i><?= htmlspecialchars($exp['patente'] ?? '-') ?></span>
|
|
</div>
|
|
<div class="muted small mb-3">Tamaño: <?= number_format((float)($exp['total_tamano'] ?? 0), 2) ?> KB</div>
|
|
<div class="actions d-flex gap-2">
|
|
<a href="/IMPORTADORES/expediente/ver_pedimento/<?= (int)$exp['pedimento_id'] ?>" class="btn btn-outline-primary btn-sm flex-fill">
|
|
<i class="fa-regular fa-folder-open me-1"></i> Ver expediente
|
|
</a>
|
|
<a href="/IMPORTADORES/expediente/subir_pedimento/<?= (int)$exp['pedimento_id'] ?>" class="btn btn-outline-success btn-sm">
|
|
<i class="fa-solid fa-upload"></i>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<script>
|
|
(function(){
|
|
const q = document.getElementById('searchExp');
|
|
const f = document.getElementById('filterArch');
|
|
const cards = Array.from(document.querySelectorAll('#gridExp .exp-card'));
|
|
function apply(){
|
|
const term = (q?.value || '').toLowerCase();
|
|
const filt = f?.value || 'all';
|
|
cards.forEach(c => {
|
|
const key = (c.getAttribute('data-key')||'').toLowerCase();
|
|
const has = c.getAttribute('data-files');
|
|
const match = !term || key.includes(term);
|
|
const byFiles = (filt==='all') || (filt==='with' && has==='with') || (filt==='without' && has==='without');
|
|
c.style.display = (match && byFiles) ? '' : 'none';
|
|
});
|
|
}
|
|
q?.addEventListener('input', apply);
|
|
f?.addEventListener('change', apply);
|
|
apply();
|
|
})();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|