<?php
session_start();
     if( (isset($_SESSION['IdStudent'])) &&($_SESSION['IdStudent']>0))
   {  
?>
<!DOCTYPE html>
<html>
<head>
<title>IESTP-Abancay</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="icon" href="assets/images/favicon.ico" type="image/x-icon">
<link rel="stylesheet"  href="bower_components/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet"  href="assets/pages/waves/css/waves.min.css"  media="all">
<link rel="stylesheet"  href="assets/icon/feather/css/feather.css">
<link rel="stylesheet" href="assets/icon/icofont/css/icofont.css">
<link rel="stylesheet" href="assets/icon/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet"  href="assets/css/style.css">
<?php
include("script_funciones.php");
include('db___cn.php');
$mysqli=conex_db_mysql();

$estudiante="SELECT IdEstudiante,Apellidos,Nombres,UrlFoto,Email,NumCelular,Dni,UrlCv,Domicilio
              FROM tb_estudiantes 
              WHERE IdEstudiante='".$_SESSION['IdStudent']."'";
$rs=$mysqli->query($estudiante);
$fila_estudiante=mysqli_fetch_array($rs);

$convocatoria="SELECT IdBolsaLaboral,Titulo,RazonSocial,Departamento,Vacantes,Sueldo,FechaLimite 
                        FROM tb_bolsa_laboral,tb_departamentos,tb_entidades
                         WHERE tb_bolsa_laboral.IdDepartamento= tb_departamentos.IdDepartamento
                         and tb_bolsa_laboral.IdRazonSocial=tb_entidades.IdRazonSocial
                         and IdBolsaLaboral='".base64_decode($_GET['id'])."'";
 $rs_convocatoria=$mysqli->query($convocatoria);
 $fila_ver_convocatoria=mysqli_fetch_array($rs_convocatoria);
 mysqli_close($mysqli);

?>
</head>
<body>

<div class="loader-bg">
<div class="loader-bar"></div>
</div>

<div id="pcoded" class="pcoded">
   <div class="pcoded-overlay-box"></div>
      <div class="pcoded-container navbar-wrapper">
        <?php
          MenuSuperior($fila_estudiante['Nombres'],$fila_estudiante['UrlFoto'],$_SESSION['Carrera']);
         ?>
<div class="pcoded-main-container">
  <div class="pcoded-wrapper">
    <?php
       MenuPrincipal();
     ?>
<div class="pcoded-content">
  <div class="page-header card">
      <div class="row align-items-end">
		<div class="col-lg-8">
			
		</div>
		<div class="col-lg-4">
			<div class="page-header-breadcrumb">
				<ul class=" breadcrumb breadcrumb-title">
				<li class="breadcrumb-item">
				<a href="principal.php"><i class="feather icon-home"></i></a>
				</li>
				<li class="breadcrumb-item">
				   <a href="#">Ofertas Laborales</a>
				</li>
				</ul>
			</div>
		</div>
      </div>
  </div>
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-wrapper">
<div class="page-body">
	  <div class="card">
			<div class="card-header bg-primary">
			    <h5>Ficha de postulaci&#243;n</h5>
          <span>Para postular, Ud. debe tener se CV actualizado. Caso contrario no podr&#225; postular a &#233;sta convocatoria</span>
			</div>
		    <div class="card-block">
           <form name="formFichaPostulacion" method="post" action="" onsubmit="registrarPostulacion(); return false"> 
             <input type="hidden" name="txt_id1" id="txt_id1" value="<?php echo $fila_ver_convocatoria['IdBolsaLaboral'];?>"> 
             <input type="hidden" name="txt_id2" id="txt_id2" value="<?php echo $fila_estudiante['IdEstudiante'];?>"> 
                 <div class="row">
                   <div class="col-sm-12">
                     <h4 class="f-14 f-w-600 f-s-italic b-b-default pb-2">1. Oferta Laboral seleccionado:</h4>
                     <div class="p-2 mb-3 bg-success-light rounded">
                       <p class="mb-1"><?php echo $fila_ver_convocatoria['Titulo'];?> </p>
                     </div>
                   </div>
                </div>
                <div class="row">
                   <div class="col-sm-12">
                        <h4 class="f-14 f-w-600 f-s-italic">Entidad Solicitante:</h4>
                        <div class="p-2 mb-3 bg-success-light rounded">
                          <p class="mb-1"><?php echo $fila_ver_convocatoria['RazonSocial'];?></p>
                        </div>
                   </div>
                </div>
                <div class="row">
                     <div class="col-sm-6">
                      <h4 class="f-14 f-w-600 f-s-italic">Ciudad:</h4>
                      <div class="p-2 mb-3 bg-success-light rounded">
                        <p class="mb-1"><?php echo $fila_ver_convocatoria['Departamento'];?></p>
                      </div>
                     </div>
                     <div class="col-sm-2">
                       <h4 class="f-14 f-w-600 f-s-italic"># Vacantes:</h4>
                       <div class="p-2 mb-3 bg-success-light rounded">
                        <p class="mb-1 text-center"><?php echo $fila_ver_convocatoria['Vacantes'];?></p>
                       </div>
                     </div>
                     <div class="col-sm-2">
                       <h4 class="f-14 f-w-600 f-s-italic">Sueldo S/.</h4>
                        <div class="p-2 mb-3 bg-success-light rounded">
                          <p class="mb-1 text-center"><?php echo $fila_ver_convocatoria['Sueldo'];?></p>
                        </div>
                     </div>
                     <div class="col-sm-2">
                        <?php $fecha_limite = new DateTime($fila_ver_convocatoria['FechaLimite']); ?>
                        <h4 class="f-14 f-w-600 f-s-italic">Fecha L&#237;mite :</h4>
                        <div class="p-2 mb-3 bg-success-light rounded">
                          <p class="mb-1 text-center"><?php echo $fecha_limite->format('d-m-Y');?></p>
                        </div>
                    </div>
                </div>
                <div class="row">
                  <div class="col-sm-12 m-t-10">
                   <h4 class="f-14 f-w-600 f-s-italic b-b-default pb-2">2. Datos Personales del Postulante :</h4>
                  </div>
                </div>
                <div class="row">
                   <div class="col-sm-2">
                        <h4 class="f-14 f-w-600 f-s-italic">D.N.I.:</h4>
                        <div class="p-2 mb-3 bg-success-light rounded">
                          <p class="mb-1"><?php echo $fila_estudiante['Dni'];?></p>
                       </div>
                   </div>
                   <div class="col-sm-5">
                      <h4 class="f-14 f-w-600 f-s-italic">Apellidos:</h4>
                       <div class="p-2 mb-3 bg-success-light rounded">
                         <p class="mb-1"><?php echo $fila_estudiante['Apellidos'];?></p>
                       </div> 
                   </div>
                   <div class="col-sm-5">
                       <h4 class="f-14 f-w-600 f-s-italic">Nombres:</h4>
                       <div class="p-2 mb-3 bg-success-light rounded">
                         <p class="mb-1"><?php echo $fila_estudiante['Nombres'];?></p>
                       </div>  
                   </div>
                </div>
                <div class="row">
                   <div class="col-sm-7">
                     <h4 class="f-14 f-w-600 f-s-italic">Email:</h4>
                       <div class="p-2 mb-3 bg-success-light rounded">
                         <p class="mb-1"><?php echo $fila_estudiante['Email'];?></p>
                       </div>
                   </div>
                   <div class="col-sm-2">
                     <h4 class="f-14 f-w-600 f-s-italic">Celular:</h4>
                       <div class="p-2 mb-3 bg-success-light rounded">
                         <p class="mb-1"><?php echo $fila_estudiante['NumCelular'];?></p>
                       </div>
                   </div>
                   <div class="col-sm-3">
                     <h4 class="f-14 f-w-600 f-s-italic">Curriculum Vitae:</h4>
                       <div class="p-2 mb-3 bg-success-light rounded">
                         <?php
                            if ($fila_estudiante['UrlCv'] == "scv.pdf")
                             {
                               $disabled="disabled";
                               echo '<p class="mb-1 text-danger">No tiene CV</p>'; 
                             }
                          else
                          {
                            $disabled="";
                             echo '<a href="Cv/'.$fila_estudiante['UrlCv'].'" target="_blank">
                                   Ver Documento
                                   </a>';
                          }
                          ?>
                       </div>
                   </div>
                </div>
                <div class="row">
                 <div class="col-sm-7">
                     <h4 class="f-14 f-w-600 f-s-italic">Domicilio:</h4>
                       <div class="p-2 mb-3 bg-success-light rounded">
                         <p class="mb-1"><?php echo $fila_estudiante['Domicilio'];?></p>
                       </div>
                   </div>
                   <div class="col-sm-5">
                     
                   </div>
                </div>
                <div class="row">
                   <div class="col-sm-12 text-center b-t-default pt-2">
                      <input type="submit" class="btn btn-primary" id="bt_postulacion" <?php echo $disabled; ?> name="bt_postulacion" value="Enviar Postulacion">
                      <a href="ofertasLaborales.php" class="btn btn-secondary"><i class="fa fa-mail-reply"></i>Volver</a> 
                   </div>
                </div>
                <div class="row">
                  <div class="col-sm-12">
                        <?php modal_ok(); modal_error();modal_verificar_postulacion();?>
                  </div>
                </div>
              </form>
            </div>
	    </div>
</div>
</div>
</div>
</div>
</div>

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

<script src="bower_components/jquery/js/jquery.min.js"></script>
<script src="bower_components/jquery-ui/js/jquery-ui.min.js"></script>
<script src="bower_components/popper/js/popper.min.js"></script>
<script src="bower_components/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/pages/waves/js/waves.min.js"></script>

<script src="assets/js/pcoded.min.js"></script>
<script src="assets/js/vertical/vertical-layout.min.js"></script>
<script src="assets/js/script.min.js"></script>
<script src="js/ajax.js"></script>
<script type="text/javascript">
  

</script>
</body>
</html>
<?php
}
else
{ 
header("Location: index.php");
}
?>
