<?php
  session_start();
  if(!(isset($_SESSION["k_name"]))){
        header("location:index.php");
        }
        else{  
 include("includes/conect.php");
 include("includes/timezone.php");

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


<head>
<?php include('head.php'); ?>
</head>

<body>
  <div class="loader"></div>
  <div id="app">
    <div class="main-wrapper main-wrapper-1">
      <div class="navbar-bg"></div>
      
      <?php include('navbar.php')?>

      <?php include('sidebar.php')?>
      <!-- Main Content -->

          <div class="main-content">
            <section class="section">


               

          <div class="d-sm-flex align-items-center justify-content-between mb-4">
            <h1 class="h6 mb-0 text-gray-800">
              <?php
                echo strftime("%d de %B del %Y");
              ?>

              <a href='my_booking.php'  style='text-decoration:none' class='btn btn-primary m-t-15 waves-effect'><i class='fas fa-reply'></i> Regresar</a>
            </h1>            
          </div>

                    <div class="row">
            <div class="col-12">
              <div class="card">
                <div class="card-header">
                  <h4>Reservación con Núcleo familiar | Codigo de Reservación: <?php echo $_GET['cod']; ?></h4> 
                </div>
                <div class="card-body p-0">

                  <div class="table-responsive">
                    <table class="table table-striped">
                      <tr> 
                        <th>#</th>
                        <th>Apartamento</th>
                        <th>Nombres</th>
                        <th>Área</th>
                        <th>Reservación</th>
                        <th>Jornada</th>   
                      </tr>

                      <?php

                      $id_ocupante = $_SESSION['k_id'];

                      $contador = 1;

                        $result = mysqli_query($conexion, 'SELECT * FROM ocupante_reserva inner join area on ocupante_reserva.idarea = area.id inner join usuario_area on ocupante_reserva.id_ocupante = usuario_area.idocupante where ocupante_reserva.cod_reservacion =\''.$_GET['cod'].'\' order by ocupante_reserva.fecha_in asc');
                        while($row = mysqli_fetch_array($result)){        

                          if($row['nucleo'] == 'SI'){                           
                            $ver_nucleo = "<button type='button' value='".$row['cod_reservacion']."' class='btn btn-info m-t-15 waves-effect'><i class='fas fa-eye'></i> Ver familiares</button>";
                          }else{
                            $ver_nucleo = 'NO';
                          }
 
 
                          
                          if($row['jornada'] == 1){
                              $jornada = "Jornada 1 | de 9 Am a 1 Pm";
                          }else{
                              $jornada = "Jornada 2 | de 1:30 Pm a 5:30 Pm";
                          } 

                          echo "
                            <tr>
                              <td class='p-0 text-center'>".$contador++."</td>
                              <td>".$row['apto_from']."</td>
                              <td>".$row['nombres']." ".$row['apellidos']."</td>
                              <td >".$row['nombre']."</td>
                              <td >".$row['fecha_in']." | ".$row['hora_in']."</td>
                              <td >$jornada</td> 
                            
                            </tr>
                          ";
 
                        } 

                      ?>

                      
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div> 
        </section>

        
      </div>

      <?php include('footer.php'); ?>

    </div>
  </div>
  <!-- General JS Scripts -->
  <script src="assets/js/app.min.js"></script>
  <!-- JS Libraies -->
  <script src="assets/bundles/apexcharts/apexcharts.min.js"></script>
  <!-- Page Specific JS File -->
  <script src="assets/js/page/index.js"></script>
  <!-- Template JS File -->
  <script src="assets/js/scripts.js"></script>
  <!-- Custom JS File -->
  <script src="assets/js/custom.js"></script>
</body>



</html>
<?php
  }
?>