<?php 

session_start();
?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>EMERGENCIA DE QUILLABAMBA</title>
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" href="vistas/dist/img/plantilla/Logo.ico">
 
  <!-- 
    
  PLUGINS DE CSS

  -->
  <!-- Font Awesome -->
  <link rel="stylesheet" href="vistas/plugins/fontawesome-free/css/all.min.css">

  <!-- Theme style -->
  <link rel="stylesheet" href="vistas/dist/css/adminlte.css">
  <!-- Ionicons -->
  <link rel="stylesheet" href="vistas/plugins/overlayScrollbars/css/OverlayScrollbars.css">
  
  <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
  <!-- Tempusdominus Bbootstrap 4 -->
  <link rel="stylesheet" href="vistas/plugins/tempusdominus-bootstrap-4/css/tempusdominus-bootstrap-4.min.css">
 <!-- iCheck for checkboxes and radio inputs -->
 <link rel="stylesheet" href="vistas/plugins/iCheck/all.css">
  <!-- JQVMap -->
  <link rel="stylesheet" href="vistas/plugins/jqvmap/jqvmap.min.css">

  <!-- overlayScrollbars -->
  <link rel="stylesheet" href="vistas/plugins/overlayScrollbars/css/OverlayScrollbars.min.css">
  <!-- Daterange picker -->
  <link rel="stylesheet" href="vistas/plugins/daterangepicker/daterangepicker.css">
  <!-- summernote -->
  <link rel="stylesheet" href="vistas/plugins/summernote/summernote-bs4.css">
  <!-- Google Font: Source Sans Pro -->
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  <!-- DataTables -->
  <link rel="stylesheet" href="vistas/plugins/datatables-bs4/css/dataTables.bootstrap4.css">
  <link rel="stylesheet" href="vistas/plugins/datatables-bs4/css/responsive.bootstrap.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="vistas/plugins/select2/css/select2.css">
  <link rel="stylesheet" href="vistas/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
  <link rel="stylesheet" href="vistas/plugins/datatables-buttons/css/buttons.bootstrap4.min.css">

  <link rel="stylesheet" href="vistas/plugins/datatables-scroller/css/scroller.bootstrap4.min.css">
  <link rel="stylesheet" href="vistas/plugins/datatables-colreorder/css/colReorder.bootstrap4.css">
  <link rel="stylesheet" href="vistas/plugins/bootstrap-daterangepicker/daterangepicker.css">
  
  <link rel="stylesheet" href="vistas/plugins/searchPanes.dataTables.min.css">
    <!-- Morris chart -->
  <link rel="stylesheet" href="vistas/plugins/morris.js/morris.css">

  <link rel="stylesheet" href="vistas/plugins/select.dataTables.min.css">
  

	
  
  <!-- 
    
  PLUGINS DE JAVASCRIPT
  
  -->
  <!-- jQuery -->
  <script src="vistas/plugins/jquery/jquery.min.js"></script>
  
  <!-- jQuery UI 1.11.4 -->
  <script src="vistas/plugins/jquery-ui/jquery-ui.min.js"></script>
  <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  <script>
    $.widget.bridge('uibutton', $.ui.button)
  </script>
  <!-- Bootstrap 4 -->
  <script src="vistas/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
  <!-- FastClick -->
  <script src="vistas/plugins/fastclick/fastclick.js"></script>
  <!-- ChartJS -->
  <script src="vistas/plugins/chart.js/Chart.min.js"></script>
  <!-- Sparkline -->
  <script src="vistas/plugins/sparklines/sparkline.js"></script>
  <!-- JQVMap -->
  <script src="vistas/plugins/jqvmap/jquery.vmap.min.js"></script>
  <script src="vistas/plugins/jqvmap/maps/jquery.vmap.usa.js"></script>
  <!-- jQuery Knob Chart -->
  <script src="vistas/plugins/jquery-knob/jquery.knob.min.js"></script>
  <!-- daterangepicker -->
  <script src="vistas/plugins/moment/moment.min.js"></script>
  <script src="vistas/plugins/daterangepicker/daterangepicker.js"></script>
  <!-- Tempusdominus Bootstrap 4 -->
  <script src="vistas/plugins/tempusdominus-bootstrap-4/js/tempusdominus-bootstrap-4.min.js"></script>
  <!-- Summernote -->
  <script src="vistas/plugins/summernote/summernote-bs4.min.js"></script>
  <!-- overlayScrollbars -->
  <script src="vistas/plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
  <!-- AdminLTE App -->
  <script src="vistas/dist/js/adminlte.js"></script>
  <!-- DataTables -->
  <script src="vistas/plugins/datatables/jquery.dataTables.js"></script>
  <script src="vistas/plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>

  <script src="vistas/plugins/datatables-bs4/js/dataTables.responsive.min.js"></script>
  <script src="vistas/plugins/datatables-bs4/js/responsive.bootstrap.min.js"></script>
 

  <script src="vistas/plugins/pdfmake/pdfmake.min.js"></script>
  <script src="vistas/plugins/pdfmake/vfs_fonts.js"></script>
  <script src="vistas/plugins/jszip/jszip.min.js"></script>

  <script src="vistas/plugins/datatables-buttons/js/dataTables.buttons.min.js"></script>
  <script src="vistas/plugins/datatables-buttons/js/buttons.bootstrap4.min.js"></script>
 <!-- select 2 -->
  <script src="vistas/plugins/datatables-select/js/dataTables.select.min.js"></script>

  <script src="vistas/plugins/datatables-buttons/js/buttons.html5.min.js"></script>
  <script src="vistas/plugins/datatables-buttons/js/buttons.print.min.js"></script>
  <!-- SweetAlert 2 -->
  <script src="vistas/plugins/sweetalert2/sweetalert2.all.js"></script>
  <!-- Select2 -->
  <script src="vistas/plugins/select2/js/select2.full.min.js"></script>

  <!-- iCheck 1.0.1 -->
  <script src="vistas/plugins/iCheck/icheck.min.js"></script>

  <script src="vistas/plugins/dataTables.searchPanes.min.js"></script>

  <!-- InputMask -->

