<?php

include ("header.php");

$sql="SELECT * FROM `usuarios` WHERE activo = 1";

$resultado = mysqli_query($mysqli, $sql);

?>



        <div class="content-wrapper">

            <!-- START PAGE CONTENT-->

            <div class="page-heading">

                <h1 class="page-title">Usuarios</h1>

                <ol class="breadcrumb">

                    <li class="breadcrumb-item">

                    <button onclick="location.href='nusuarios.php'" type="button" class="btn btn-primary">Nuevo</button>

                    </li>

                    

                </ol>

            </div>

            <div class="page-content fade-in-up">

                <div class="ibox">

                    <div class="ibox-head">

                        <div class="ibox-title">Listado</div>

                    </div>

                    <div class="ibox-body">

                        <table class="table table-striped table-bordered table-hover" id="dataTablePacientes" cellspacing="0" width="100%">

                            <thead>

                                <tr>

                                        <th> USUARIO </th>

                                        <th> NOMBRE </th>

                                        <th> CORREO </th>

                                        <th> CEDULA </th>

                                        <th> ULTIMO INGRESO</th>

                                        <th> ROL</th>

                                        <th>MODIFICAR</th>

                                        <th>BORRAR</th>

                                    </tr>

                            </thead>

                                <tbody>          

                                    <?php while($row = mysqli_fetch_array($resultado)) {?>

                                    <tr>

                                        <td><?php echo utf8_decode($row['usuario']); ?></td>

                                        <td><?php echo utf8_decode($row['nombre']); ?></td>

                                        <td><?php echo $row['correo']; ?></td>

                                        <td><?php echo $row['cedula']; ?></td>

                                        <td> <?php echo $row['last_session']; ?></td>									

                                        <td> <?php echo $row['rol']; ?></td>                                              

                                        <td> <a href="nusuarios.php?id=<?php echo $row['id']; ?>&edt=1"><div class="icon-item"><i class="fa fa-edit"></i></div></a> </td>

                                        <td> <a href="#" data-href="nusuarios.php?id=<?php echo $row['id'] . '&borrar=1'; ?>" data-toggle="modal" data-target="#confirm-delete"><div class="icon-item"><i class="fa fa-trash"></i></div></a> </td>

                                    </tr>

                                    <?php } ?>

                                </tbody>

                        </table>

                </div>

            </div>                

<?php 

    include ('footer.php');

?>