@php

    use App\Libraries\ejLib;

    $var = ejLib::getInstance();
    $soapclient = $var->getWs();
    $wsClave = $var->get_wsClave();


        if(!isset($_SESSION)) session_start();
        $modulos = $_SESSION['accesos'];
        $usuario = $_SESSION['operador'];
        $especialidad = $var->desencriptar_AES($usuario['especialidad'], $usuario['x']);
        $nombre = $var->desencriptar_AES($usuario['nombre_user'], $usuario['x']).' '.$var->desencriptar_AES($usuario['apellido_user_1er'], $usuario['x']).' '.$var->desencriptar_AES($usuario['apellido_user_2do'], $usuario['x']);

    

    if(! isset($_SESSION['CS'])){
        $Centro_Sal = $var->desencriptar_AES($usuario['centro_sal'], $usuario['x']);        
        $centro_salud = $soapclient->AdministrarCatalogos_get_CentroSalud($Centro_Sal, '',$wsClave);
        $CS  = new SimpleXMLElement(utf8_encode($centro_salud));    
        $_SESSION['CS'] = $CS; 
    }else $CS = $_SESSION['CS']; 
    $nom_Centro_Sal  = utf8_decode($CS->respuesta[0]->centrosalud);  


    $id_doc = $var->desencriptar_AES($usuario['id_doc'], $usuario['x']);
    $idSexo = '2';
    if($id_doc != ''){
        $dataUsuario = $soapclient->AdministrarCuentasDeUsuario_get_Usuario($id_doc,$wsClave);
        $dataUsuario  = new SimpleXMLElement(utf8_encode($dataUsuario));
        $idSexo = ''.$dataUsuario->respuesta[0]->sex_clv;

        if($idSexo != '0' && $idSexo != '1')$idSexo = '2';
        
    }
    

@endphp
        <!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>SAECOL WEB | @yield('title')</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="css/bootstrap-clean.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="css/AdminLTE.min.css">
    <link rel="stylesheet" href="css/AdminLTE-app.css">
    <!-- AdminLTE Skins. We have chosen the skin-blue for this starter
          page. However, you can choose any other skin. Make sure you
          apply the skin class to the body tag so the changes take effect. -->
    <link rel="stylesheet" href="css/skin-black.min.css">
    <link rel="stylesheet" href="css/pace.min.css">
    <!-- bootstrap datepicker -->
    <!--<link rel="stylesheet" href="bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">-->
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Google Font
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">-->
    
    <script src="js/fnBase.js?v0.0.10"></script>

    <link href="css/jquery.datepick.css" rel="stylesheet">
    @yield('styles')
    <style>
        .fecha-actual {
            position: relative;
            display: block;
            padding: 10px 15px;
            border-left: 1px solid #eee;
            border-right-width: 0;
            padding-top: 15px;
            padding-bottom: 15px;
            line-height: 20px;
            font-size: 12px;
        }

        #bqdSol{
            border: 1px solid #d2d6de;
            background: rgba(236, 240, 245, 0.4);
            height: 316px;
            padding: 7px;
            border-radius: 4px;
            margin-bottom: 4px;
        }
        #contenedor_tabla_cer{border: 1px solid transparent;  }
        #contenedor_tabla_sol{
            border: 1px solid #d2d6de;
            background: rgba(255, 255, 255, 1);
            height: 250px;
            overflow-y: scroll;
            margin-top: 20px;
            border-radius: 4px;
        }
        .page-header {  border-bottom: 1px solid transparent; }
        .hrLine{
            display: block;
            height: 2px;
            border: 0;
            border-top: 1px solid #3c8cbc;
        }
        .chkTodos{
            border: 1px solid #d2d6de;
            line-height: 2;
            padding: 0px 15px;
            border-radius: 3px;
        }

        .txtSepVertical{
          width: 100%;
        }
        .txtSepHorizontal{
          height: 100%;
        }

        .txtAltura10px{
          height: 10px;
        }

        .txtAnchura10px{
          width: 10px;
        }

        .text-red {
            color: red;
        }

        .error {
            color: red;
        }

        .form-control.error {
            border-color: red;
        }

        .page-headerR {
            font-size: 1.1em;
            font-weight: bold;
            border-bottom: 1px solid #3c8cbc;
            width: 98%;
            text-align: right;
        }

        .page-headerL {
            font-size: 1.1em;
            font-weight: bold;
            border-bottom: 1px solid #3c8cbc;
            width: 100%;
            text-align: left;
        }

        .alinear_centrado {            
            text-align: center;
            margin: auto;
            margin-top: 5px;
        }

        .alinear_izquierda {            
          width: 100%;
          text-align: left;
          border-left: 5px; 
        }

        .alinear_derecha {     
          width: 100%;       
          text-align: right;            
          border-right: 5px;
        }

        .margenSuperior{
          margin-top: 5px;
        }

        #prueba, #prueba2 {
            margin-bottom: 5px;
        }

        .multi {
            padding: 4px;
            border: 1px solid #d2d6d3;
            border-radius: 3px;
            position: absolute;
            z-index: 11;
            background: white;
            width: 90%;
            -webkit-box-shadow: 1px 1px 2px 0px rgba(0, 0, 0, 0.75);
            -moz-box-shadow: 1px 1px 2px 0px rgba(0, 0, 0, 0.75);
            box-shadow: 1px 1px 2px 0px rgba(0, 0, 0, 0.75);
        }

        #tblModal th{
          font-size: 12px;
        }

        #tblModal td{
          font-size: 11px;          
        }
    </style>


