Files
MVE/views/partials/sidebar_configuracion.php

224 lines
9.4 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- 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');
?>
<!-- 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 -->
<a href="/IMPORTADORES/configuracion/preferencias"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/preferencias') ? 'active' : '' ?>">
✅ Preferencias
</a>
<!-- 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): ?>
<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): ?>
<!-- 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 -->
<a href="/IMPORTADORES/configuracion/preferencias"
class="nav-link px-3 py-2 <?= str_contains($_SERVER['REQUEST_URI'], '/configuracion/preferencias') ? 'active' : '' ?>">
✅ Preferencias
</a>
<!-- 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): ?>
<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): ?>
<!-- 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>