<?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">
<link rel="stylesheet" href="assets/css/jquery.dataTables.min.css">
<?php
include("script_funciones.php");
include('db___cn.php');
$mysqli=conex_db_mysql();

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

$listar_postulaciones="SELECT IdPostulacion,Titulo,FechaPostulacion,CondicionPostulacion 
                        FROM  tb_bolsa_laboral_postulaciones,tb_bolsa_laboral
                         WHERE tb_bolsa_laboral_postulaciones.IdBolsaLaboral=tb_bolsa_laboral.IdBolsaLaboral
                         and IdEstudiante=".$fila_estudiante['IdEstudiante'];
 $rs_mis_postulaciones=$mysqli->query($listar_postulaciones);
 
 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>
				<li class="breadcrumb-item">
				   <a href="#">Mis Postulaciones</a>
				</li>
				</ul>
			</div>
		</div>
      </div>
  </div>
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-wrapper">
	  <div class="card">
			<div class="card-header bg-primary">
			    <h5>Mis Postulaciones</h5>
			</div>
			<div class="card-block">
				  <div class="table-responsive">
					<table id="tb_mis_postulaciones" class="display" style="width:100%">
						<thead class="table-info">
							<tr>
							<th>N&#176;</th>
							<th>T&#237;tulo Convocatoria</th>
							<th>Fecha Postulaci&#243;n</th>
							<th>Condici&#243;n Evaluaci&#243;n</th>
							<th>Resultado</th>
							</tr>
						</thead>
						<tbody>
							<?php
							 $contador=1;
			                while($fila_mi_postulacion=mysqli_fetch_array($rs_mis_postulaciones))
			                {
			                	$fecha_mi_postulacion = new DateTime($fila_mi_postulacion['FechaPostulacion']);
								 echo'<tr>';
					                  echo'<td>'.$contador.'</td>';
					                  echo'<td>'.$fila_mi_postulacion['Titulo'].'</td>';
					                  echo'<td>'.$fecha_mi_postulacion->format('d-m-Y').'</td>';
					                  echo'<td>'.$fila_mi_postulacion['CondicionPostulacion'].'</td>';
					                  echo'<td>
		                                   <a href="verResultadoPostulacion.php?id='.base64_encode($fila_mi_postulacion['IdPostulacion']).'" class="btn btn-outline-primary">Ver</a>   
					                      </td>';
					             echo'</tr>';
				                $contador++;
							}
							?>
						</tbody>
					</table>
				  </div>
		    </div>
		    <div class="card-footer">    
             </div>
	    </div>
</div>
</div>
</div>
</div>

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

<script src="bower_components/jquery/js/jquery.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="bower_components/jquery-slimscroll/js/jquery.slimscroll.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/jquery.dataTables.min.js"></script>
<script type="text/javascript">
	new DataTable('#tb_mis_postulaciones', {
    info: false,
    ordering: false,
    paging: true,
    responsive: true,language: {
                    "url": "//cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json",
                    "paginate": {
                        "previous": "<<",
                        "next": ">>",
                        "first": "<",
                        "last": ">"
                    },
                },
});
</script>

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