<?php 
    session_start();
    include '../layout/header.php'; 
    include '../validacion.php';
    include '../siguientedia.php';
    include "../conexion/conexion.php";
    
if (isset($_SESSION['start'])) {
?>
<!DOCTYPE html>
<html lang="en">
   <head>
   <title>Buscar - Recursos Humanos</title>
   </head>
   <body class="inner_page tables_page">
      <div class="full_container">
         <div class="inner_container">
            <!-- MENÚ  -->
            <?php include '../layout/menu.php'; ?>
            <!-- FIN DEL MENÚ -->
            <!-- right content -->
            <div id="content">
               <!-- SUB-MENÚ -->
               <?php include '../layout/submenu.php'; ?>
               <!-- FIN DEL SUB-MENÚ -->
               <!-- dashboard inner -->
               <div class="midde_cont">
                  <div class="container-fluid">
                     <div class="row column_title">
                        <div class="col-md-12">
                           <div class="page_title">
                                  <h2>Buscar Agendados</h2>
                           </div>
                        </div>
                     </div>
                     <!-- row -->
                     
                     
                     
                     
                     <div class="row">
                        <!-- table section -->
                        <div class="col-md-12">
                           <div class="white_shd full margin_bottom_30">
                              <div class="full graph_head">
                                 <div class="heading1 margin_0">
                                    <h2>Buscar</h2>
                                 </div>
                              </div>
                              <section class="content">
                                  <form action="mostrarbusqueda.php" method="POST">
                                    <div class="container-fluid">
                                      <div class="row">
                                        <div class="card-body row">
                                          <div class="form-group col-md-3">
                                            <label for="exampleInputEmail1">Celular</label>
                                            <input type="text" class="form-control" id="idcelular" name="txtcelular" placeholder="Ingrese Celular" maxlength="9">
                                          </div>
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="card-body row">
                                          <div class="form-group col-md-3">
                                            <label for="exampleInputEmail1">NOMBRE/APELLIDO/DNI</label>
                                            <input type="text" class="form-control" name="txtnombreapellido" placeholder="Buscar">
                                          </div>
                                        </div>
                                      </div>
                                      <div class="row">
                                        <div class="card-body row">
                                          <div class="form-group col-md-3">
                                            <label for="exampleInputEmail1">Rango de Fechas</label>
                                            <input type="date" class="form-control datetimepicker-input" data-target="#reservationdate" id="datefechainicio" name="txtfechainicio" value="<?php echo $fechaactual; ?>">
                                            <input type="date" class="form-control datetimepicker-input" data-target="#reservationdate" id="datefechafin" name="txtfechafin" value="<?php echo $fechaactual;?>" > 
                                          </div>
                                        </div>
                                      </div>
                                      <?php if($idrol_sesion == 1  || $idrol_sesion == 4  || $idrol_sesion == 2){ ?>
                                      <div class="row" style="margin-top: 5px">
                                           <div class="form-group col-md-3"> 
                                              <label class="label_field">Estado</label>
                                              <select style="color: black;font-weight: 300;line-height: 45px; padding: 6px; font-size: 12pt" name="cboestado" >
                                                 <option value="TODOS" selected>TODOS</option>
                                                 <option value="AGENDADO">AGENDADOS</option>
                                                 <option value="CONFIRMADO">CONFIRMADOS</option>
                                                 <option value="NORESPONDE">NO RESPONDE</option>
                                                 <option value="NOINTERESADO">NO INTERESADO</option>
                                                 <option value="ASISTIERON">ASISTIERON</option>
                                              </select>
                                            </div>
                                     </div>
                                     <?php } ?>
                                     <?php 
                                        $sql = "SELECT idusuario,nombreusuario FROM usuario WHERE estado='2' and (idrol='1' || idrol='2' || idrol='3') ORDER BY nombreusuario";
                                        $consulta = $pdo->prepare($sql);
                                        $consulta->execute();
                                        $nusuarios = $consulta->fetchAll(PDO::FETCH_ASSOC);
                                     ?>
                                     <?php if($idrol_sesion == 1 || $idrol_sesion == 4  || $idrol_sesion == 2){ ?>
                                     <div class="row">
                                           <div class="form-group col-md-3"> 
                                              <label class="label_field">Reclutador(a)</label>
                                              <select style="color: black;font-weight: 300;line-height: 45px; padding: 6px; font-size: 12pt" name="cboreclutador" >
                                                <option value="TODOS" selected>TODOS</option>
                                                    <?php foreach ($nusuarios as $gousuarios){
                                                       $nombreusuarios = $gousuarios['nombreusuario'];
                                                       $idusuarios = $gousuarios['idusuario'];
                                                    ?>  
                                                <option value="<?php echo $idusuarios;?>"  <?php if($idusuarios == $idusuario){echo "selected";} ?> > <?php echo $nombreusuarios;?> </option>
                                                <?php } ?> 
                                              </select>
                                            </div>
                                     </div>
                                      <?php } ?>
                                      <div class="label_field">
                                        <div class="card-body row">
                                            <div class="form-group col-md-3" id="lprincipal">
                                              <a href="../login/inicio.php" class="btn btn-default">Cancelar</a>
                                              <input type="submit" class="btn btn-primary ml-3" value="Buscar">
                                            </div>
                                        </div>               
                                      </div>
                                      
                                    </div>
                                  </form>
                                </section>
                           </div>
                        </div>
                        <!-- table section -->
                     </div>
                     
                     
                     
                     
                     
                     <!-- end row -->
                  </div>
                                  
                  <!-- FOOTER -->
                  <?php include '../layout/footer.php' ?>
                  <!-- FIN DEL FOOTER -->
               </div>
               <!-- end dashboard inner -->
            </div>
         </div>
         <!-- model popup -->
         <!-- The Modal -->
         <div class="modal fade" id="myModal">
            <div class="modal-dialog">
               <div class="modal-content">
                  <!-- Modal Header -->
                  <div class="modal-header">
                     <h4 class="modal-title">Modal Heading</h4>
                     <button type="button" class="close" data-dismiss="modal">&times;</button>
                  </div>
                  <!-- Modal body -->
                  <div class="modal-body">
                     Modal body..
                  </div>
                  <!-- Modal footer -->
                  <div class="modal-footer">
                     <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                  </div>
               </div>
            </div>
         </div>
         <!-- end model popup -->
      </div>
      <!-- INCLUYENDO JS. -->
   <?php include '../layout/pie.php' ?>
   </body>
</html>
<?php
} else {
  echo'<script type="text/javascript">alert("Inicie Sesión Nuevamente");window.location.href="../login/login.php";</script>';
}
?>