<?php include 'views/header.php'; ?>

<div class="container-div">
    <h2>Usuarios</h2>
    <p>En este catálogo puedes ver, editar y eliminar usuarios.</p>
    <div class="project-actions">
        <button class="btn btn-add" data-bs-toggle="modal" data-bs-target="#addUserModal">Agregar usuario</button>
    </div>
    <table id="userTable" class="display">
        <thead>
            <tr>
                <th>#</th>
                <th>Nombre de usuario</th>
                <th>Status</th>
                <th>Acciones</th>
            </tr>
        </thead>
        <tbody>
        </tbody>
    </table>
</div>

<div class="modal fade" id="addUserModal" tabindex="-1" aria-labelledby="addUserModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="addUserModalLabel">Añadir usuarios <i class="fa-solid fa-user-plus"></i></h5>
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
            </div>
            <div class="modal-body">
                <form id="addUser">
                    <input type="hidden" id="id_usuario" name="id_usuario">
                    <div class="mb-3">
                        <div class="row">
                            <div class="col-md-6">
                                <label for="user" class="form-label">Nombre de usuario</label>
                                <input type="text" class="form-control" id="nombre" name="nombre" required>
                            </div>
                        </div>
                    </div>
                    <div class="mb-3">
                        <div class="row">
                            <div class="col-md-6">
                                <label for="password" class="form-label">Contraseña</label>
                                <input type="password" class="form-control" id="password" name="password" required>
                            </div>
                            <div class="col-md-6">
                                <label for="confirmPassword" class="form-label">Confirmar Contraseña</label>
                                <input type="password" class="form-control" id="confirmPassword" name="confirmPassword" required>
                            </div>
                        </div>
                    </div>
                    <div class="mb-3">
                        <label for="rol" class="form-label">Rol</label>
                        <select class="form-select" id="rol_id" name="rol_id" required>
                            <option value="">Selecciona un rol</option>
                        </select>
                    </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-add">Guardar usuario</button>
                </form>
            </div>
        </div>
    </div>
</div>

<?php include 'views/footer.php'; ?>