Files
MVE/views/partials/sidebar_agencia.php

1103 lines
35 KiB
PHP

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
/* Variables CSS para un diseño profesional limpio */
:root {
--sidebar-bg: #ffffff;
--sidebar-width: 280px;
--navbar-height: 70px;
--primary-color: #3b82f6;
--primary-dark: #2563eb;
--text-primary: #1f2937;
--text-secondary: #6b7280;
--text-muted: #9ca3af;
--text-light: #ffffff;
--bg-hover: #f8fafc;
--bg-active: #f1f5f9;
--bg-selected: #eff6ff;
--border-color: #e5e7eb;
--border-light: #f3f4f6;
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
--shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
--transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
--navbar-bg: linear-gradient(135deg, var(--primary, #0f172a) 0%, var(--secondary, #334155) 100%);
}
/* Reset y fuentes base */
* {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
/* Asegurar espacio para navbar fijo */
body {
padding-top: var(--navbar-height) !important;
margin-top: 0 !important;
}
/* Prevenir que otros estilos interfieran con el navbar */
html, body {
position: relative;
}
/* Reset específico para el navbar */
.navbar-professional * {
box-sizing: border-box;
}
/* Asegurar que ningún elemento padre afecte el posicionamiento */
.navbar-professional {
transform: none !important;
will-change: auto !important;
}
/* Estilos del contenedor principal del sidebar */
.sidebar-container {
background: var(--sidebar-bg);
border-right: 1px solid var(--border-color);
box-shadow: var(--shadow-lg);
position: relative;
overflow: hidden;
}
.sidebar-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.01) 100%);
pointer-events: none;
}
/* Estilos de navegación mejorados */
.sidebar-nav {
position: relative;
z-index: 1;
}
.sidebar-nav .nav-item {
margin-bottom: 4px;
}
.sidebar-nav .nav-link {
color: var(--text-primary);
font-weight: 500;
font-size: 0.95rem;
padding: 14px 20px;
border-radius: 12px;
transition: var(--transition);
display: flex;
align-items: center;
text-decoration: none;
position: relative;
margin: 0 12px;
border: 1px solid transparent;
}
.sidebar-nav .nav-link::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 4px;
height: 0;
background: var(--primary-color);
border-radius: 2px;
transition: height 0.3s ease;
}
.sidebar-nav .nav-link:hover {
background: var(--bg-hover);
border-color: var(--border-light);
transform: translateY(-1px);
box-shadow: var(--shadow-sm);
color: var(--text-primary);
}
.sidebar-nav .nav-link:hover::before {
height: 24px;
}
.sidebar-nav .nav-link.active {
background: var(--bg-selected);
border-color: var(--primary-color);
border-color: rgba(59, 130, 246, 0.2);
box-shadow: var(--shadow-sm);
font-weight: 600;
color: var(--primary-color);
}
.sidebar-nav .nav-link.active::before {
height: 28px;
}
/* Iconos mejorados */
.sidebar-nav .nav-link .icon {
width: 22px;
height: 22px;
margin-right: 16px;
color: var(--text-secondary);
transition: var(--transition);
flex-shrink: 0;
}
.sidebar-nav .nav-link:hover .icon {
color: var(--text-primary);
transform: scale(1.05);
}
.sidebar-nav .nav-link.active .icon {
color: var(--primary-color);
transform: scale(1.05);
}
/* Badges modernos */
.sidebar-nav .badge {
background: var(--border-light);
color: var(--text-secondary);
font-size: 0.75rem;
font-weight: 600;
padding: 6px 10px;
border-radius: 20px;
margin-left: auto;
border: 1px solid var(--border-color);
}
.sidebar-nav .badge.badge-primary {
background: rgba(59, 130, 246, 0.1);
color: var(--primary-color);
border-color: rgba(59, 130, 246, 0.2);
}
/* Submenús mejorados */
.submenu {
padding-left: 0;
margin-top: 8px;
border-left: 2px solid var(--border-color);
margin-left: 32px;
}
.submenu .nav-link {
padding: 10px 20px 10px 24px;
font-size: 0.875rem;
font-weight: 400;
color: var(--text-secondary);
margin: 0 12px 0 0;
border-radius: 0 10px 10px 0;
}
.submenu .nav-link::before {
display: none;
}
.submenu .nav-link:hover {
color: var(--text-primary);
background: var(--bg-hover);
}
.submenu .nav-link.active {
color: var(--primary-color);
background: var(--bg-selected);
}
/* Iconos de colapso mejorados */
.collapse-icon {
width: 16px;
height: 16px;
margin-left: auto;
transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
color: var(--text-muted);
}
.nav-link:hover .collapse-icon {
color: var(--text-secondary);
}
.nav-link[aria-expanded="true"] .collapse-icon {
transform: rotate(180deg);
color: var(--primary-color);
}
/* Navbar profesional con posicionamiento reforzado */
.navbar-professional {
background: var(--navbar-bg) !important;
height: var(--navbar-height) !important;
box-shadow: var(--shadow-md) !important;
border: none !important;
backdrop-filter: blur(10px);
position: fixed !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
width: 100% !important;
z-index: 9999 !important;
overflow: hidden;
margin: 0 !important;
padding: 0 !important;
}
/* Forzar que el navbar siempre esté en la parte superior */
.navbar-professional.fixed-top {
position: fixed !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
z-index: 9999 !important;
}
.navbar-brand {
font-weight: 700;
font-size: 1.4rem;
color: var(--text-light) !important;
letter-spacing: -0.5px;
margin-bottom: 0 !important;
padding: 0 !important;
}
.navbar-brand .highlight {
color: #ffd700;
font-weight: 300;
}
/* Contenedor del navbar reforzado */
.navbar-professional .container-fluid {
padding-left: 1rem !important;
padding-right: 1rem !important;
margin: 0 !important;
width: 100% !important;
max-width: none !important;
}
/* Botón de menú mejorado */
.menu-toggle {
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 10px;
padding: 10px 12px;
background: rgba(255, 255, 255, 0.1);
color: var(--text-light);
font-size: 1.2rem;
transition: var(--transition);
backdrop-filter: blur(5px);
}
.menu-toggle:hover {
background: rgba(255, 255, 255, 0.2);
border-color: rgba(255, 255, 255, 0.5);
transform: scale(1.05);
}
/* Botones de acción mejorados */
.btn-professional {
padding: 10px 20px;
border-radius: 10px;
font-weight: 500;
font-size: 0.9rem;
transition: var(--transition);
border: 2px solid transparent;
}
.btn-outline-light-professional {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.3);
color: var(--text-light);
backdrop-filter: blur(5px);
}
.btn-outline-light-professional:hover {
background: rgba(255, 255, 255, 0.2);
border-color: rgba(255, 255, 255, 0.5);
color: var(--text-light);
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}
/* Estilos para el contenido de bienvenida */
.welcome-container {
flex-shrink: 0;
display: flex !important;
align-items: center;
height: 100%;
position: relative;
z-index: 1;
}
.welcome-text {
font-size: 0.95rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 200px;
color: white !important;
margin: 0;
line-height: 1;
}
#navbar-content {
display: flex !important;
align-items: center;
height: 100%;
position: relative;
z-index: 1;
}
/* Offcanvas mejorado */
.offcanvas-professional {
background: var(--sidebar-bg);
border: none;
border-left: 1px solid var(--border-color);
}
.offcanvas-header {
border-bottom: 1px solid var(--border-color);
padding: 1.5rem;
background: var(--bg-hover);
}
.offcanvas-title {
font-weight: 700;
font-size: 1.3rem;
color: var(--text-primary);
letter-spacing: -0.3px;
}
.btn-close-white-professional {
background: var(--border-light);
border-radius: 8px;
padding: 8px;
transition: var(--transition);
opacity: 0.8;
}
.btn-close-white-professional:hover {
background: var(--border-color);
transform: scale(1.1);
opacity: 1;
}
.offcanvas-body {
padding: 1.5rem;
}
/* Efectos de scroll personalizado */
.sidebar-scroll::-webkit-scrollbar {
width: 6px;
}
.sidebar-scroll::-webkit-scrollbar-track {
background: var(--border-light);
border-radius: 3px;
}
.sidebar-scroll::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 3px;
}
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
background: var(--text-muted);
}
/* Separadores visuales */
.nav-separator {
height: 1px;
background: var(--border-color);
margin: 16px 20px;
position: relative;
}
.nav-separator::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 40px;
height: 1px;
background: var(--text-muted);
opacity: 0.3;
}
/* Animaciones mejoradas */
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(-20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.nav-item {
animation: slideIn 0.3s ease-out;
}
.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.1s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.2s; }
.nav-item:nth-child(5) { animation-delay: 0.25s; }
.nav-item:nth-child(6) { animation-delay: 0.3s; }
.nav-item:nth-child(7) { animation-delay: 0.35s; }
.nav-item:nth-child(8) { animation-delay: 0.4s; }
.nav-item:nth-child(9) { animation-delay: 0.45s; }
.nav-item:nth-child(10) { animation-delay: 0.5s; }
/* Responsive mejorado */
@media (max-width: 767.98px) {
:root {
--navbar-height: 60px;
}
.navbar-professional {
height: 60px;
padding-left: 1rem;
padding-right: 1rem;
}
.navbar-professional .container-fluid {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
.navbar-brand {
font-size: 1.0rem;
flex-shrink: 1;
min-width: 0;
}
.navbar-brand span:first-child {
display: none;
}
.menu-toggle {
padding: 6px 8px;
margin-right: 0.5rem;
flex-shrink: 0;
}
.welcome-text {
font-size: 0.85rem;
max-width: 150px;
}
.welcome-container {
flex-shrink: 1;
min-width: 0;
}
.sidebar-nav .nav-link {
margin: 0 8px;
padding: 12px 16px;
font-size: 0.9rem;
}
.offcanvas-professional {
width: 280px !important;
}
#navbar-content {
flex-shrink: 1;
min-width: 0;
overflow: hidden;
}
}
/* Para pantallas muy pequeñas */
@media (max-width: 575.98px) {
.navbar-brand {
font-size: 0.9rem;
}
.welcome-text {
font-size: 0.8rem;
max-width: 120px;
}
.navbar-professional .container-fluid {
padding-left: 0.25rem;
padding-right: 0.25rem;
}
}
/* Estados especiales */
.nav-link.loading {
opacity: 0.6;
pointer-events: none;
}
.nav-link.loading .icon {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
</style>
<!-- NAVBAR PROFESIONAL -->
<nav class="navbar navbar-professional fixed-top navbar-dark">
<div class="container-fluid px-4 h-100">
<div class="d-flex align-items-center justify-content-between w-100 h-100">
<!-- Lado izquierdo: Menú + Brand -->
<div class="d-flex align-items-center h-100">
<!-- 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">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</button>
<!-- Brand mejorado -->
<div class="navbar-brand d-flex align-items-center mb-0">
<svg class="me-2" width="32" height="32" viewBox="0 0 24 24" fill="currentColor">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
</svg>
<span>SIIH <span class="highlight">|</span> Agencia</span>
</div>
</div>
<!-- Lado derecho: Contenido del navbar -->
<div class="d-flex align-items-center h-100">
<?php
// Verifica si estás en el dashboard principal del administrador
$esDashboard = str_contains($_SERVER['REQUEST_URI'], '/IMPORTADORES/agencias/dashboard');
if ($esDashboard): ?>
<div class="welcome-container">
<svg class="me-2 d-none d-sm-block" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
<circle cx="12" cy="7" r="4"></circle>
</svg>
<span id="welcome-text" class="welcome-text">Bienvenido, <?= htmlspecialchars($_SESSION['usuario_nombre']) ?></span>
</div>
<?php else: ?>
<a href="/IMPORTADORES/sistemas/logout"
class="btn btn-outline-light-professional btn-professional d-flex align-items-center"
id="logout-btn">
<svg class="me-2" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
<polyline points="16,17 21,12 16,7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line>
</svg>
Cerrar Sesión
</a>
<?php endif; ?>
</div>
</div>
</div>
</nav>
<!-- SIDEBAR PROFESIONAL (escritorio) -->
<div class="d-none d-md-block sidebar-container position-fixed h-100 sidebar-scroll" style="width: var(--sidebar-width); top: 0; padding-top: var(--navbar-height); 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="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/>
<polyline points="9,22 9,12 15,12 15,22"/>
</svg>
<span>Inicio</span>
</a>
</li>
<div class="nav-separator"></div>
<!-- SOLICITUDES DE VINCULACIÓN -->
<li class="nav-item">
<a href="/IMPORTADORES/vinculaciones/solicitudesVinculacion" class="nav-link">
<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/>
<path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>
</svg>
<span>Solicitudes de Vinculación</span>
</a>
</li>
<!-- USUARIOS VINCULADOS -->
<li class="nav-item">
<a href="/IMPORTADORES/vinculaciones/vinculacionesAgencia" class="nav-link">
<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/>
<circle cx="9" cy="7" r="4"/>
<path d="M23 21v-2a4 4 0 00-3-3.87"/>
<path d="M16 3.13a4 4 0 010 7.75"/>
</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="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/>
<polyline points="14,2 14,8 20,8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
<polyline points="10,9 9,9 8,9"/>
</svg>
<span>Patentes</span>
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
</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="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/>
<circle cx="12" cy="10" r="3"/>
</svg>
<span>Locaciones</span>
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
</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="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/>
<circle cx="12" cy="7" r="4"/>
</svg>
<span>Alta de Agentes</span>
</a>
</li>
<div class="nav-separator"></div>
<!-- CONFIGURACIÓN -->
<li class="nav-item">
<a href="/IMPORTADORES/configuracion" class="nav-link">
<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/>
</svg>
<span>Configuración</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
<!-- OFFCANVAS PROFESIONAL PARA MÓVILES -->
<div class="offcanvas offcanvas-professional offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 0; width: var(--sidebar-width);">
<div class="offcanvas-header">
<div class="d-flex align-items-center">
<svg class="me-2" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="color: var(--primary-color);">
<path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5"/>
</svg>
<h5 class="offcanvas-title mb-0">SIIH | Agencia</h5>
</div>
<button type="button" class="btn-close btn-close-white-professional" data-bs-dismiss="offcanvas"></button>
</div>
<div class="offcanvas-body sidebar-scroll">
<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="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M3 9l9-7 9 7v11a2 2 0 01-2 2H5a2 2 0 01-2-2z"/>
<polyline points="9,22 9,12 15,12 15,22"/>
</svg>
<span>Inicio</span>
</a>
</li>
<!-- SOLICITUDES DE VINCULACIÓN -->
<li class="nav-item">
<a href="/IMPORTADORES/vinculaciones/solicitudesVinculacion" class="nav-link">
<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M10 13a5 5 0 007.54.54l3-3a5 5 0 00-7.07-7.07l-1.72 1.71"/>
<path d="M14 11a5 5 0 00-7.54-.54l-3 3a5 5 0 007.07 7.07l1.71-1.71"/>
</svg>
<span>Solicitudes de Vinculación</span>
</a>
</li>
<!-- USUARIOS VINCULADOS -->
<li class="nav-item">
<a href="/IMPORTADORES/vinculaciones/vinculacionesAgencia" class="nav-link">
<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"/>
<circle cx="9" cy="7" r="4"/>
<path d="M23 21v-2a4 4 0 00-3-3.87"/>
<path d="M16 3.13a4 4 0 010 7.75"/>
</svg>
<span>Usuarios Vinculados</span>
</a>
</li>
<!-- PATENTES -->
<li class="nav-item">
<a class="nav-link" data-bs-toggle="collapse" href="#submenuPatentesOffcanvas" role="button" aria-expanded="false" aria-controls="submenuPatentesOffcanvas">
<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/>
<polyline points="14,2 14,8 20,8"/>
<line x1="16" y1="13" x2="8" y2="13"/>
<line x1="16" y1="17" x2="8" y2="17"/>
<polyline points="10,9 9,9 8,9"/>
</svg>
<span>Patentes</span>
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
</svg>
</a>
<div class="collapse" id="submenuPatentesOffcanvas">
<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="#submenuLocacionesOffcanvas" role="button" aria-expanded="false" aria-controls="submenuLocacionesOffcanvas">
<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"/>
<circle cx="12" cy="10" r="3"/>
</svg>
<span>Locaciones</span>
<svg class="collapse-icon" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"/>
</svg>
</a>
<div class="collapse" id="submenuLocacionesOffcanvas">
<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="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<path d="M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"/>
<circle cx="12" cy="7" r="4"/>
</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="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="3"/>
<path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-2 2 2 2 0 01-2-2v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83 0 2 2 0 010-2.83l.06-.06a1.65 1.65 0 00.33-1.82 1.65 1.65 0 00-1.51-1H3a2 2 0 01-2-2 2 2 0 012-2h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 010-2.83 2 2 0 012.83 0l.06.06a1.65 1.65 0 001.82.33H9a1.65 1.65 0 001-1.51V3a2 2 0 012-2 2 2 0 012 2v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 0 2 2 0 010 2.83l-.06.06a1.65 1.65 0 00-.33 1.82V9a1.65 1.65 0 001.51 1H21a2 2 0 012 2 2 2 0 01-2 2h-.09a1.65 1.65 0 00-1.51 1z"/>
</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>
document.addEventListener('DOMContentLoaded', function() {
// Configuración inicial
const esDashboard = window.location.pathname.includes('/agencias/dashboard');
const welcomeText = document.getElementById('welcome-text');
const logoutBtn = document.getElementById('logout-btn');
// Sistema mejorado de estados activos
function updateActiveStates() {
const currentPath = window.location.pathname;
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach(link => {
link.classList.remove('active');
const href = link.getAttribute('href');
if (href && currentPath.includes(href) && href !== '#') {
link.classList.add('active');
// Expandir el menú padre si está dentro de un submenú
const submenu = link.closest('.collapse');
if (submenu) {
const parentLink = document.querySelector(`[href="#${submenu.id}"]`);
if (parentLink) {
parentLink.setAttribute('aria-expanded', 'true');
submenu.classList.add('show');
submenu.style.height = submenu.scrollHeight + 'px';
submenu.style.opacity = '1';
submenu.style.display = 'block';
const icon = parentLink.querySelector('.collapse-icon');
if (icon) icon.style.transform = 'rotate(180deg)';
}
}
}
});
}
// Sistema mejorado de colapso con animaciones fluidas
function initializeCollapseSystem() {
document.querySelectorAll('[data-bs-toggle="collapse"]').forEach(trigger => {
trigger.removeAttribute('data-bs-toggle');
const target = document.querySelector(trigger.getAttribute('href'));
if (!target) return;
// Configurar estilos iniciales
target.style.transition = 'all 0.4s cubic-bezier(0.4, 0, 0.2, 1)';
target.style.overflow = 'hidden';
if (!target.classList.contains('show')) {
target.style.height = '0';
target.style.opacity = '0';
target.style.display = 'none';
}
// Manejar clics con animaciones suaves
trigger.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
const isExpanding = this.getAttribute('aria-expanded') !== 'true';
const icon = this.querySelector('.collapse-icon');
// Añadir efecto de loading
this.classList.add('loading');
setTimeout(() => this.classList.remove('loading'), 200);
if (isExpanding) {
// Expandir
target.style.display = 'block';
target.style.height = '0';
target.style.opacity = '0';
target.classList.add('show');
requestAnimationFrame(() => {
target.style.height = target.scrollHeight + 'px';
target.style.opacity = '1';
});
this.setAttribute('aria-expanded', 'true');
if (icon) icon.style.transform = 'rotate(180deg)';
} else {
// Colapsar
target.style.height = target.scrollHeight + 'px';
requestAnimationFrame(() => {
target.style.height = '0';
target.style.opacity = '0';
});
setTimeout(() => {
if (this.getAttribute('aria-expanded') === 'false') {
target.classList.remove('show');
target.style.display = 'none';
}
}, 400);
this.setAttribute('aria-expanded', 'false');
if (icon) icon.style.transform = 'rotate(0deg)';
}
});
});
}
// Efectos hover mejorados
function initializeHoverEffects() {
const navLinks = document.querySelectorAll('.nav-link');
navLinks.forEach(link => {
link.addEventListener('mouseenter', function() {
if (!this.classList.contains('active')) {
this.style.transform = 'translateX(4px)';
}
});
link.addEventListener('mouseleave', function() {
if (!this.classList.contains('active')) {
this.style.transform = 'translateX(0)';
}
});
});
}
// Smooth scrolling para navegación interna
function initializeSmoothScrolling() {
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
const target = document.querySelector(this.getAttribute('href'));
if (target) {
e.preventDefault();
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
}
// Detección de scroll para efectos adicionales
function initializeScrollEffects() {
let ticking = false;
function updateScrollEffects() {
const sidebar = document.querySelector('.sidebar-container');
if (sidebar) {
const scrollTop = sidebar.scrollTop;
sidebar.style.setProperty('--scroll-position', scrollTop);
}
ticking = false;
}
document.querySelector('.sidebar-scroll')?.addEventListener('scroll', () => {
if (!ticking) {
requestAnimationFrame(updateScrollEffects);
ticking = true;
}
});
}
// Función para forzar el posicionamiento correcto del navbar
function enforceNavbarPosition() {
const navbar = document.querySelector('.navbar-professional');
if (navbar) {
// Forzar estilos críticos
navbar.style.position = 'fixed';
navbar.style.top = '0';
navbar.style.left = '0';
navbar.style.right = '0';
navbar.style.width = '100%';
navbar.style.zIndex = '9999';
navbar.style.margin = '0';
// Asegurar que el body tenga el padding correcto
document.body.style.paddingTop = navbar.offsetHeight + 'px';
}
}
// Inicializar todos los sistemas
updateActiveStates();
initializeCollapseSystem();
initializeHoverEffects();
initializeSmoothScrolling();
initializeScrollEffects();
enforceNavbarPosition();
// Reinicializar en cambios de ruta y resize
window.addEventListener('popstate', updateActiveStates);
window.addEventListener('resize', enforceNavbarPosition);
window.addEventListener('load', enforceNavbarPosition);
// Observador para detectar si el navbar se mueve
if (window.MutationObserver) {
const navbar = document.querySelector('.navbar-professional');
if (navbar) {
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type === 'attributes' &&
(mutation.attributeName === 'style' || mutation.attributeName === 'class')) {
enforceNavbarPosition();
}
});
});
observer.observe(navbar, {
attributes: true,
attributeFilter: ['style', 'class']
});
}
}
// Sistema de notificaciones toast (opcional)
window.showToast = function(message, type = 'info') {
const toastContainer = document.querySelector('.toast-container') ||
(() => {
const container = document.createElement('div');
container.className = 'toast-container position-fixed top-0 end-0 p-3';
document.body.appendChild(container);
return container;
})();
const toast = document.createElement('div');
toast.className = `toast align-items-center text-white bg-${type} border-0`;
toast.setAttribute('role', 'alert');
toast.innerHTML = `
<div class="d-flex">
<div class="toast-body">${message}</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast"></button>
</div>
`;
toastContainer.appendChild(toast);
const bsToast = new bootstrap.Toast(toast);
bsToast.show();
toast.addEventListener('hidden.bs.toast', () => toast.remove());
};
});
</script>