<?php

?>
<!DOCTYPE html>
<html lang="en">

<head>
  <title>Mi Perfil - Recursos Humanos</title>
  <?php
  include "../conexion/conexion.php";
  include '../layout/header.php';
  include '../validacion.php';
  include '../siguientedia.php';

  $idagenda = $_GET['agenda'];

    $sql = "SELECT * FROM agenda WHERE idagenda='$idagenda'";
    $consulta = $pdo->prepare($sql);
    $consulta->execute();
    $agendas = $consulta->fetchAll(PDO::FETCH_ASSOC);

    foreach ($agendas as $goagenda) {
        $idagenda = $goagenda['idagenda'];
        $postulante = $goagenda['postulante'];
        $tipodocumento = $goagenda['tipodocumento'];
        $numerodocumento = $goagenda['numerodocumento'];
        $edad = $goagenda['edad'];    
        $celular  = $goagenda['celular'];                                             
        $fuente = $goagenda['fuente'];
        $contacto = $goagenda['contacto'];
        $distrito = $goagenda['distrito'];
        $observaciones = $goagenda['observaciones'];                                          
        $agenda = $goagenda['agenda'];
        $estado = $goagenda['estado'];
        $estadofinal = $goagenda['estadofinal'];
        $fecharegistro = $goagenda['fecharegistro'];
        $horaregistro = $goagenda['horaregistro'];
        $fechaagenda = $goagenda['fechaagenda'];
        $turno = $goagenda['turno'];
        $idusuario = $goagenda['idusuario']; 
        $contador = $contador + 1;
        
        
        $sql = "SELECT * FROM usuario WHERE idusuario='$idusuario'";
        $consulta = $pdo->prepare($sql);
        $consulta->execute();
        $usuarios = $consulta->fetchAll(PDO::FETCH_ASSOC);

            foreach ($usuarios as $gousuario) {
                    $nombreusuario = $gousuario['nombreusuario'];                                 
            }
        }
  ?>
</head>