<script src="vistas/plugins/inputmask/inputmask/inputmask.js"></script>
<script src="vistas/plugins/inputmask/inputmask/inputmask.date.extensions.js"></script>
<script src="vistas/plugins/inputmask/inputmask/jquery.inputmask.js"></script>
<script src="vistas/plugins/inputmask/min/jquery.inputmask.bundle.min.js"></script>

<script src="vistas/plugins/datatables-buttons/js/buttons.colVis.min.js"></script>

<script src="vistas/plugins/datatables-scroller/js/datatables.scroller.min.js"></script>
<script src="vistas/plugins/datatables-colreorder/js/dataTables.colReorder.min.js"></script>

<script src="vistas/plugins/Number/jquerynumber.min.js"></script>

<script src="vistas/plugins/moment/min/moment.min.js"></script>
<script src="vistas/plugins/bootstrap-daterangepicker/daterangepicker.js"></script>
<script src="https://cdn.datatables.net/select/1.3.3/js/dataTables.select.min.js"></script>

<script src="vistas/plugins/raphael/raphael.min.js"></script>
<script src="vistas/plugins/morris.js/morris.min.js"></script>

<script src="vistas/plugins/chart.js/Chart.js"></script>

<script src="https://cdn.datatables.net/plug-ins/1.11.3/api/sum().js"></script>

<script src="vistas/dist/js/bootstrap-editable.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>




  
</head>
 <!-- 
    
  CUERPO DOCUMENTO
  
  -->

<body class="hold-transition sidebar-mini sidebar-collapse" >


<style>
  table th {
    background-color: #007bff !important;
    color: white;
  }

  table {
    width: 100% !important;
  }

  .dataTables_scrollHeadInner{
    width: 100% !important;
  }
</style>

  <?php 
  if (isset($_SESSION["iniciarSesion"]) && $_SESSION["iniciarSesion"] == "ok"){ 
        echo '<div class="wrapper">';
      

        include "modulos/cabecera.php";
        include "modulos/menu.php";

        if (isset($_GET["ruta"])){

          if($_GET["ruta"] == "inicio" ||
              $_GET["ruta"] == "usuarios" || 
              $_GET["ruta"] == "empleado" || 
              $_GET["ruta"] == "triaje" ||
              $_GET["ruta"] == "consulta-medica" ||
              $_GET["ruta"] == "modulo" || 
              $_GET["ruta"] == "paciente" ||
              $_GET["ruta"] == "permisos" ||
              $_GET["ruta"] == "atencion-medica" ||
              $_GET["ruta"] == "reporte" ||
              $_GET["ruta"] == "copia-seguridad" ||
              $_GET["ruta"] == "reportes-emergencia" ||
              $_GET["ruta"] == "rolypermisos" ||
              $_GET["ruta"] == "recuperarClaveConLink" ||
              $_GET["ruta"] == "auditoria" ||
              $_GET["ruta"] == "rol" ||
              $_GET["ruta"] == "accion" ||
              $_GET["ruta"] == "salir"){ 
              include "modulos/".$_GET["ruta"].".php";
              
          }else {
            include "modulos/404.php";
          }
        }else {
          include "modulos/inicio.php";
        }
        
        include "modulos/footer.php";
        echo '</div>';
        
  }else {
    include "modulos/login.php";
  }

  function tienePermiso($modulo, $accion) {
    // Si es un superadministrador total, puedes saltar la validación (Opcional)
    if ($_SESSION["tipo_usuario"] == "ADMINISTRADOR") { return true; }

    $permisoBuscado = strtoupper($modulo . "-" . $accion);
    
    if (isset($_SESSION["permisos"]) && in_array($permisoBuscado, $_SESSION["permisos"])) {
        return true;
    }

    return false;
}
      
  ?>
  

<!-- ./wrapper -->

<script src="vistas/js/triaje.js"></script>



<script src="vistas/js/reportes.js"></script>



<script src="vistas/js/empleado.js">

</script>



</body>
</html>
