<?php
helper('html');
?>

<!doctype html>
<html lang="es">

<head>

    <meta charset="utf-8" />
    <title><?= isset($pageTitle) ? $pageTitle : 'Sistema administrativo'; ?></title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta content="Premium Multipurpose Admin & Dashboard Template" name="description" />
    <meta content="Themesbrand" name="author" />
    <!-- App favicon -->
    <link rel="shortcut icon" href="assets/images/favicon.ico">

    <?php

    echo link_tag('css/alertify.min.css');
    //echo link_tag('css/dropzone.min.css');

    echo link_tag('https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/css/select2.min.css');
    echo link_tag('css/sweetalert2.min.css');
    echo link_tag('css/bootstrap.min.css');
    echo link_tag('css/icons.min.css');
    echo link_tag('css/datatables.min.css');
    echo link_tag('css/app.css');
    echo link_tag('css/fontawesome-free-6.6.0-all.min.css');
    echo link_tag('css/select2.min.css');
    echo link_tag('css/select2-bootstrap-5-theme.min.css');
    echo link_tag('css/flatpickr.min.css');
    echo link_tag('css/choices.min.css');
    echo link_tag('css/propios.css');

    $this->renderSection('css')

    ?>

</head>


<body data-sidebar="dark">

<!-- <body data-layout="horizontal"> -->

<!-- Begin page -->
<div id="layout-wrapper">


    <header id="page-topbar" class="isvertical-topbar">
        <div class="navbar-header">
            <div class="d-flex">
                <!-- LOGO -->
                <div class="navbar-brand-box">
                    <a href="index.html" class="logo logo-dark">
                                <span class="logo-sm">
                                    <img src="assets/images/logo-dark-sm.png" alt="" height="22">
                                </span>
                        <span class="logo-lg">
                                    <img src="assets/images/logo-dark-sm.png" alt="" height="22">
                                </span>
                    </a>

                    <a href="index.html" class="logo logo-light">
                                <span class="logo-lg">
                                    <img src="assets/images/logo-light.png" alt="" height="22">
                                </span>
                        <span class="logo-sm">
                                    <img src="assets/images/logo-light-sm.png" alt="" height="22">
                                </span>
                    </a>
                </div>

                <button type="button" class="btn btn-sm px-3 font-size-16 header-item vertical-menu-btn topnav-hamburger">
                            <span class="hamburger-icon open">
                                <span></span>
                                <span></span>
                                <span></span>
                            </span>
                </button>

                <div class="d-none d-sm-block ms-3 align-self-center">
                    <h4 class="page-title"><?=$tituloModulo;?></h4>
                </div>

            </div>

            <div class="d-flex">
<!--                <div class="dropdown">-->
<!--                    <button type="button" class="btn header-item"-->
<!--                            data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">-->
<!--                        <i class="icon-sm" data-eva="search-outline"></i>-->
<!--                    </button>-->
<!--                    <div class="dropdown-menu dropdown-menu-end dropdown-menu-md p-0">-->
<!--                        <form class="p-2">-->
<!--                            <div class="search-box">-->
<!--                                <div class="position-relative">-->
<!--                                    <input type="text" class="form-control bg-light border-0" placeholder="Search...">-->
<!--                                    <i class="search-icon" data-eva="search-outline" data-eva-height="26" data-eva-width="26"></i>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </form>-->
<!--                    </div>-->
<!--                </div>-->

                <div class="dropdown d-inline-block">
                    <button type="button" class="btn header-item user text-start d-flex align-items-center" id="page-header-user-dropdown-v"
                            data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <img class="rounded-circle header-profile-user" src="/images/user.png"
                             alt="Header Avatar">
                    </button>
                    <div class="dropdown-menu dropdown-menu-end pt-0">
                        <div class="p-3 border-bottom">
                            <h6 class="mb-0"><?= trim(get_user()->persona->pers_primer_nombre.' '.get_user()->persona->pers_segundo_nombre.' '.get_user()->persona->pers_primer_apellido.' '.get_user()->persona->pers_segundo_apellido) ?></h6>
                            <p class="mb-0 font-size-11 text-muted"><?= get_user()->persona->pers_correo ?></p>
                        </div>
