<?php
require_once("../../config/conexion.php");
require_once("../../models/Permisos.php");
require_once("../../models/Biometrico.php");
$permiso = new Permisos();
$resultado = $permiso->Permisos_por_Perfil("BIOMETRICO", $_SESSION["perfil"]);
foreach ($resultado as $row) {
    $crear = $row["crear"];
    $estado = $row["estado"];
    $actualizar = $row["actualizar"];
    $eliminar = $row["eliminar"];
    $contacto = $row["contacto"];
    $leer = $row["leer"];
}
if (isset($_SESSION["usuariodbk"])) {
    ?>
    <!DOCTYPE html>
    <html lang="es">
        <head>
            <?php
            require_once '../html/MainHead.php';
            ?>
            <title>SIED | BIOMETRICO USUARIOS</title>
            <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
            <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/select2-bootstrap-theme/0.1.0-beta.10/select2-bootstrap.min.css" integrity="sha512-kq3FES+RuuGoBW3a9R2ELYKRywUEQv0wvPTItv3DSGqjpbNtGWVdvT8qwdKkqvPzT93jp8tSF4+oN4IeTEIlQA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
        </head>
        <body class="hold-transition sidebar-mini layout-fixed">           
            <?php require_once '../html/MainMenu.php'; ?> 
            <?php require_once '../html/MainHeader.php'; ?>             
            <div class="content-wrapper ">
                <div class="content-header">
                    <div class="container-fluid">
                        <div class="row mb-2">
                            <div class="col-sm-6">
                                <h1 class="m-0">BIOMETRICO</h1>
                            </div>
                            <div class="col-sm-6">
                                <ol class="breadcrumb float-sm-right">
                                    <li class="breadcrumb-item"><a href="../UsuHome/">Inicio</a></li>
                                    <li class="breadcrumb-item active">Biometrico</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="br-pagebody mg-t-5 pd-x-30">
                    <section class="content">
                        <div class="container-fluid">
                            <div class="row row-sm mg-t-20">
                                <div class="col-12">
                                    <div class="card">

                                        <div class="card-header">
                                            <h3 class="card-title>
                                                <i class="fas fa-users"></i>
                                                Biometrico
                                            </h3>

                                        </div>
                                        <div class="card-body responsive">
                                            <?php
                                            if ($crear == 1) {
                                                echo"<button class='btn btn-outline-primary' id='add_button' onclick='nuevo()'><i class='fa fa-plus-square mg-r-10 mr-2'></i>Nuevo Registro</button>";
                                            }
                                            ?>                                            
                                            <p></p>
                                            <table id="biometric-data" class="table table-bordered display table-striped responsive nowrap tablas" cellspacing="0" width="100%">
                                                <thead>
                                                    <tr>
                                                        <th>Id</th>
                                                        <th>Usuario</th>
                                                        <?php
                                                        if ($estado == 1 ) {
                                                            echo"<th>Estado</th>";
                                                        }
                                                        if ($actualizar == 1 || $eliminar == 1 || $contacto == 1 || $leer == 1) {
                                                            echo"<th>Acciones</th>";
                                                        }
                                                        ?>                                                       
                                                    </tr>
                                                </thead>
                                                <tbody>                                                    
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
            
            <?php require_once '../html/MainFooter.php'; ?> 
            <aside class="control-sidebar control-sidebar-dark">
            </aside>
            <?php require_once 'mantenimiento.php'; ?>
            <?php require_once 'visualizar.php'; ?>
            
            <?php require_once '../html/MainJS.php'; ?>
            
            <script type="text/javascript" src="biometrico.js"></script>
            <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
            
        </body>
    </html>
    <?php
} else {
    header("Location:" . Conexion::ruta() . "view/404/");
}
?>