251 lines
12 KiB
PHP
251 lines
12 KiB
PHP
<!-- views/partials/sidebar_configuracion.php -->
|
||
<?php
|
||
if (!isset($_SESSION['usuario_id']) || $_SESSION['tipo_usuario'] !== 'importador') {
|
||
header('Location: /IMPORTADORES/login');
|
||
exit;
|
||
}
|
||
?>
|
||
|
||
<style>
|
||
.nav .nav-link { font-weight: normal; color: white; transition: all 0.3s ease; }
|
||
.nav .nav-link:hover,
|
||
.nav .nav-link.active { background-color: #495057; color: #fff; }
|
||
/* Estilo inverso solo para pantallas pequeñas (sidebar tipo offcanvas) */
|
||
@media (max-width: 767.98px) {
|
||
.nav .nav-link { font-weight: normal; color: #343a40; background-color: transparent; }
|
||
.nav .nav-link:hover,
|
||
.nav .nav-link.active { background-color: #e9ecef; color: #212529; }
|
||
}
|
||
</style>
|
||
|
||
<!-- NAVBAR -->
|
||
<nav class="navbar navbar-dark bg-dark fixed-top">
|
||
<div class="container-fluid">
|
||
<!-- Botón de menú para móviles -->
|
||
<button class="btn btn-outline-light d-md-none me-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#sidebarMenu">
|
||
☰
|
||
</button>
|
||
<span class="navbar-brand">SIIH | Configuración</span>
|
||
<div class="d-flex ms-auto">
|
||
<a href="/IMPORTADORES/importadores/dashboard" class="btn btn-outline-light btn-sm" style="margin: 0 0 0 25px;">
|
||
← Panel Principal
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
|
||
<!-- SIDEBAR FIJA (escritorio) -->
|
||
<div class="d-none d-md-block bg-dark text-white position-fixed h-100 pt-5" style="width: 250px;">
|
||
<nav class="nav flex-column">
|
||
|
||
<!-- Definimos variables de ubicación -->
|
||
<?php
|
||
// Detecta si estamos en alguna parte de configuración
|
||
$esConfiguracion = str_contains($_SERVER['REQUEST_URI'], '/configuracion');
|
||
// Detecta si estamos en alguna ruta de bitácoras
|
||
$esVistaBitacoras = str_contains($_SERVER['REQUEST_URI'], '/bitacoras');
|
||
// Detecta si estamos en alguna parta de seguridad
|
||
$esVistaSeguridad = str_contains($_SERVER['REQUEST_URI'], '/seguridad');
|
||
// Detecta si estamos en alguna parte de preferencias
|
||
$esVistaPreferencias = str_contains($_SERVER['REQUEST_URI'], '/preferencias');
|
||
?>
|
||
|
||
<!-- INFORMACIÓN GENERAL -->
|
||
<a href="/IMPORTADORES/configuracion/index"
|
||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/dashboard_configuracion') ? 'active' : '' ?>">
|
||
ℹ️ Información General
|
||
</a>
|
||
|
||
<!-- AUTOMATIZACIONES -->
|
||
<a href="/IMPORTADORES/configuracion/automatizaciones"
|
||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/automatizaciones') ? 'active' : '' ?>">
|
||
⚙️ Automatizaciones
|
||
</a>
|
||
|
||
<!-- PREFERENCIAS -->
|
||
<?php if ($esVistaPreferencias): ?>
|
||
<?php $enDashboardPreferencias = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/preferencias/index'; ?>
|
||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaPreferencias ? 'active' : '' ?>"
|
||
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
|
||
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
|
||
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
|
||
onclick="<? $enDashboardPreferenecias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
|
||
✅ Preferencias
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<div class="collapse show" id="submenuPreferencias">
|
||
<nav class="nav flex-column ms-3">
|
||
<a href="/IMPORTADORES/preferencias/notificaciones"
|
||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/preferencias/notificaciones' ? 'active' : '' ?>">
|
||
• Gestión de Notificaciones
|
||
</a>
|
||
</nav>
|
||
</div>
|
||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaSeguridad): ?>
|
||
<a href="/IMPORTADORES/preferencias/index"
|
||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||
✅ Preferencias
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<?php endif; ?>
|
||
|
||
<!-- SEGURIDAD -->
|
||
<?php if ($esVistaSeguridad): ?>
|
||
<?php $enDashboardSeguridad = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/seguridad/index'; ?>
|
||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaSeguridad ? 'active' : '' ?>"
|
||
href="<?= $enDashboardSeguridad ? '#submenuSeguridad' : '/IMPORTADORES/seguridad/index' ?>"
|
||
<?= $enDashboardSeguridad ? 'data-bs-toggle="collapse"' : '' ?>
|
||
role="button" aria-expanded="true" aria-controls="submenuSeguridad"
|
||
onclick="<?= $enDashboardSeguridad ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/seguridad/index\';' ?>">
|
||
👮 Seguridad
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<div class="collapse show" id="submenuSeguridad">
|
||
<nav class="nav flex-column ms-3">
|
||
<a href="/IMPORTADORES/seguridad/opciones"
|
||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/seguridad/opciones' ? 'active' : '' ?>">
|
||
• Opciones de Seguridad
|
||
</a>
|
||
</nav>
|
||
</div>
|
||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaPreferencias): ?>
|
||
<a href="/IMPORTADORES/seguridad/index"
|
||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||
👮 Seguridad
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<?php endif; ?>
|
||
|
||
<!-- BITÁCORAS -->
|
||
<?php if ($esVistaBitacoras): ?>
|
||
<?php $enDashboardBitacoras = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/index'; ?>
|
||
<!-- Estamos en cualquier página relacionada a bitácoras -->
|
||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaBitacoras ? 'active' : '' ?>"
|
||
href="<?= $enDashboardBitacoras ? '#submenuBitacoras' : '/IMPORTADORES/bitacoras/index' ?>"
|
||
<?= $enDashboardBitacoras ? 'data-bs-toggle="collapse"' : '' ?>
|
||
role="button" aria-expanded="true" aria-controls="submenuBitacoras"
|
||
onclick="<?= $enDashboardBitacoras ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/bitacoras/index\';' ?>">
|
||
📖 Bitácoras
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<div class="collapse show" id="submenuBitacoras">
|
||
<nav class="nav flex-column ms-3">
|
||
<a href="/IMPORTADORES/bitacoras/lista"
|
||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/lista' ? 'active' : '' ?>">
|
||
• Registro de Accesos
|
||
</a>
|
||
</nav>
|
||
</div>
|
||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias): ?>
|
||
<!-- Si estamos en configuración, pero no en bitácoras -->
|
||
<a href="/IMPORTADORES/bitacoras/index"
|
||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||
📖 Bitácoras
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<?php endif; ?>
|
||
|
||
</nav>
|
||
</div>
|
||
|
||
<!-- OFFCANVAS PARA MÓVILES -->
|
||
<div class="offcanvas offcanvas-start d-md-none" tabindex="-1" id="sidebarMenu" style="top: 56px;">
|
||
<div class="offcanvas-body">
|
||
|
||
<!-- INFORMACIÓN GENERAL -->
|
||
<a href="/IMPORTADORES/configuracion/index"
|
||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/dashboard_configuracion') ? 'active' : '' ?>">
|
||
ℹ️ Información General
|
||
</a>
|
||
|
||
<!-- AUTOMATIZACIONES -->
|
||
<a href="/IMPORTADORES/configuracion/automatizaciones"
|
||
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/automatizaciones') ? 'active' : '' ?>">
|
||
⚙️ Automatizaciones
|
||
</a>
|
||
|
||
<!-- PREFERENCIAS -->
|
||
<?php if ($esVistaPreferencias): ?>
|
||
<?php $enDashboardPreferencias = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/preferencias/index'; ?>
|
||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaPreferencias ? 'active' : '' ?>"
|
||
href="<?= $enDashboardPreferencias ? '#submenuPreferencias' : '/IMPORTADORES/preferencias/index' ?>"
|
||
<?= $enDashboardPreferencias ? 'data-bd-toggle="collapse"' : '' ?>
|
||
role="button" aria-expanded="true" aria-controls="submenuPreferencias"
|
||
onclick="<? $enDashboardPreferenecias ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/preferencias/index\';' ?>">
|
||
✅ Preferencias
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<div class="collapse show" id="submenuPreferencias">
|
||
<nav class="nav flex-column ms-3">
|
||
<a href="/IMPORTADORES/preferencias/notificaciones"
|
||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/preferencias/notificaciones' ? 'active' : '' ?>">
|
||
• Gestión de Notificaciones
|
||
</a>
|
||
</nav>
|
||
</div>
|
||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaSeguridad): ?>
|
||
<a href="/IMPORTADORES/preferencias/index"
|
||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||
✅ Preferencias
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<?php endif; ?>
|
||
|
||
<!-- SEGURIDAD -->
|
||
<?php if ($esVistaSeguridad): ?>
|
||
<?php $enDashboardSeguridad = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/seguridad/index'; ?>
|
||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaSeguridad ? 'active' : '' ?>"
|
||
href="<?= $enDashboardSeguridad ? '#submenuSeguridad' : '/IMPORTADORES/seguridad/index' ?>"
|
||
<?= $enDashboardSeguridad ? 'data-bs-toggle="collapse"' : '' ?>
|
||
role="button" aria-expanded="true" aria-controls="submenuSeguridad"
|
||
onclick="<?= $enDashboardSeguridad ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/seguridad/index\';' ?>">
|
||
👮 Seguridad
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<div class="collapse show" id="submenuSeguridad">
|
||
<nav class="nav flex-column ms-3">
|
||
<a href="/IMPORTADORES/seguridad/opciones"
|
||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/seguridad/opciones' ? 'active' : '' ?>">
|
||
• Opciones de Seguridad
|
||
</a>
|
||
</nav>
|
||
</div>
|
||
<?php elseif ($esConfiguracion || $esVistaBitacoras || $esVistaPreferencias): ?>
|
||
<a href="/IMPORTADORES/seguridad/index"
|
||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||
👮 Seguridad
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<?php endif; ?>
|
||
|
||
<!-- BITÁCORAS -->
|
||
<?php if ($esVistaBitacoras): ?>
|
||
<?php $enDashboardBitacoras = $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/index'; ?>
|
||
<!-- Estamos en cualquier página relacionada a bitácoras -->
|
||
<a class="nav-link px-3 py-2 d-flex justify-content-between align-items-center <?= $esVistaBitacoras ? 'active' : '' ?>"
|
||
href="<?= $enDashboardBitacoras ? '#submenuBitacoras' : '/IMPORTADORES/bitacoras/index' ?>"
|
||
<?= $enDashboardBitacoras ? 'data-bs-toggle="collapse"' : '' ?>
|
||
role="button" aria-expanded="true" aria-controls="submenuBitacoras"
|
||
onclick="<?= $enDashboardBitacoras ? '' : 'event.preventDefault(); window.location.href = \'/IMPORTADORES/bitacoras/index\';' ?>">
|
||
📖 Bitácoras
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<div class="collapse show" id="submenuBitacoras">
|
||
<nav class="nav flex-column ms-3">
|
||
<a href="/IMPORTADORES/bitacoras/lista"
|
||
class="nav-link px-3 py-1 <?= $_SERVER['REQUEST_URI'] === '/IMPORTADORES/bitacoras/lista' ? 'active' : '' ?>">
|
||
• Registro de Accesos
|
||
</a>
|
||
</nav>
|
||
</div>
|
||
<?php elseif ($esConfiguracion || $esVistaSeguridad || $esVistaPreferencias): ?>
|
||
<!-- Si estamos en configuración, pero no en bitácoras -->
|
||
<a href="/IMPORTADORES/bitacoras/index"
|
||
class="nav-link px-3 py-2 d-flex justify-content-between align-items-center">
|
||
📖 Bitácoras
|
||
<span class="badge bg-secondary">1</span>
|
||
</a>
|
||
<?php endif; ?>
|
||
|
||
</div>
|
||
</div>
|