<script type="text/javascript">
  var jqGetAjaxShort_execFn = function (php_url_post, objetoHTML, array_datos, target) {
        $("#"+objetoHTML).html('<img src="Img/loader.gif" width="20px"/>'); // 20 Ene 2017 . Supliendo el evento beforeSend
        var request = $.ajax({ url: php_url_post, method: "POST", data: array_datos, dataType: "html" });      
        request.done(function( msg ) { 
          $( "#"+objetoHTML ).html( msg );
          if($("#" + objetoHTML + " #hError").val() == 0)
            $.notify("Consulta realizada exitosamente", "success");     
          else
            $.notify($("#" + objetoHTML + " #hErrorDetalle").val(), "warning");
          eval(target);
        });
        request.fail(function( jqXHR, textStatus ) { $( "#"+objetoHTML ).html(  "Error en solicitud: " +jqXHR+" "+ textStatus ); });
      };
</script>

    

</head>
<!--
BODY TAG OPTIONS:
=================
Apply one or more of the following classes to get the
desired effect
|---------------------------------------------------------|
| SKINS         | skin-blue                               |
|               | skin-black                              |
|               | skin-purple                             |
|               | skin-yellow                             |
|               | skin-red                                |
|               | skin-green                              |
|---------------------------------------------------------|
|LAYOUT OPTIONS | fixed                                   |
|               | layout-boxed                            |
|               | layout-top-nav                          |
|               | sidebar-collapse                        |
|               | sidebar-mini                            |
|---------------------------------------------------------|
-->

