386 lines
19 KiB
PHP
386 lines
19 KiB
PHP
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
<style>
|
|
/* Estilos inspirados en Tailwind */
|
|
.sidebar-container { background-color: #f9fafb; border-right: 1px solid #e5e7eb; }
|
|
.sidebar-dark { background-color: #1f2937; border-right: 1px solid #374151; }
|
|
.sidebar-nav .nav-link { color: #374151; font-weight: 500; padding: 0.5rem 0.75rem; margin-bottom: 0.125rem;
|
|
border-radius: 0.5rem; transition: all 0.15s ease-in-out; display: flex; align-items: center; }
|
|
.sidebar-nav .nav-link:hover { background-color: #f3f4f6; color: #111827; }
|
|
.sidebar-nav .nav-link.active { background-color: #f3f4f6; color: #111827; }
|
|
.sidebar-nav .nav-link .icon { width: 1.25rem; height: 1.25rem; margin-right: 0.75rem; color: #6b7280; transition: color 0.15s ease-in-out; flex-shrink: 0; }
|
|
.sidebar-nav .nav-link:hover .icon,
|
|
.sidebar-nav .nav-link.active .icon { color: #374151; }
|
|
.sidebar-nav .badge { background-color: #f3f4f6; color: #374151; font-size: 0.75rem; font-weight: 500; padding: 0.25rem 0.5rem; border-radius: 9999px; margin-left: auto; }
|
|
.sidebar-nav .badge.badge-primary { background-color: #dbeafe; color: #1e40af; }
|
|
.submenu .nav-link { padding-left: 2.75rem; color: #6b7280; font-weight: 400; }
|
|
.submenu .nav-link:hover { background-color: #f3f4f6; color: #374151; }
|
|
.submenu .nav-link.active { background-color: #f3f4f6; color: #374151; }
|
|
.collapse-icon { width: 0.75rem; height: 0.75rem; margin-left: auto; transition: transform 0.15s ease-in-out; }
|
|
.nav-link[aria-expanded="true"] .collapse-icon { transform: rotate(180deg); }
|
|
/* Estilos para modo oscuro */
|
|
.sidebar-dark .sidebar-nav .nav-link { color: #d1d5db; }
|
|
.sidebar-dark .sidebar-nav .nav-link:hover { background-color: #374151; color: #ffffff; }
|
|
.sidebar-dark .sidebar-nav .nav-link.active { background-color: #374151; color: #ffffff; }
|
|
.sidebar-dark .sidebar-nav .nav-link .icon { color: #9ca3af; }
|
|
.sidebar-dark .sidebar-nav .nav-link:hover .icon,
|
|
.sidebar-dark .sidebar-nav .nav-link.active .icon { color: #ffffff; }
|
|
.sidebar-dark .sidebar-nav .badge { background-color: #374151; color: #d1d5db; }
|
|
.sidebar-dark .sidebar-nav .badge.badge-primary { background-color: #1e3a8a; color: #93c5fd; }
|
|
.sidebar-dark .submenu .nav-link { color: #9ca3af; }
|
|
.sidebar-dark .submenu .nav-link:hover { background-color: #374151; color: #d1d5db; }
|
|
.sidebar-dark .submenu .nav-link.active { background-color: #374151; color: #d1d5db; }
|
|
/* Navbar */
|
|
.navbar-brand { font-weight: 600; font-size: 1.125rem; }
|
|
.menu-toggle { border: 1px solid #6b7280; border-radius: 0.5rem; padding: 0.5rem; transition: all 0.15s ease-in-out; }
|
|
.menu-toggle:hover { background-color: #f3f4f6; }
|
|
/* Offcanvas para móviles */
|
|
.offcanvas { background-color: #ffffff; }
|
|
.offcanvas-header { border-bottom: 1px solid #e5e7eb; padding: 1rem 1.5rem; }
|
|
.offcanvas-title { font-weight: 600; font-size: 1.125rem; color: #111827; }
|
|
.offcanvas-body { padding: 1rem 1.5rem; }
|
|
/* Responsive adjustments */
|
|
@media (max-width: 767.98px) {
|
|
.sidebar-nav .nav-link { color: #374151; }
|
|
.sidebar-nav .nav-link:hover { background-color: #f3f4f6; color: #111827; }
|
|
.sidebar-nav .nav-link.active { background-color: #f3f4f6; color: #111827; }
|
|
}
|
|
</style>
|
|
|
|
<!-- 🔷 NAVBAR -->
|
|
<nav class="navbar navbar-dark bg-dark fixed-top">
|
|
<div class="container-fluid">
|
|
<!-- Botón de menú para móviles -->
|
|
<button class="menu-toggle d-md-none me-3" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarMenu">
|
|
☰
|
|
</button>
|
|
<span class="navbar-brand">SIIH | Agencia Aduanal</span>
|
|
<div class="d-flex ms-auto text-white">
|
|
<div class="navbar-content">
|
|
<?php
|
|
// Verifica si estás en el dashboard principal del importador
|
|
$esDashboard = str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/agencias/dashboard');
|
|
|
|
if ($esDashboard): ?>
|
|
<span id="welcome-text">Bienvenido, <?= htmlspecialchars($_SESSION['usuario_nombre']) ?></span>
|
|
<?php else: ?>
|
|
<a href="/IMPORTADORES/sistemas/logout" class="btn btn-outline-light btn-sm ms-2 W-auto btn-animated">Cerrar Sesión</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- SIDEBAR FIJA (escritorio) -->
|
|
<div class="d-none d-md-block sidebar-container sidebar-dark position-fixed h-100" style="width: 250px; top: 0; padding-top: 4rem; z-index: 1000;">
|
|
<div class="px-3 py-4 h-100 overflow-y-auto">
|
|
<nav class="sidebar-nav">
|
|
<ul class="nav flex-column">
|
|
<!-- INICIO -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/agencias/dashboard" class="nav-link active">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 22 21">
|
|
<path d="M16.975 11H10V4.025a1 1 0 0 0-1.066-.998 8.5 8.5 0 1 0 9.039 9.039.999.999 0 0 0-1-1.066h.002Z"/>
|
|
<path d="M12.5 0c-.157 0-.311.01-.565.027A1 1 0 0 0 11 1.02V10h8.975a1 1 0 0 0 1-.935c.013-.188.028-.374.028-.565A8.51 8.51 0 0 0 12.5 0Z"/>
|
|
</svg>
|
|
<span>Inicio</span>
|
|
</a>
|
|
</li>
|
|
<!-- SOLICITUDES VINCULACIÓN -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/vinculaciones/solicitudesVinculacion" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path d="M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5z"/>
|
|
<path d="M7.414 15.414a2 2 0 01-2.828-2.828l3-3a2 2 0 012.828 0 1 1 0 001.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5z"/>
|
|
</svg>
|
|
<span>Vinculación</span>
|
|
</a>
|
|
</li>
|
|
<!-- USUARIOS VINCULADOS -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/vinculaciones/vinculacionesAgencia" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path d="M14 2a3.963 3.963 0 0 0-1.4.267 6.439 6.439 0 0 1-1.331 6.638A4 4 0 1 0 14 2Zm1 9h-1.264A6.957 6.957 0 0 1 15 15v2a2.97 2.97 0 0 1-.184 1H19a1 1 0 0 0 1-1v-1a5.006 5.006 0 0 0-5-5ZM6.5 9a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9ZM8 10H5a5.006 5.006 0 0 0-5 5v2a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-2a5.006 5.006 0 0 0-5-5Z"/>
|
|
</svg>
|
|
<span>Usuarios Vinculados</span>
|
|
</a>
|
|
</li>
|
|
<!-- Patentes -->
|
|
<li class="nav-item">
|
|
<a class="nav-link" data-bs-toggle="collapse" href="#submenuPatentesDesktop" role="button" aria-expanded="false" aria-controls="submenuPatentesDesktop">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<span>Patentes</span>
|
|
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 10 6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
|
</svg>
|
|
</a>
|
|
<div class="collapse" id="submenuPatentesDesktop">
|
|
<ul class="nav flex-column submenu">
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/patente/lista" class="nav-link">
|
|
Ver Patentes
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/patente/alta" class="nav-link">
|
|
Nueva Patente
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
<!-- LOCACIONES -->
|
|
<li class="nav-item">
|
|
<a class="nav-link" data-bs-toggle="collapse" href="#submenuLocacionesDesktop" role="button" aria-expanded="false" aria-controls="submenuLocacionesDesktop">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path d="M10 2C6.686 2 4 4.686 4 8c0 5.25 6 12 6 12s6-6.75 6-12c0-3.314-2.686-6-6-6zm0 8c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"/>
|
|
</svg>
|
|
<span>Locaciones</span>
|
|
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 10 6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
|
</svg>
|
|
</a>
|
|
<div class="collapse" id="submenuLocacionesDesktop">
|
|
<ul class="nav flex-column submenu">
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/locaciones/lista" class="nav-link">
|
|
Ver Locaciones
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/locaciones/alta" class="nav-link">
|
|
Agregar Locaciones
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
<!-- ALTA DE AGENTES -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/agencias/alta" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<span>Alta de agentes</span>
|
|
</a>
|
|
</li>
|
|
<!-- CONFIGURACIÓN -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/configuracion" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M11.983 1.034a1 1 0 00-1.966 0l-.26 1.857a6.996 6.996 0 00-1.223.51l-1.7-1.04a1 1 0 00-1.366.366l-1 1.732a1 1 0 00.366 1.366l1.7 1.04a6.984 6.984 0 000 1.02l-1.7 1.04a1 1 0 00-.366 1.366l1 1.732a1 1 0 001.366.366l1.7-1.04c.392.212.803.386 1.223.51l.26 1.857a1 1 0 001.966 0l.26-1.857c.42-.124.831-.298 1.223-.51l1.7 1.04a1 1 0 001.366-.366l1-1.732a1 1 0 00-.366-1.366l-1.7-1.04a6.984 6.984 0 000-1.02l1.7-1.04a1 1 0 00.366-1.366l-1-1.732a1 1 0 00-1.366-.366l-1.7 1.04a6.996 6.996 0 00-1.223-.51l-.26-1.857zM10 13a3 3 0 100-6 3 3 0 000 6z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<span>Configuración</span>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- OFFCANVAS PARA MÓVILES -->
|
|
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 0; width: 250px;">
|
|
<div class="offcanvas-header">
|
|
<h5 class="offcanvas-title">Menú</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="offcanvas"></button>
|
|
</div>
|
|
<div class="offcanvas-body">
|
|
<nav class="sidebar-nav">
|
|
<ul class="nav flex-column">
|
|
<!-- INICIO -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/agentes/dashboard" class="nav-link active">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 22 21">
|
|
<path d="M16.975 11H10V4.025a1 1 0 0 0-1.066-.998 8.5 8.5 0 1 0 9.039 9.039.999.999 0 0 0-1-1.066h.002Z"/>
|
|
<path d="M12.5 0c-.157 0-.311.01-.565.027A1 1 0 0 0 11 1.02V10h8.975a1 1 0 0 0 1-.935c.013-.188.028-.374.028-.565A8.51 8.51 0 0 0 12.5 0Z"/>
|
|
</svg>
|
|
<span>Inicio</span>
|
|
</a>
|
|
</li>
|
|
<!-- SOLICITUDES VINCULACIÓN -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/vinculaciones/solicitudesVinculacion" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path d="M12.586 4.586a2 2 0 112.828 2.828l-3 3a2 2 0 01-2.828 0 1 1 0 00-1.414 1.414 4 4 0 005.656 0l3-3a4 4 0 00-5.656-5.656l-1.5 1.5a1 1 0 101.414 1.414l1.5-1.5z"/>
|
|
<path d="M7.414 15.414a2 2 0 01-2.828-2.828l3-3a2 2 0 012.828 0 1 1 0 001.414-1.414 4 4 0 00-5.656 0l-3 3a4 4 0 105.656 5.656l1.5-1.5a1 1 0 10-1.414-1.414l-1.5 1.5z"/>
|
|
</svg>
|
|
<span>Vinculación</span>
|
|
</a>
|
|
</li>
|
|
<!-- USUARIOS VINCULADOS -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/vinculaciones/vinculacionesAgencia" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path d="M14 2a3.963 3.963 0 0 0-1.4.267 6.439 6.439 0 0 1-1.331 6.638A4 4 0 1 0 14 2Zm1 9h-1.264A6.957 6.957 0 0 1 15 15v2a2.97 2.97 0 0 1-.184 1H19a1 1 0 0 0 1-1v-1a5.006 5.006 0 0 0-5-5ZM6.5 9a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9ZM8 10H5a5.006 5.006 0 0 0-5 5v2a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1v-2a5.006 5.006 0 0 0-5-5Z"/>
|
|
</svg>
|
|
<span>Usuarios Vinculados</span>
|
|
</a>
|
|
</li>
|
|
<!-- Patentes -->
|
|
<li class="nav-item">
|
|
<a class="nav-link" data-bs-toggle="collapse" href="#submenuPatentesMobile" role="button" aria-expanded="false" aria-controls="submenuPatentesMobile">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<span>Patentes</span>
|
|
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 10 6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
|
</svg>
|
|
</a>
|
|
<div class="collapse" id="submenuPatentesMobile">
|
|
<ul class="nav flex-column submenu">
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/patente/lista" class="nav-link">
|
|
Ver Patentes
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/patente/alta" class="nav-link">
|
|
Nueva Patente
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
<!-- LOCACIONES -->
|
|
<li class="nav-item">
|
|
<a class="nav-link" data-bs-toggle="collapse" href="#submenuLocacionesMobile" role="button" aria-expanded="false" aria-controls="submenuLocacionesMobile">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path d="M10 2C6.686 2 4 4.686 4 8c0 5.25 6 12 6 12s6-6.75 6-12c0-3.314-2.686-6-6-6zm0 8c-1.105 0-2-.895-2-2s.895-2 2-2 2 .895 2 2-.895 2-2 2z"/>
|
|
</svg>
|
|
<span>Locaciones</span>
|
|
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 10 6">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 4 4 4-4"/>
|
|
</svg>
|
|
</a>
|
|
<div class="collapse" id="submenuLocacionesMobile">
|
|
<ul class="nav flex-column submenu">
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/locaciones/lista" class="nav-link">
|
|
Ver Locaciones
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/locaciones/alta" class="nav-link">
|
|
Agregar Locaciones
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</li>
|
|
<!-- ALTA DE AGENTES -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/agencias/alta" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<span>Alta de agentes</span>
|
|
</a>
|
|
</li>
|
|
<!-- CONFIGURACIÓN -->
|
|
<li class="nav-item">
|
|
<a href="/IMPORTADORES/configuracion" class="nav-link">
|
|
<svg class="icon" fill="currentColor" viewBox="0 0 20 20">
|
|
<path fill-rule="evenodd" d="M11.983 1.034a1 1 0 00-1.966 0l-.26 1.857a6.996 6.996 0 00-1.223.51l-1.7-1.04a1 1 0 00-1.366.366l-1 1.732a1 1 0 00.366 1.366l1.7 1.04a6.984 6.984 0 000 1.02l-1.7 1.04a1 1 0 00-.366 1.366l1 1.732a1 1 0 001.366.366l1.7-1.04c.392.212.803.386 1.223.51l.26 1.857a1 1 0 001.966 0l.26-1.857c.42-.124.831-.298 1.223-.51l1.7 1.04a1 1 0 001.366-.366l1-1.732a1 1 0 00-.366-1.366l-1.7-1.04a6.984 6.984 0 000-1.02l1.7-1.04a1 1 0 00.366-1.366l-1-1.732a1 1 0 00-1.366-.366l-1.7 1.04a6.996 6.996 0 00-1.223-.51l-.26-1.857zM10 13a3 3 0 100-6 3 3 0 000 6z" clip-rule="evenodd"/>
|
|
</svg>
|
|
<span>Configuración</span>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script>
|
|
// Simular lógica de dashboard
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const esDashboard = window.location.pathname.includes('/agencias/dashboard');
|
|
const welcomeText = document.getElementById('welcome-text');
|
|
const logoutBtn = document.getElementById('logout-btn');
|
|
|
|
if (!esDashboard) {
|
|
if (welcomeText) {
|
|
welcomeText.style.display = 'none';
|
|
}
|
|
if (logoutBtn) {
|
|
logoutBtn.style.display = 'inline-block';
|
|
}
|
|
}
|
|
|
|
// Manejar estados activos basados en URL actual
|
|
const currentPath = window.location.pathname;
|
|
const navLinks = document.querySelectorAll('.nav-link');
|
|
|
|
navLinks.forEach(link => {
|
|
const href = link.getAttribute('href');
|
|
if (href && currentPath.includes(href)) {
|
|
link.classList.add('active');
|
|
}
|
|
});
|
|
|
|
document.querySelectorAll('[data-bs-toggle="collapse"]').forEach(trigger => {
|
|
// Desactivar Bootstrap
|
|
trigger.removeAttribute('data-bs-toggle');
|
|
|
|
// Inicializar estado correcto
|
|
const target = document.querySelector(trigger.getAttribute('href'));
|
|
if (target) {
|
|
target.style.transition = 'height 0.3s ease, opacity 0.2s ease';
|
|
target.style.overflow = 'hidden';
|
|
|
|
if (!target.classList.contains('show')) {
|
|
target.style.height = '0';
|
|
target.style.opacity = '0';
|
|
}
|
|
}
|
|
|
|
trigger.addEventListener('click', function(e) {
|
|
e.preventDefault();
|
|
const target = document.querySelector(this.getAttribute('href'));
|
|
const icon = this.querySelector('.collapse-icon');
|
|
|
|
if (!target) return;
|
|
|
|
const isExpanding = this.getAttribute('aria-expanded') !== 'true';
|
|
|
|
if (isExpanding) {
|
|
// Abrir
|
|
target.classList.add('show');
|
|
target.style.height = '0';
|
|
target.style.opacity = '0';
|
|
target.style.display = 'block';
|
|
|
|
// Forzar reflow
|
|
void target.offsetHeight;
|
|
|
|
target.style.height = target.scrollHeight + 'px';
|
|
target.style.opacity = '1';
|
|
|
|
this.setAttribute('aria-expanded', 'true');
|
|
if (icon) icon.style.transform = 'rotate(180deg)';
|
|
} else {
|
|
// Cerrar
|
|
target.style.height = target.scrollHeight + 'px';
|
|
target.style.opacity = '1';
|
|
|
|
// Forzar reflow
|
|
void target.offsetHeight;
|
|
|
|
target.style.height = '0';
|
|
target.style.opacity = '0';
|
|
|
|
setTimeout(() => {
|
|
target.classList.remove('show');
|
|
target.style.display = '';
|
|
}, 300);
|
|
|
|
this.setAttribute('aria-expanded', 'false');
|
|
if (icon) icon.style.transform = 'rotate(0deg)';
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|