<?php 

include_once'conection.php';



    $sql = $connection->prepare("select * from encuesta");
    $sql->execute();
    $encuesta = $sql->fetchAll(PDO::FETCH_ASSOC);



?>


<!DOCTYPE html>
<html lang="es" dir="ltr">
<head>
	<title>Registro de Personas</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="bootstrap-4.4.1-dist/css/bootstrap.min.css" >
    <link rel="stylesheet" href="DataTable/css/dataTables.bootstrap4.min.css" >
    <link rel="stylesheet" href="toast/src/jquery.toast.css" type="text/css">
    <link rel="stylesheet" href="css/estilos.css" >

 



</head>
<body>


    <?php 

      if($_SESSION['rol']==3){
  ?>

   <ul class="nav nav-pills">
        <li class="nav-item">
          <a class="nav-link" href="index.php">Inicio</a>
        </li>
         <li class="nav-item">
          <a class="nav-link" href="consultar_datos.php">Consultar</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="faltan.php">Faltan</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="auditoria.php">Auditoria</a>
        </li>
        <li class="nav-item">
          <a class="nav-link" href="registro_preg.php">Crear preguntas</a>
        </li> 
		<li class="nav-item">
          <a class="nav-link" href="#">Crear personas</a>
        </li>       
    </ul>

<?php 
      }
  ?>

<div class="container col-md-4 ">

 <div class="centrar">   
    <h3>COOPSERP</h3>
    <h3>REGISTRO DE PERSONAS</h3>
 </div> 
            <!-- INICIO FORMULARIO HTML -->
<form id="insert_form" class="" >

    <div class="form-row">
        <div class="col mb-3">
            <label for="encuesta">Encuesta:<span class="red">*</span></label>
            <select class="custom-select js-select2" id="encuesta" name="encuesta" >
                <option value="0" disabled selected>Seleccione</option>
                <?php
                    foreach ($encuesta as $row){  
                        $enc = $row['cons'];                         
                        echo "<option value='$enc'>".$row['detalle']."</option>";
                    }          
                    
                ?>          
            </select>
        </div>
    </div>


  

    

    <div class="form-row">
        <div class="col mb-3">
            <label for="nombre1">Primer nombre:<span class="red">*</span></label>
            <input type="text" class="form-control" id="nombre1"  name="nombre1" required >
			
		<label for="nombre2">Segundo nombre:<span class="red">*</span></label>
            <input type="text" class="form-control" id="nombre2"  name="nombre2" required >
			
			<label for="apellido1">Primer apellido:<span class="red">*</span></label>
            <input type="text" class="form-control" id="apellido1"  name="apellido1" required >
			
			<label for="apellido2">Segundo apellido:<span class="red">*</span></label>
            <input type="text" class="form-control" id="apellido2"  name="apellido2" required >
			
			<label for="cedula">Cedula:<span class="red">*</span></label>
            <input type="text" class="form-control" id="cedula"  name="cedula" required >
			
			<label for="nacimiento">Fecha nacimiento:<span class="red">*</span></label>
            <input type="date" class="form-control" id="nacimiento"  name="nacimiento" required >
			
			<label for="registro">Fecha registro:<span class="red">*</span></label>
            <input type="date" class="form-control" id="registro"  name="registro" required >
			
			<label for="genero">Genero:<span class="red">*</span></label>
			<select class="form-control" id="genero"  name="genero" required>
				<option value="0">Seleccione</option>
				<option value="FEMENINO">FEMENINO</option>
				<option value="MASCULINO">MASCULINO</option>
			</select>
			
			<label for="cargo">Cargo:<span class="red">*</span></label>
            <input type="text" class="form-control" id="cargo"  name="cargo" required >
			
			<label for="altura">Altura:<span class="red">*</span></label>
            <input type="text" class="form-control" id="altura"  name="altura" required >
			
			<label for="peso">Peso:<span class="red">*</span></label>
            <input type="text" class="form-control" id="peso"  name="peso" required >
			
			<label for="cu">CU:<span class="red">*</span></label>
            <input type="text" class="form-control" id="cu"  name="cu" required >
        </div>
    </div>




    <div class="form-group mb-10">
        <button class="btn btn-primary" type="button" id="Guardar">Guardar</button>
       <!--  <button class="btn btn-success" type="reset" name="reset">Limpiar</button> -->
    </div>

</form>

</div>

    <script src="jquery-3.4.1/jquery-3.4.1.min.js" ></script>
    <script src="popper-1.12.9/popper-1.12.9.min.js" ></script>
    <script src="bootstrap-4.4.1-dist/js/bootstrap.min.js" ></script>
    <script src="DataTable/js/dataTables.bootstrap4.min.js"></script>
    <script src="DataTable/js/jquery.dataTables.min.js"></script>
    <script src="toast/src/jquery.toast.js"></script>
    <script src="jquery_validator_1.10.0/jquery.validate.min.js" ></script>
    <script src="jquery_validator_1.10.0/messages_es.js" ></script>    


    <!-- <script type="text/javascript">var toas = '<?php //echo json_encode($_SESSION['toas']);?>'; </script> -->
	<script src="js/registro_pers.js"></script>
</body>
</html>

<!-- The Modal -->
<div class="modal" id="myModal">
  <div class="modal-dialog">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">Registro Exitoso</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
        <div class="centrar">
            <h3>Pronto</h3> 
            <h3>nos comunicaremos</h3> 
            <h3>con usted</h3>
        </div>
      </div>

      <!-- Modal footer -->
      <div class="modal-footer">
        <button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
      </div>

    </div>
  </div>
</div>