<body class="hold-transition skin-black sidebar-mini" onload="$('#divPrincipal').css('visibility', 'visible');">
<div class="wrapper" id="divPrincipal" name="divPrincipal" style="visibility: hidden;">

    <!-- Main Header -->
    <header class="main-header">

        <!-- Logo -->
        <a href="#" class="logo">
            <!-- mini logo for sidebar mini 50x50 pixels -->
            <span class="logo-mini"><img height="45" src="img/Logo_IMSS-BIENESTAR_2.png"/></span>
            <!-- logo for regular state and mobile devices -->
            <span class="logo-lg"><img height="45" src="img/Logo_IMSS-BIENESTAR_19Oct2024.png"/></span>
        </a>

        <!-- Header Navbar -->
        <nav class="navbar navbar-static-top" role="navigation">
            <!-- Sidebar toggle button-->
            <a href="#" class="sidebar-toggle" style="padding: 15px 10px;" data-toggle="push-menu" role="button">
                <span class="sr-only">Toggle navigation</span>
            </a>
            <p class="navbar-text">{!! $nom_Centro_Sal !!}</p>

            <!-- Navbar Right Menu -->
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <!-- User Account Menu -->
                    <li class="hidden-xs"><span class="fecha-actual" >

                                <?php
                                $dias = array("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado");
                                $meses = array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
                                echo $dias[date('w')]." ".date('d')." de ".$meses[date('n')-1]. " de ".date('Y') ;
                                ?> | <?php echo date('g:i'.' '.'a');?>

                        </span></li>
                    <li class="dropdown user user-menu">
                        <!-- Menu Toggle Button -->
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                            <!-- The user image in the navbar-->
                            <img src="img/avatar<?=$idSexo ?>.png" class="user-image" alt="User Image">
                            <!-- hidden-xs hides the username on small devices so only the image appears. -->
                            <span class="hidden-xs text-capitalize">BIENVENID@ {{explode(' ', $nombre)[0]}}</span>
                        </a>
                        <ul class="dropdown-menu">
                            <!-- The user image in the menu -->
                            <li class="user-header">
                                <img src="img/avatar<?=$idSexo ?>.png" class="img-circle" alt="User Image">

                                <p class="text-capitalize">
                                    {{$nombre}} - {{$especialidad}}
                                    <small></small>
                                </p>
                            </li>
                            <!-- Menu Footer-->
                            <li class="user-footer">
                                <div class="pull-left">
                                    <a href="administrar-micuenta" class="btn btn-primary btn-flat">Perfil</a>
                                </div>
                                <div class="pull-right">
                                    <a href="logout" class="btn btn-danger btn-flat">Cerrar sesión</a>
                                </div>
                            </li>
                        </ul>
                    </li>

                </ul>
            </div>
        </nav>
    </header>
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="main-sidebar">

        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">

            <!-- Sidebar user panel (optional) -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="img/avatar<?=$idSexo ?>.png" class="img-circle" alt="User Image">
                </div>
                <div class="pull-left info">
                    <p class="text-capitalize" style="white-space: normal;">{{$nombre}}</p>
                    <!-- Rol -->
                    <a href="#">{{$especialidad}}</a>
                </div>
            </div>

            <!-- Sidebar Menu -->
            <ul class="sidebar-menu" data-widget="tree">
                <li class="header">Menú</li>
                <li><a href="administrar-micuenta"><i class="fa fa-home"></i> <span>INICIO</span></a></li>

                @forelse($modulos as $modulo)

                    <li class="treeview">
                        <a class="active" href="#">
                            <i class="{{$modulo['icono']}}"></i>
                            <span>{{$modulo['nombre']}}</span>
                            <span class="pull-right-container">
                                <i class="fa fa-angle-left pull-right"></i>
                            </span>
                        </a>
                        <ul class="treeview-menu">
                            @foreach($modulo['accesos'] as $acceso)
                                <li class="li_left">
                                    <a style="white-space: normal;" href="{{$acceso['url']}}">{{$acceso['titulo']}}</a>
                                </li>
                            @endforeach
                        </ul>
                    </li>
            @empty
            @endforelse

            <!-- Optionally, you can add icons to the links -->
                <!--<li class="active"><a href="#"><i class="fa fa-id-card-o"></i> <span>Admisión</span></a></li>-->
                <!--<li><a href="Admision_UrgenciasBitacoraDiaria"><i class="fa fa-list"></i> <span>Bitacora Diaria</span></a></li>
                <li><a href="#"><i class="fa fa-th-list"></i> <span>Consultorios</span></a></li>
                <li><a href="#"><i class="fa fa-address-book-o"></i> <span>Cuentas de Usuario</span></a></li>
                <li class="treeview">
                    <a href="#"><i class="fa fa-gears"></i> <span>Administrar</span>
                        <span class="pull-right-container">
                <i class="fa fa-angle-left pull-right"></i>
              </span>
                    </a>
                    <ul class="treeview-menu">
                        <li><a href="#">Estilos CSS</a></li>
                        <li><a href="#">Seleccionar CSS</a></li>
                    </ul>
                </li>-->
            </ul>
            <!-- /.sidebar-menu -->
        </section>
        <!-- /.sidebar -->
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                @yield('title')
                <small></small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{url('/')}}"><i class="fa fa-dashboard"></i> Inicio</a></li>
                @yield('breadcrumb')
            </ol>
        </section>

        <!-- Main content -->
        <section class="content container-fluid">
            @yield('content')

        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->

    <!-- Main Footer -->
    <footer class="main-footer">
        <!-- To the right -->
        <div class="pull-right hidden-xs">

        </div>
        <!-- Default to the left -->
        <strong>&copy; Secretaría de Salud y Bienestar Social, 2017.</strong>
    </footer>

</div>
<!-- ./wrapper -->

<!-- REQUIRED JS SCRIPTS -->

<!-- jQuery 3 -->
<script src="js/jquery.min.js"></script>
<!-- Bootstrap 3.3.7 -->
<script src="js/bootstrap-clean.min.js"></script>
<!-- AdminLTE App -->
<script src="js/adminlte.min.js"></script>
<!-- bootstrap datepicker -->
<!--<script src="bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>-->
<!-- pace -->
<script src="js/pace.min.js"></script>
<!-- notify -->
<script src="js/notify.js"></script>


<script src="js/jquery.plugin.min.js"></script>
<script src="js/jquery.datepick.js"></script>
<script src="js/jquery.datepick-es.js"></script>
<script src="js/bootstrap-timepicker.min.js"></script>
<script src="js/jqv/dist/jquery.validate.js"></script>
@yield('scripts')
</body>

</html>
