 <?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="col-xl-12 col-lg-12 col-md-12">
                <?php
                if (isset($_GET['full'])) {
                ?>

                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        <strong>No disponible!</strong> Capacidad llena para esta Área.
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>

                <?php
                }
 


                if (isset($_GET['succ'])) {
                ?>

                    <div class="alert alert-success alert-dismissible fade show" role="alert">
                        <strong>Cambios realizados</strong>
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>

                <?php
                } 


                if (isset($_GET['error'])) {
                ?>

                    <div class="alert alert-danger alert-dismissible fade show" role="alert">
                        <strong>Accion no ralizada!</strong> acción no realizada.
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>

                <?php
                } 


                ?>
            </div>

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

           <!-- <div class="row">
            <div class="col-12">
              <div class="card">
                <div class="card-header">
                  <h4>Reservaciones</h4> 
                </div>
                <div class="card-body p-0">

                  <div class="table-responsive">
                    <table class="table table-striped" align="center" >
                      <tr> 
                        <th>#</th>
                        <th>Nombres</th>
                        <th>Apellidos</th>
                        <th>Código Ingreso</th>
                        <th>Correo</th>
                        <th>Tipo Usuario</th>
                        <th>Acceso</th>
                        <th>Fecha de Registro</th> 
                        <th>Estado</th>                        
                        <th>Acciones</th>
                      </tr>

                      <?php

                      $id_ocupante = $_SESSION['k_id_table'];

                      $contador = 1;


                           $acceso_array = array(
                                            '0' => 'Huéspedes',
                                            '1' => 'Admin',
                                            '2' => 'Gimnasio',
                                            '3' => 'Piscina 1',
                                            '4' => 'Piscina Sup',
                                            '5' => 'Salon Social',
                                            '6' => 'Acceso General'
                                             ); 

                           $tipo_array = array(
                                            '1' => 'Huéspedes',
                                            '2' => 'Admin'
                                             ); 

                           $estado_array = array(
                                            '1' => 'Activo',
                                            '0' => 'Inactivo'
                                             ); 



                        $result = mysqli_query($conexion, 'SELECT * FROM usuario');
                        while($row = mysqli_fetch_array($result)){  

  

                          echo "

                            <tr>
                            <form method='post' action='validation/up_user.php'>
                              <td class='p-0 text-center'>".$contador++."</td> 
                              <td><input type='text' value='".$row['nombres']."' name='nombres'></td> 
                              <td><input type='text' value='".$row['apellidos']."' name='apellidos'></td> 
                              <td><input type='text' value='".$row['code_reserva']."' name='code_reserva'></td> 
                              <td>".$row['email']."</td>  

                              <td>
                                 <select class='custom-select' name='tipo' style='width:175px'> "; 
                                  foreach ($tipo_array as $key_tipo => $value_tipo) {
                                    $selected_tipo = ($row['tipo'] == $key_tipo) ? 'selected' : '' ; 
                                    echo "<option value='".$key_tipo."' $selected_tipo>".$value_tipo."</option>";
                                  } 
                                echo "</select>
                              </td>

                              <td>
                                <select class='custom-select' name='access' style='width:175px'> "; 
                                  foreach ($acceso_array as $key => $value) {
                                      $selected = ($row['access'] == $key) ? 'selected' : '' ; 
                                      echo "<option value='".$key."' $selected>".$value."</option>";
                                    } 
                                echo "</select>
                              </td> 


                              <td>".$row['fecha_reg']."</td> 

                              <td>
                                 <select class='custom-select' name='estado' style='width:125px'> "; 
                                  foreach ($estado_array as $key_estado => $value_estado) {
                                    $selected_estado = ($row['estado'] == $key_estado) ? 'selected' : '' ; 
                                    echo "<option value='".$key_estado."' $selected_estado>".$value_estado."</option>";
                                  } 
                                echo "</select>
                              </td> 

                              <td>
                                <button type='sumbit' name='btnactivate' value='".$row['id_table_ocup']."' class='btn btn-outline-success btn-sm'>
                                    Actualizar
                                </button>
                              </td> 
                              </form>
                            </tr>
                          ";


                        }

                      ?>

                      
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div> -->


          <div class="row">
            <div class="col-md-6 col-lg-12 col-xl-6">
              <!-- Support tickets -->
              <div class="card">
                <div class="card-header">
                  <h4>Support Ticket</h4>
                  <form class="card-header-form">
                    <input type="text" name="search" class="form-control" placeholder="Search">
                  </form>
                </div>
                <div class="card-body">
                  <div class="support-ticket media pb-1 mb-3">
                    <img src="assets/img/users/user-1.png" class="user-img mr-2" alt="">
                    <div class="media-body ml-3">
                      <div class="badge badge-pill badge-success mb-1 float-right">Feature</div>
                      <span class="font-weight-bold">#89754</span>
                      <a href="javascript:void(0)">Please add advance table</a>
                      <p class="my-1">Hi, can you please add new table for advan...</p>
                      <small class="text-muted">Created by <span class="font-weight-bold font-13">John
                          Deo</span>
                        &nbsp;&nbsp; - 1 day ago</small>
                    </div>
                  </div>
                  <div class="support-ticket media pb-1 mb-3">
                    <img src="assets/img/users/user-2.png" class="user-img mr-2" alt="">
                    <div class="media-body ml-3">
                      <div class="badge badge-pill badge-warning mb-1 float-right">Bug</div>
                      <span class="font-weight-bold">#57854</span>
                      <a href="javascript:void(0)">Select item not working</a>
                      <p class="my-1">please check select item in advance form not work...</p>
                      <small class="text-muted">Created by <span class="font-weight-bold font-13">Sarah
                          Smith</span>
                        &nbsp;&nbsp; - 2 day ago</small>
                    </div>
                  </div>
                  <div class="support-ticket media pb-1 mb-3">
                    <img src="assets/img/users/user-3.png" class="user-img mr-2" alt="">
                    <div class="media-body ml-3">
                      <div class="badge badge-pill badge-primary mb-1 float-right">Query</div>
                      <span class="font-weight-bold">#85784</span>
                      <a href="javascript:void(0)">Are you provide template in Angular?</a>
                      <p class="my-1">can you provide template in latest angular 8.</p>
                      <small class="text-muted">Created by <span class="font-weight-bold font-13">Ashton Cox</span>
                        &nbsp;&nbsp; -2 day ago</small>
                    </div>
                  </div>
                  <div class="support-ticket media pb-1 mb-3">
                    <img src="assets/img/users/user-6.png" class="user-img mr-2" alt="">
                    <div class="media-body ml-3">
                      <div class="badge badge-pill badge-info mb-1 float-right">Enhancement</div>
                      <span class="font-weight-bold">#25874</span>
                      <a href="javascript:void(0)">About template page load speed</a>
                      <p class="my-1">Hi, John, can you work on increase page speed of template...</p>
                      <small class="text-muted">Created by <span class="font-weight-bold font-13">Hasan
                          Basri</span>
                        &nbsp;&nbsp; -3 day ago</small>
                    </div>
                  </div>
                </div>
                <a href="javascript:void(0)" class="card-footer card-link text-center small ">View
                  All</a>
              </div>
              <!-- Support tickets -->
            </div>
            <div class="col-md-6 col-lg-12 col-xl-6">
              <div class="card">
                <div class="card-header">
                  <h4>Projects Payments</h4>
                </div>
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table table-hover mb-0">
                      <thead>
                        <tr>
                          <th>#</th>
                          <th>Client Name</th>
                          <th>Date</th>
                          <th>Payment Method</th>
                          <th>Amount</th>
                        </tr>
                      </thead>
                      <tbody>
                        <tr>
                          <td>1</td>
                          <td>John Doe </td>
                          <td>11-08-2018</td>
                          <td>NEFT</td>
                          <td>$258</td>
                        </tr>
                        <tr>
                          <td>2</td>
                          <td>Cara Stevens
                          </td>
                          <td>15-07-2018</td>
                          <td>PayPal</td>
                          <td>$125</td>
                        </tr>
                        <tr>
                          <td>3</td>
                          <td>
                            Airi Satou
                          </td>
                          <td>25-08-2018</td>
                          <td>RTGS</td>
                          <td>$287</td>
                        </tr>
                        <tr>
                          <td>4</td>
                          <td>
                            Angelica Ramos
                          </td>
                          <td>01-05-2018</td>
                          <td>CASH</td>
                          <td>$170</td>
                        </tr>
                        <tr>
                          <td>5</td>
                          <td>
                            Ashton Cox
                          </td>
                          <td>18-04-2018</td>
                          <td>NEFT</td>
                          <td>$970</td>
                        </tr>
                        <tr>
                          <td>6</td>
                          <td>
                            John Deo
                          </td>
                          <td>22-11-2018</td>
                          <td>PayPal</td>
                          <td>$854</td>
                        </tr>
                        <tr>
                          <td>7</td>
                          <td>
                            Hasan Basri
                          </td>
                          <td>07-09-2018</td>
                          <td>Cash</td>
                          <td>$128</td>
                        </tr>
                      </tbody>
                    </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
  }
?>