<!--                        <a class="dropdown-item" href="contacts-profile.html"><i class="mdi mdi-account-circle text-muted font-size-16 align-middle me-1"></i> <span class="align-middle">Profile</span></a>-->
<!--                        <a class="dropdown-item" href="apps-chat.html"><i class="mdi mdi-message-text-outline text-muted font-size-16 align-middle me-1"></i> <span class="align-middle">Messages</span></a>-->
<!--                        <a class="dropdown-item" href="pages-faqs.html"><i class="mdi mdi-lifebuoy text-muted font-size-16 align-middle me-1"></i> <span class="align-middle">Help</span></a>-->
<!--                        <div class="dropdown-divider"></div>-->
<!--                        <a class="dropdown-item" href="#"><i class="mdi mdi-wallet text-muted font-size-16 align-middle me-1"></i> <span class="align-middle">Balance : <b>$6951.02</b></span></a>-->
<!--                        <a class="dropdown-item d-flex align-items-center" href="#"><i class="mdi mdi-cog-outline text-muted font-size-16 align-middle me-1"></i> <span class="align-middle">Settings</span><span class="badge bg-success-subtle text-success ms-auto">New</span></a>-->
<!--                        <a class="dropdown-item" href="auth-lock-screen.html"><i class="mdi mdi-lock text-muted font-size-16 align-middle me-1"></i> <span class="align-middle">Lock screen</span></a>-->
                        <a class="dropdown-item" href="<?= route_to('admin.logout') ?>"><i class="mdi mdi-logout text-muted font-size-16 align-middle me-1"></i> <span class="align-middle">Salir</span></a>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <!-- ========== Left Sidebar Start ========== -->
    <div class="vertical-menu">

        <!-- LOGO -->
        <div class="navbar-brand-box">
            <a href="index.html" class="logo logo-dark">
                        <span class="logo-sm">
                            <img src="assets/images/logo-dark-sm.png" alt="" height="22">
                        </span>
                <span class="logo-lg">
                            <img src="assets/images/logo-dark.png" alt="" height="22">
                        </span>
            </a>

            <a href="index.html" class="logo logo-light">
                        <span class="logo-lg">
                            <img src="assets/images/logo-light.png" alt="" height="22">
                        </span>
                <span class="logo-sm">
                            <img src="assets/images/logo-light-sm.png" alt="" height="22">
                        </span>
            </a>
        </div>

        <button type="button" class="btn btn-sm px-3 header-item vertical-menu-btn topnav-hamburger">
                    <span class="hamburger-icon">
                        <span></span>
                        <span></span>
                        <span></span>
                    </span>
        </button>

        <div data-simplebar class="sidebar-menu-scroll">

            <!--- Sidemenu -->
            <div id="sidebar-menu">
                <!-- Left Menu Start -->
                <ul class="metismenu list-unstyled" id="side-menu">

<!--                    <li>-->
<!--                        <a href="/modulo">-->
<!--                            <i class="icon nav-icon" data-eva="grid-outline"></i>-->
<!--                            <span class="menu-item" data-key="t-calendar">Regresar a Modulo</span>-->
<!--                        </a>-->
<!--                    </li>-->

                    <li class="menu-title" data-key="t-menu">Opciones</li>

                    <?php foreach (get_modulos() as $modulo): ?>

                        <li>
                            <a href="javascript: void(0);" class="has-arrow" aria-expanded="true">
                                <i class="icon nav-icon" data-eva="<?=$modulo->modu_icono?>"></i>
                                <span class="menu-item" data-key="sm-<?=$modulo->modu_id?>"><?=$modulo->modu_nombre?></span>
                            </a>

                            <ul class="sub-menu" aria-expanded="false">
                                <?php foreach ($modulo->temp_accesos as $accesos): ?>
                                    <li><a href="<?=$accesos->temp_enlace?>" data-key="a-<?=$accesos->sumo_id?>"><?=$accesos->sumo_descripcion?></a></li>
                                <?php endforeach ?>
                            </ul>
                        </li>

                    <?php endforeach ?>

                </ul>
            </div>
            <!-- Sidebar -->

        </div>
    </div>
    <!-- Left Sidebar End -->

    <!-- ============================================================== -->
    <!-- Start right Content here -->
    <!-- ============================================================== -->
    <div class="main-content">

        <div class="page-content">
            <div class="container-fluid">
                <?= $this->renderSection('content') ?>
            </div> <!-- container-fluid -->
        </div>
        <!-- End Page-content -->
        <footer class="footer">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-12">
                        <script>document.write(new Date().getFullYear())</script> &copy; Borex. Design & Develop by Themesbrand
                    </div>
                </div>
            </div>
        </footer>

    </div>
    <!-- end main content-->

</div>
<!-- END layout-wrapper -->

<?php
echo script_tag('js/libs/jquery-3.6.0.min.js');
echo script_tag('js/libs/typeahead.bundle.min.js');
echo script_tag('js/libs/datatables.min.js');
echo script_tag('js/libs/bootstrap.bundle.min.js');
echo script_tag('js/libs/metismenujs.min.js');
echo script_tag('js/libs/simplebar.min.js');
echo script_tag('js/libs/eva.min.js');
echo script_tag('js/libs/sweetalert2.min.js');
echo script_tag('js/libs/alertify.min.js');
echo script_tag('js/libs/app.js');
echo script_tag('js/libs/jquery-ui.min.js');
echo script_tag('js/functions.js');
echo script_tag('js/libs/crypto.js');
echo script_tag('js/libs/handlebars.min-v4.7.8.js');
echo script_tag('js/libs/fontawesome-free-6.6.0-all.min.js');
echo script_tag('js/libs/select2.full.min.js');
echo script_tag('js/libs/select2-es.js');
echo script_tag('js/libs/flatpickr.min.js');
echo script_tag('js/libs/choices.min.js');
$this->renderSection('js')

?>

</body>
</html>