<?php 
 

            switch ($_SESSION['k_ocupacion']) {

              // huésped
              case '0': 

                break;

                // operador
              case '4':
                    ?>
                  <a href="#" style="text-decoration: none;" class="whatsapp" data-toggle="modal" data-target="#modal_manilla"><i class="fa fa-barcode"></i> <span class='span_tag' >Consultar</span></a>

                  <?php                    
                break; 
                // admin
              case '5':
                    ?>
                  <a href="#" style="text-decoration: none;" class="whatsapp" data-toggle="modal" data-target="#modal_manilla"><i class="fa fa-barcode"></i> <span class='span_tag' >Consultar</span></a>

                  <?php                    
                break; 
              
              default:
                # code...
                break;
            }
            ?>



<!-- Select2 CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />

<!-- Modal -->
<div class="modal fade" id="modal_manilla" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Consulta de Reservas</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <form method="get" action="make_checkout.php">
      <div class="modal-body">

        <div class="input-group mb-3">
          <div class="input-group-prepend">
            <label class="input-group-text" for="select_search">Buscar por</label>
          </div>
          <select class="custom-select" id="select_search" name="select_search">
              <option value="">seleccione </option>
            <option value="3">Apartamento</option>
            <option value="1"># de Manilla Huésped (Azul)</option>
            <!--<option value="5"># de Manilla Invitado (Blanca)</option>-->
            <option value="6"># de Manilla Propietario (Blanca)</option>
            <option value="4"># de Identificación</option>
            <!-- <option value="2">Nombres y Apellidos</option> -->
            
          </select>
        </div>

          <div class="form-group">
            <label for="exampleInputEmail1">Búsqueda: </label>
            <input type="text" id="input_search" name="input_search" class="form-control" aria-describedby="text_ayuda" placeholder="#manilla" >
                <div id='select_parent'>
                    <select id="apto_input_search" name="input_search" class="form-control input_search" style='width: 100%'></select>
                </div>
          </div>

      </div>
      <div class="modal-footer">
        <button type="submit" class="btn btn-success">Buscar</button>
        <button type="button" class="btn btn-default" style="border: 1px solid gray;" data-dismiss="modal">Salir</button>
      </div>
      </form>

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



<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Select2 -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>


<footer class="main-footer">
  <div class="footer-left">
    Reservación de Zonas Comunes | <div class="bullet"></div> Designed By <a target="_blank" href="https://www.softmanagersolutions.com">Huésped Manager | 2026</a>
  </div>
  <div class="footer-right">
  </div>
</footer>


<script>
  window.addEventListener("DOMContentLoaded", function() {
    $("#modal_manilla").on('shown.bs.modal', function(){
        $("#input_search").focus();  
        
    });


  }, false);//fin Dom
        
        
    // $("#apto_input_search").select2({
    //     enable : true
    // });   
    
    $('#apto_input_search').select2({
        dropdownParent: $('#modal_manilla'),
        placeholder: "Seleccione",
        allowClear: true
    });
    

    
    $.ajax({
      type: "POST",
      url: "select_apto.php",
      success: function(response)
      {
        $('#apto_input_search').html(response).fadeIn();
      }
    });
   
   
         $('#apto_input_search').attr("disabled", true);
 

    // $("#apto_input_search").css("display", "none");
    $("#select_parent").hide();
    
    $("apto_input_search").select2().next().hide();
 
        
    


$(document).ready(function(){ 
$('#select_search').change(function(){ 
  console.log($("#select_search").val())

  if ($("#select_search").val() == 3) {

        $("#input_search").hide();
        $('#input_search').attr("disabled", true);  
        $('#apto_input_search').attr("disabled", false);

         $("#select_parent").show(); 

         $("#apto_input_search").focus(); 


  }else{
      
    if ($("#select_search").val() == 4) {
        
             $("#input_search").attr("placeholder", "Ingrese una identificación");
             $("#input_search").focus();
             $("#input_search").show();
             $('#input_search').attr("disabled", false);
             
        }else{
            
            $("#input_search").attr("placeholder", "#manilla");
            
             $("#input_search").focus();
             $("#input_search").show();
             $('#input_search').attr("disabled", false);
             
        } 
        
         $('#apto_input_search').attr("disabled", true);
             
        
        $("#select_parent").hide(); 
    

  }

});

});//fin Document Ready

  


</script>
  
<!-- JavaScript -->
<script src="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/alertify.min.js"></script>

<!-- CSS -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/alertify.min.css"/>
<!-- Default theme -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/default.min.css"/>
<!-- Semantic UI theme -->
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/semantic.min.css"/> -->
<!-- Bootstrap theme -->
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/bootstrap.min.css"/> -->

<!-- 
    RTL version
-->
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/alertify.rtl.min.css"/> -->
<!-- Default theme -->
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/default.rtl.min.css"/> -->
<!-- Semantic UI theme -->
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/semantic.rtl.min.css"/> -->
<!-- Bootstrap theme -->
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/alertifyjs@1.13.1/build/css/themes/bootstrap.rtl.min.css"/> -->

