<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
	<!DOCTYPE html>
	<html lang="pt">
	<head>
<?php $this->load->view('includes/header',isset($data) ? $data : NULL);?>		

	</head>
	<body>
<?php $this->load->view('includes/top',isset($data) ? $data : NULL);?>	

<div class="xs-spacer30 sm-spacer30">
</div>





<div class="article">



<div class="container">
<div class="sm-spacer150">
</div>
<div class="row">
<div class="col-md-12 sm-tacenter">
<h1 class="slice">
<span>Rezervasyon</span>
</h1>
</div>
</div>
<div class="sm-spacer60">
</div>

<?php 
//print_r($grup_detay);
$grupum_id=$grup_detay->group_id;
$kategori_id=$grup_detay->site_id;
$kullanilan=genel::kullanilan_kontenjanlar($grupum_id,$kategori_id);
//print_r($kullanilan);

$site=genel::site_bilgi();
$kullanilan_kon=isset($kullanilan->total) ? (int) $kullanilan->total : 0;
 $kalan_kontenjan=$grup_detay->quota-$kullanilan_kon;

$kalan_kontenjan=isset($kalan_kontenjan) ? (int) $kalan_kontenjan : 0;
// $kalan_kontenjan;
  ?>
<style>
.blink_me {
  animation: blinker 1s linear infinite;
}

@keyframes blinker {  
  50% { opacity: 0; }
}
</style>
  <!--
<div class="alert alert-danger blink_me">
  <?php if($kalan_kontenjan<1){?>
  <strong>Dikkat!</strong> İlginize teşekkür ederiz. Katılımcı sayımız kontenjan sınırına ulaştığı için yeni kayıt alamamaktayız.</b>
  <?php }else{?>

  <strong>Dikkat!</strong> Kalan kontenjan: <b><?=@$kalan_kontenjan?> Kişi</b>

<?php }?>
</div>
  -->


<?php 
//print_r($grup_detay);
?>



<div class="panel panel-success">
<div class="panel-heading" style="background-color: #e31d1a;color: #fff;font-weight: bold;">
<?=Genel::dil_ceviri("booking_page_reservation")?>
</div>
<div class="panel-body">
<?php 
$paketler=genel::paketler($grup_id);

?>
<form id="oteldetayfiyathesapla" method="GET" action="/reservation/search"> 
  <input type="hidden" name="paket_id" value="<?=$grup_id?>">
<div class="row">
<div class="col-md-10">
<div class="row">
<div class="col-md-5">
<select class="form-control" name="fiyat_id" required="">
<option value="">Paket Seçiniz</option>
<?php foreach ($paketler as $paketler) {?>
<option value="<?=$paketler->price_id?>"><?=date("d-m-Y",strtotime($paketler->checkin_date))?> Girişli - <?=$paketler->night?> Gece</option>
<?php }?>
</select>
</div>

<div class="col-md-7">


<div class="row">
<div class="col-md-4"><div class="form-group">
<select class="form-control" name="adult" required="">
  <option value="">Seçiniz</option>
<?php if($kalan_kontenjan>=1){?><option value="1">1 <?=Genel::dil_ceviri("booking_page_adult")?></option><?php }?>
<?php if($kalan_kontenjan>=2){?><option value="2" selected="">2 <?=Genel::dil_ceviri("booking_page_adult")?></option><?php }?>
<?php if($kalan_kontenjan>=3){?><option value="3">3 <?=Genel::dil_ceviri("booking_page_adult")?></option><?php }?>

</select></div></div>
<?php if(config_item('cocuklari_goster')==1){?>
<div class="col-md-4"><div class="form-group"><select class="form-control" name="child1age">
<option value="0"><?=Genel::dil_ceviri("booking_page_no_child")?></option>
<?php for ($i=1; $i <13 ; $i++) { ?>
<option value="<?=$i?>"><?=$i?> <?=Genel::dil_ceviri("booking_page_years_old")?></option>
<?php }?>

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

<div class="col-md-4"><div class="form-group"><select class="form-control" name="child2age">
<option value="0"><?=Genel::dil_ceviri("booking_page_no_child")?></option>
<?php for ($i=1; $i <13 ; $i++) { ?>
<option value="<?=$i?>"><?=$i?> <?=Genel::dil_ceviri("booking_page_years_old")?></option>
<?php }?>

</select></div></div>
<?php }else{?>

<input type="hidden" name="child1age" value="0">
<input type="hidden" name="child2age" value="0">

<?php }?>


</div>


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

<div class="col-md-2">
  
<button type="submit" class="btn btn-primary"><?=Genel::dil_ceviri("booking_page_search_book")?></button> 
</div>

</div>  

</form>

<div id="search-result"></div>



</div>

</div>


</div>

</div>

	<?php $this->load->view('includes/footer',isset($data) ? $data : NULL);?>	

<script>
   var loading_text="<div style='text-align:center; background-color: rgb(0, 0, 0); opacity: 0.6; cursor: wait;color: rgb(255, 255, 255);font-size: 12px; min-height:200px'><div style='padding-top:50px;font-size:25px'><i style='font-size:40px' class='fa fa-spin fa-spinner'></i><br>Please Wait</div></div>";

  $(document).ready(function(){


$('#oteldetayfiyathesapla').on('submit',(function() {
  //  alert("sdf");
    var formUrl = $('#oteldetayfiyathesapla').attr("action");
    var formData = $('#oteldetayfiyathesapla').serialize();

  
    

$("#search-result").html(loading_text)
    $.ajax({
        type:'GET',
        url: formUrl,
        data:formData,
        success: function(data) 
        {
          //  alert(data);
$("#search-result").html(data);
          /*var data = $.parseJSON(data);
                alert(data.message);
            var result = "";
         */

           

        },
        error: function (data) {
            alert("Bir hata oluÃ…Å¸tu,\n LÃƒÂ¼tfen diÃ„Å¸er iletiÃ…Å¸im kanallarÃ„Â±nÃ„Â± deneyiniz");
            $('#submit_call').val("GÖNDER");
        }
    });
    return false;
}));

})
</script>

	</body>
	</html>