<!DOCTYPE html>
<html lang="PT-br">
    <?php include_once '../paginas/header.php';?>
<body>
    <?php include_once '../paginas/menu.php';?>
<br>
<br>
<br>
      <div class="services-details-area default-padding">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                   <!-- <div class="col-lg-8">
                        <h2>Lista de clientes</h2>
                        
                        <br>
                      <form>
							<input name="pesquisar" id="pesquisar" class="form-control" type="text" placeholder="Pesquisar"><br>
							<input class="btn btn-success pull-right"  type="submit" value="Pesquisar / Limpar pesquisa"><br>
                            <br>
                            <br>
						</form>
                    </div>-->


<!----modallll----->

<div class="blog-area single full-blog full-blog default-padding-forms">
<div class="container">
        <div class="form-title text-center">
            <h2>Cadastrar perguntas</h2>
        </div>
        
        
        <form action="../efetiva/cadastrarpergunta.php" method="POST">

            <input type="text" class="form-control" id="titulo[]" name="titulo[]" placeholder="Digite o titulo...">
   
            <br>

            <input type="text" class="form-control" id="subtitulo[]" name="subtitulo[]" placeholder="Digite o subtitulo...">
   
            <br>

            <input type="text" class="form-control" id="conceito[]" name="conceito[]" placeholder="Digite o conceito...">
                
            <br>
                
            <input type="text" class="form-control" id="perguntas[]" name="perguntas[]" placeholder="Digite a pergunta...">
            <br>

            <h4>Qual categoria?</h4>
                <select name="id_categoria_pergunta[]" id="id_categoria_pergunta[]">
                <option value="0">Selecione</option>
                <option value="1">Onbording</option>
                <option value="2">Efetiva</option>
                <option value="3">Direciona</option>
                <option value="4">Organiza</option>
                <option value="5">Empresa</option>
                <option value="6">Liderando</option>
                <option value="7">Fortuna</option>
            </select>
                
            <br>
            <br>
            <button class="btn circle btn-theme border btn-sm" value="Cadastrar" type="submit" name="CadUsuario">Enviar</button>
        

        </form>
    
        <br>
        <br>


        <h2>Lista de perguntas</h2>
        
        </div>
</div>



<!----FIM MODAL--->


<?php
                    // Include config file
                    require_once "../banco/config.php";

                    $pescliente_id = $_GET['pesquisar'];
                    
                    // Attempt select query execution
                    $sql = "SELECT * FROM perguntas ";
                    if($result = mysqli_query($link, $sql)){
                        if(mysqli_num_rows($result) > 0){
                            echo '<table class="table table-bordered table-striped">';
                                echo "<thead>";
                                    echo "<tr>";
                                        echo "<th>Título</th>";
                                        echo "<th>Subtítulo</th>";
                                        echo "<th>Conceito</th>";
                                        echo "<th>Perguntas</th>";
                                        echo "<th>Categoria</th>";
                                        echo "<th>Ações</th>";
                                    echo "</tr>";
                                echo "</thead>";
                                echo "<tbody>";
                                while($row = mysqli_fetch_array($result)){
                                    echo "<tr>";
                                        echo "<td>" . $row['titulo'] . "</td>";
                                        echo "<td>" . $row['subtitulo'] . "</td>";
                                        echo "<td>" . $row['conceito'] . "</td>";
                                        echo "<td>" . $row['perguntas'] . "</td>";
                                        echo "<td>" . $row['id_categoria_pergunta'] . "</td>";
                                        echo "<td>";
                                            echo '<a href="editarperguntas.php?id='. $row['id'] .'" class="mr-3" title="Update Record" data-toggle="tooltip"><span class="fa fa-pencil"></span></a>';
                                            echo '<a href="../editar/deleteperguntas.php?id='. $row['id'] .'" title="Delete Record" data-toggle="tooltip"><span class="fa fa-trash"></span></a>';
                                        echo "</td>";
                                    echo "</tr>";
                                }
                                echo "</tbody>";                            
                            echo "</table>";
                            // Free result set
                            mysqli_free_result($result);
                        } else{
                            echo '<div class="alert alert-danger"><em>No records were found.</em></div>';
                        }
                    } else{
                        echo "Oops! Something went wrong. Please try again later.";
                    }
 
                    // Close connection
                    mysqli_close($link);
                    ?>
                </div>
            </div>        
        </div>
    </div>
    <?php include_once '../paginas/foorter.php';?>
</body>
</html>