<body class="inner_page general_elements">
  <div class="full_container">
    <div class="inner_container">
      <!-- MENÚ  -->
      <?php include '../layout/menu.php'; ?>
      <!-- FIN DEL MENÚ -->
      <!-- right content -->
      <div id="content">
        <!-- SUBMENÚ  -->
        <?php include '../layout/submenu.php'; ?>
        <!-- FIN DEL SUBMENU -->
        <!-- dashboard inner -->
        <div class="midde_cont">
          <div class="container-fluid">
            <div class="row column_title">
              <div class="col-md-12">
                <div class="card-title">
                  <br>
                  <h2>Postulante</h2>
                  <br>
                </div>
              </div>
            </div>
            <!-- row -->
            <form action="../login/inicio.php" method="POST">
              <div class="row column4 graph">
                <!-- tab style 1 -->
                <div class="col-md-12">
                  <!-- CUADRO DE CLIENTE-->
                  <div class="card">
                    <div class="card-header" style="background-color:#111638; color:white; font-weight:bold;">
                      <h3 class="card-title">Datos Personales del Postulante</h3>
                    </div>

                    <div class="card-body row">
                      <div class="form-group col-md-2">
                        <label for="exampleInputEmail1">Celular</label>
                        <input type="text" class="form-control" name="txtcelular" value="<?php echo $celular;?>" placeholder="Celular" maxlength="9" disabled>
                      </div>
                      <div class="form-group col-md-4">
                        <label for="exampleInputEmail1">Nombres y Apellidos</label>
                        <input type="text" class="form-control" id="txtnombresyapellidos" value="<?php echo $postulante;?>" name="txtpostulante" disabled required placeholder="Nombres y Apellidos" onkeyup="mayus(this)">
                        <input type="text" class="form-control" name="txtsede" value="<?php echo $sede_sesion;?>" style="display:none;">
                      </div>
                      <div class="form-group col-md-2">
                        <label for="exampleSelectBorderWidth2">Doc. Identidad</label>
                        <select class="form-control rounded-2" name="cbotipodocumento" disabled>
                          <option value="DNI" <?php if($tipodocumento == "DNI"){echo "selected";}?>>DNI</option>
                          <option value="CE" <?php if($tipodocumento == "CE"){echo "selected";}?>>CARNET.EXT</option>
                          <option value="PASAPORTE" <?php if($tipodocumento == "PASAPORTE"){echo "selected";}?>>PASAPORTE</option>
                        </select>
                      </div>
                      <div class="form-group col-md-2">
                        <label for="exampleInputEmail1">DNI/C.E/PASAPORTE</label>
                        <input type="text" class="form-control" name="txtnumerodocumento" disabled value="<?php echo $numerodocumento;?>" required placeholder="12345678" onkeyup="mayus(this)" maxlength="10">
                      </div>
                      <div class="form-group col-md-2">
                        <label for="exampleSelectBorderWidth2">Edad</label>
                        <select class="form-control rounded-2" name="cboedad" disabled>
                          <option value="" selected>Seleccionar</option>
                          <?php for ($i = 18; $i <= 50; $i++) { ?>
                            <option value="<?php echo $i; ?>" <?php if($i == $edad){echo "selected";}?>><?php echo $i; ?></option>
                          <?php } ?>
                        </select>
                      </div>
                      <div class="form-group col-md-3">
                        <label for="exampleSelectBorderWidth2">Distrito</label>
                        <select class="form-control rounded-2" name="cbodistrito" disabled>
                          <option value="ANCON" <?php if($distrito == "ANCON"){echo "selected";}?>>Ancón</option>
                          <option value="ATEVITARTE" <?php if($distrito == "ATE VITARTE"){echo "selected";}?>>Ate Vitarte</option>
                          <option value="BARRANCO" <?php if($distrito == "BARRANCO"){echo "selected";}?>>Barranco</option>
                          <option value="BREÑA" <?php if($distrito == "BREÑA"){echo "selected";}?>>Breña</option>
                          <option value="CARABAYLLO" <?php if($distrito == "CARABAYLLO"){echo "selected";}?>>Carabayllo</option>
                          <option value="CHACLACAYO" <?php if($distrito == "CHACLACAYO"){echo "selected";}?>>Chaclacayo</option>
                          <option value="CHORRILLOS" <?php if($distrito == "CHORRILLOS"){echo "selected";}?>>Chorrillos</option>
                          <option value="CIENEGUILLA" <?php if($distrito == "CIENEGUILLA"){echo "selected";}?>>Cieneguilla</option>
                          <option value="COMAS" <?php if($distrito == "COMAS"){echo "selected";}?>>Comas</option>
                          <option value="ELAGUSTINO" <?php if($distrito == "EL AGUSTINO"){echo "selected";}?>>El Agustino</option>
                          <option value="INDEPENDENCIA" <?php if($distrito == "INDEPENDENCIA"){echo "selected";}?>>Independencia</option>
                          <option value="JESUSMARIA" <?php if($distrito == "JESUS MARIA"){echo "selected";}?>>Jesús María</option>
                          <option value="LAMOLINA" <?php if($distrito == "LA MOLINA"){echo "selected";}?>>La Molina</option>
                          <option value="LAVICTORIA" <?php if($distrito == "LA VICTORIA"){echo "selected";}?>>La Victoria</option>
                          <option value="LIMA" <?php if($distrito == "LIMA"){echo "selected";}?>>Lima</option>
                          <option value="LINCE" <?php if($distrito == "LINCE"){echo "selected";}?>>Lince</option>
                          <option value="LOSOLIVOS" <?php if($distrito == "LOS OLIVOS"){echo "selected";}?>>Los Olivos</option>
                          <option value="LURIGANCHO" <?php if($distrito == "LURIGANCHO"){echo "selected";}?>>Lurigancho</option>
                          <option value="LURIN" <?php if($distrito == "LURIN"){echo "selected";}?>>Lurín</option>
                          <option value="MAGDALENADELMAR" <?php if($distrito == "MAGDALENA DEL MAR"){echo "selected";}?>>Magdalena del Mar</option>
                          <option value="MIRAFLORES" <?php if($distrito == "MIRAFLORES"){echo "selected";}?>>Miraflores</option>
                          <option value="PACHACAMAC" <?php if($distrito == "PACHACAMAC"){echo "selected";}?>>Pachacamac</option>
                          <option value="PUCUSANA" <?php if($distrito == "PUCUSANA"){echo "selected";}?>>Pucusana</option>
                          <option value="PUEBLOLIBRE" <?php if($distrito == "PUEBLO LIBRE"){echo "selected";}?>>Pueblo Libre</option>
                          <option value="PUENTEPIEDRA" <?php if($distrito == "PUENTE PIEDRA"){echo "selected";}?>>Puente Piedra</option>
                          <option value="PUNTAHERMOSA" <?php if($distrito == "PUNTA HERMOSA"){echo "selected";}?>>Punta Hermosa</option>
                          <option value="PUNTANEGRA" <?php if($distrito == "PUNTA NEGRA"){echo "selected";}?>>Punta Negra</option>
                          <option value="RIMAC" <?php if($distrito == "RIMAC"){echo "selected";}?>>Rímac</option>
                          <option value="SANBARTOLO" <?php if($distrito == "SAN BARTOLO"){echo "selected";}?>>San Bartolo</option>
                          <option value="SANBORJA" <?php if($distrito == "SAN BORJA"){echo "selected";}?>>San Borja</option>
                          <option value="SANISIDRO" <?php if($distrito == "SAN ISIDRO"){echo "selected";}?>>San Isidro</option>
                          <option value="SANJUANDELURIGANCHO" <?php if($distrito == "SAN JUAN DE LURIGANCHO"){echo "selected";}?>>San Juan de Lurigancho</option>
                          <option value="SANJUANDEMIRAFLORES" <?php if($distrito == "SAN JUAN DE MIRAFLORES"){echo "selected";}?>>San Juan de Miraflores</option>
                          <option value="SANLUIS" <?php if($distrito == "SANLUIS"){echo "selected";}?>>San Luis</option>
                          <option value="SANMARTINDEPORRES" <?php if($distrito == "SAN MARTIN DE PORRES"){echo "selected";}?>>San Martín de Porres</option>
                          <option value="SANMIGUEL" <?php if($distrito == "SAN MIGUEL"){echo "selected";}?>>San Miguel</option>
                          <option value="SANTAANITA" <?php if($distrito == "SANTA ANITA"){echo "selected";}?>>Santa Anita</option>
                          <option value="SANTAMARIADELMAR" <?php if($distrito == "SANTA MARIA DEL MAR"){echo "selected";}?>>Santa María del Mar</option>
                          <option value="SANTAROSA" <?php if($distrito == "SANTA ROSA"){echo "selected";}?>>Santa Rosa</option>
                          <option value="SANTIAGODESURCO" <?php if($distrito == "SANTIAGO DE SURCO"){echo "selected";}?>>Santiago de Surco</option>
                          <option value="SURQUILLO" <?php if($distrito == "SURQUILLO"){echo "selected";}?>>Surquillo</option>
                          <option value="VILLAMARIADELTRIUNFO" <?php if($distrito == "VILLA MARIA DEL TRIUNFO"){echo "selected";}?>>Villa María del Triunfo</option>
                          <option value="VILLAELSALVADOR" <?php if($distrito == "VILLA EL SALVADOR"){echo "selected";}?>>Villa El Salvador</option>
                        </select>
                      </div>
                      <div class="form-group col-md-3">
                        <label for="exampleSelectBorderWidth2">Fuente</label>
                        <select class="form-control rounded-2" name="cbofuente" disabled>
                          
                          <option value="FACEBOOK" <?php if($fuente == "FACEBOOK"){echo "selected";}?>>FACEBOOK</option>
                          <option value="COMPUTRABAJO" <?php if($fuente == "COMPUTRABAJO"){echo "selected";}?>>COMPUTRABAJO</option>
                          <option value="INSTAGRAM" <?php if($fuente == "INSTAGRAM"){echo "selected";}?>>INSTAGRAM</option>
                          <option value="TIKTOK" <?php if($fuente == "TIKTOK"){echo "selected";}?>>TIKTOK</option>
                          <option value="VOLANTES" <?php if($fuente == "VOLANTES"){echo "selected";}?>>VOLANTES</option>
                          <option value="REFERIDO" <?php if($fuente == "REFERIDO"){echo "selected";}?>>REFERIDO</option>
                          <option value="BUMERAN" <?php if($fuente == "BUMERAN"){echo "selected";}?>>BUMERAN</option>
                          <option value="OTROS" <?php if($fuente == "OTROS"){echo "selected";}?>>OTROS</option>
                        </select>
                      </div>
                      <div class="form-group col-md-3">
                        <label>Fecha Agenda:</label>
                        <div class="input-group date" id="txtfechanacimiento" data-target-input="nearest">
                          <input type="date" class="form-control datetimepicker-input" disabled value="<?php echo $fechaagenda; ?>" name="txtfechaagenda" data-target="#reservationdate" required/>
                        </div>
                      </div>
                      <div class="form-group col-md-3">
                        <label for="exampleSelectBorderWidth2">Turno</label>
                        <select class="form-control rounded-2" name="cboturno" disabled>
                          <option value="MAÑANA" <?php if($turno == "MAÑANA"){echo "selected";}?>>MAÑANA</option>
                          <option value="TARDE" <?php if($turno == "TARDE"){echo "selected";}?>>TARDE</option>
                        </select>
                      </div>
                      <div class="form-group col-md-3">
                        <label for="exampleSelectBorderWidth2">Estado Agenda</label>
                        <select class="form-control rounded-2" name="cboagendado" disabled>
                          <option value="AGENDADO" <?php if($agenda == "AGENDADO"){echo "selected";}?>>AGENDADO</option>
                          <option value="REPROGRAMADO" <?php if($agenda == "REPROGRAMADO"){echo "selected";}?>>REPROGRAMADO</option>
                        </select>
                      </div>
                      <div class="form-group col-md-3">
                        <label for="exampleSelectBorderWidth2">Estado Actual</label>
                        <select class="form-control rounded-2" name="cboestado" disabled>
                          <option value="" <?php if($estado == ""){echo "selected";}?>>NO DEFINIDO</option>
                          <option value="CONFIRMADO" <?php if($estado == "CONFIRMADO"){echo "selected";}?>>CONFIRMADO</option>
                          <option value="NORESPONDE" <?php if($estado == "NORESPONDE"){echo "selected";}?>>NO RESPONDE</option>
                          <option value="NOINTERESADO" <?php if($estado == "NOINTERESADO"){echo "selected";}?>>NO INTERESADO</option>
                          <option value="LISTANEGRA" <?php if($estado == "LISTANEGRA"){echo "selected";}?>>LISTA NEGRA</option>
                        </select>
                      </div>
                      <?php if($estado == "CONFIRMADO" || $estado == "LISTANEGRA") {?>
                      <div class="form-group col-md-3">
                        <label for="exampleSelectBorderWidth2">Estado Final</label>
                        <select class="form-control rounded-2" name="cboestado" disabled>
                        <option value="" <?php if($estadofinal == ""){echo "selected";}?>>NO DEFINIDO</option>
                          <option value="CAPACITACION" <?php if($estadofinal == "CAPACITACION"){echo "selected";}?>>CAPACITACI&Oacute;N</option>
                          <option value="PLATAFORMA" <?php if($estadofinal == "PLATAFORMA"){echo "selected";}?>>PLATAFORMA</option>
                          <option value="BAJA" <?php if($estadofinal == "BAJA"){echo "selected";}?>>BAJA</option>
                        </select>
                      </div>
                      <?php } ?>
                      <div class="form-group col-md-12" id="adicional1">
                        <label for="exampleInputEmail1" id="lbladicional1">Observaciones</label>
                        <textarea type="textarea" rows="5" cols="10" disabled class="form-control" name="txtobservaciones" placeholder="Observaciones" onkeyup="mayus(this)"><?php echo $observaciones;?></textarea>
                      </div>
                    </div>

                  </div>

                  <div class="card-body row">
                    <div class="col-md-12 mb-3">
                      <input type="submit" class="btn btn-primary ml-3" value="Volver">
                    </div>
                  </div>
                </div>
              </div>
            </form>
          </div>
          <!-- FOOTER -->
          <?php include '../layout/footer.php' ?>
          <!-- FIN DEL FOOTER -->
        </div>
        <!-- end dashboard inner -->
      </div>
    </div>
  </div>
  <!-- INCLUYENDO JS. -->
  <?php include '../layout/pie.php' ?>
</body>
</html>