    <!-- ======= Breadcrumbs ======= -->
    <section id="breadcrumbs" class="breadcrumbs">
      <div class="container">
        <div class="d-flex justify-content-between align-items-center">
          <h2><?php echo ucfirst($headeractive);?></h2>
          <ol>
            <li><a href="<?php echo base_url();?>">Home</a></li>
            <li><?php echo ucfirst($headeractive);?></li>
          </ol>
        </div>
      </div>
    </section><!-- End Breadcrumbs -->
	<style>.penting{ color:red;}</style>
<div class="container">
<?php if(!empty($pesan)){ ?>
<div class="alert alert-<?php echo $alert;?>" role="alert" style="text-align:center;"><strong><?php echo validation_errors(); echo $pesan ;?></strong></div>
<?php }?>
 <section id="contact" class="contact" style="margin-top:-3%">
		<div class="row">	  
		<div class="col-lg-12">
        <div class="alert alert-success">
            <strong>Petunjuk Pemesanan:</strong><br>
            <ol align="justify" style="font-size:14px">
                <li>Silakan isi identitas Anda dengan benar termasuk KTP (Kartu Tanda Penduduk), karena akan digunakan pada saat verifikasi.</li>
                <li>Setelah berhasil melakukan pemesanan, Anda bisa melihat jadwal pemesanan Anda di menu 'Jadwal pemesanan'.</li>
                <li>Setelah berhasil melakukan pemesanan, lakukan <strong>verifikasi paling lambat 3 hari setelah pemesanan</strong>, dengan cara datang langsung pada jam kerja ke <strong>Ruang Layanan Informasi</strong> BPSDMD Provinsi Jawa Tengah dan menunjukkan <strong>KTP beserta bukti cetak pemesanan online</strong>.</li>
                <li>Jika dalam waktu 3 hari Anda belum melakukan verifikasi, data pemesanan Anda akan dihapus.</li>
                <li>Penggunaan Gedung Sasana Widya Praja untuk acara Resepsi Pernikahan hanya bisa digunakan pada hari Jumat Malam, Sabtu, Minggu dan hari libur nasional.</li>
                <li>Apabila terjadi pembatalan segera hubungi petugas.</li>
            </ol>
        </div>	
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h3 class="panel-title" style="text-align: center"><strong>Formulir Pemesanan</strong></h3>
				</div>
                <div class="panel-body">
				<div class="col-xs-12 "  >
					<p class="bg-success" style="color: #fff;background-color: #28a745;text-align:center;font-size:14px;height:25px;">Cek Jadwal</p>
				</div>
			<?php 	
			echo $waktu;
			$attribute = array('role' => 'form', 'method' => 'post');
			echo form_open(base_url().'pesan/pesan', $attribute); 
			?>					
				 <div class="row">			 
				 <div class="col-sm-6">
                    <div class="form-group">	
						<div class="row">
							<div class="col-sm-12">
								<strong>Gedung yang dipesan</strong><br>
								<input type="text" class="form-control"  name="gedung" value="Gedung Diklat Pemerintahan Kota Madiun" disabled>
							</div>
						</div>					
                        <div class="row">
                            <div class="col-sm-6">
                                <strong>Tanggal mulai<font class="penting">*</font></strong><br>
                                 <input type="date" min="<?php echo date('m-d-Y');?>" value="<?php if(set_value('tglpakai')!=''){ echo set_value('tglpakai') ;}?>" name="tglpakai"  class="form-control">
                            </div>
                            <div class="col-sm-6">
                                <strong>Tanggal selesai<font class="penting">*</font></strong><br>
                                 <input type="date" min="<?php echo date('m-d-Y');?>"  name="tglselesai"  value="<?php if(set_value('tglselesai')!=''){ echo set_value('tglselesai') ;}?>" class="form-control">
                            </div>						
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
								<p class="help" style="font-size:12px; font-style: italic;margin-bottom:2%"><b>* Jika hanya 1 hari acara, maka tanggal mulai dan selesai sama</b></p>	
                            </div>
                        </div>	
					</div>					
				</div>
				 <div class="col-sm-6">
                    <div class="form-group">
                       <div class="row">
                            <div class="col-sm-6">
                                <strong>Jam <font class="penting">*</font></strong><br>
								<select class="form-control"  name="jam"    class="form-control" required>
								<option value="" >Pilih Jam</option>
								<?php for($i =1; $i<=23;$i++){?>
								<option  value="<?php echo $i;?>" <?php if(set_value('jam')==$i ){ echo 'selected';}?>><?php echo $i;?></option>
								<?php }?>
								</select>
                            </div>
                            <div class="col-sm-6">
                                <strong>Menit <font class="penting">*</font></strong><br>
								<select class="form-control"  name="menit"    class="form-control" required>
								<option value="" >Pilih Menit</option>
								<?php for($i =1; $i<=60;$i++){?>
								<option  value="<?php echo $i;?>" <?php if(set_value('menit')==$i ){ echo 'selected';}?>><?php echo $i;?></option>
								<?php }?>
								</select>
                            </div>							
                        </div>	
                       <div class="row">
                            <div class="col-sm-12">
									<button type="submit" class="btn btn-sm btn-block btn-primary" name="cekjadwal" value="cekjadwal" style="margin-top:5%">Cek Jadwal</button>     							                                
                            </div>
                        </div>							
					</div>					
				</div>
            <!--</center>-->
			</div>
			 <?php echo form_close();?>	
			<?php 	
			$waktu;
			if($detail=='ada'){
			$attribute = array('role' => 'form', 'method' => 'post');
			echo form_open(base_url().'pesan/pesan', $attribute); 
			?>			 
				<div class="col-xs-12 "  >
					<p class="bg-success" style="color: #fff;background-color: #28a745;text-align:center;font-size:14px;height:25px;">Data Pemesanan</p>
				</div>					
				 <div class="row">			 
				 <div class="col-sm-6">
                    <div class="form-group">
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>No. KTP <small>(Kartu Tanda Penduduk)</small> <font class="penting">*</font></strong><br>
                                <input  type="text" class="form-control" name="ktp" placeholder="Nomor KTP" value="<?php  echo set_value('ktp'); ?>" required>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>Nama pemesan <font class="penting">*</font></strong>
                                <input type="text" class="form-control" name="namapesan"  placeholder="Nama pemesan" value="<?php  echo set_value('namapesan'); ?>"  required>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>No. telepon pemesan <font class="penting">*</font></strong><br>
                                <input type="text" class="form-control" name="hppesan"  placeholder="Nomor telepon pemesan"  value="<?php  echo set_value('hppesan'); ?>"   required>
                            </div>
                        </div>	
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>Email</strong><br>
                                <input type="email" class="form-control" name="emailpemesan"  placeholder="Email Pemesan"  value="<?php  echo set_value('emailpemesan'); ?>"   >
                            </div>
                        </div>	
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>Nama pemakai <font class="penting">*</font></strong><br>
                                <input type="text" class="form-control" name="namapemakai"  placeholder="Nama pemakai"  value="<?php  echo set_value('namapemakai'); ?>"   required>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>No. telepon pemakai	<font class="penting">*</font></strong><br>
                                <input type="text" class="form-control" name="hppakai"  placeholder="Nomor telepon pemakai"  value="<?php  echo set_value('hppakai'); ?>"   required>
                            </div>
                        </div>						
					</div>					
				</div>
				 <div class="col-sm-6">
                    <div class="form-group">													
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>Alamat <font class="penting">*</font></strong><br>
                                <textarea type="text" class="form-control" name="alamat"  placeholder="Alamat" required style="height: 100px;"><?php  echo set_value('alamat'); ?></textarea>
                            </div>
                        </div>						
                       <div class="row">
                            <div class="col-sm-12">
                                <strong>Pilih Waktu <font class="penting">*</font></strong><br>
								<select class="form-control"  name="waktu" onchange="myFunction()" id="mySelect"   class="form-control" >
								<option selected="selected" value="" >Pilih Waktu</option>
								<option  value="0" <?php  if(set_value('waktu')=='0'){ echo 'selected' ;}?>>Siang</option>
								<option  value="1" <?php  if(set_value('waktu')=='1'){ echo 'selected' ;}?>>Malam</option>
								</select>					                                
                            </div>
                        </div>						
                        <div class="row">
                            <div class="col-sm-12">
                                <strong>Fasilitas </strong><br>
								 <!-- Button trigger modal -->
								<p id="demo"></p>
                            </div>
                        </div>	
                        <div class="row">
                            <div class="col-sm-12" style="margin-top:2%;">
                                <strong>Keperluan <font class="penting">*</font></strong><br>
                                <textarea type="text" class="form-control" name="keperluan"  placeholder="Keperluan" required style="height: 80px;" > <?php  echo set_value('keperluan'); ?> </textarea>
                            </div>
                        </div>						
					</div>					
				</div>				
				</div>
				<!--</bagian kedua>-->						
            </div>
            <!--</center>-->
			<button type="submit" class="btn btn-sm btn-block btn-primary" name="button" value="button">Pesan Sekarang</button>        
		<?php }?>			
          </div>
      </div>
	  </div>
    </section><!-- End Contact Section -->
</div>
<!-- Siang -->
<div class="modal fade bd-example-modal-lg" id="exampleModal" tabindex="-1" role="dialog"aria-labelledby="exampleModalLongTitle" aria-hidden="true" style="margin-top:-2%">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Fasilitas Siang / Hari</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
		<table class="table table-striped table-hover">
		  <thead>
			<tr>
			  <th scope="col" style="width:40%">Fasilitas</th>
			  <th scope="col" style="width:30%">Harga / Jml Maksimal</th>
			  <th scope="col" style="width:30%">Jumlah</th>
			  <th scope="col" style="text-align:center" style="width:20%">Pilih</th>
			</tr>
		  </thead>
		  <tbody>
		  <?php $no=0; foreach($fasilitas->result() as $row){ $no++;?>
			<tr>
			  <td> <?php echo cetak($row->namafasilitas);?></td>
			  <td style="text-align:left">Rp <?php echo cetak(number_format($row->harga)).'/'.$row->batasmax;?></td>
			  <td style="text-align:center"><input type="number"  name="jumlah"  onkeyup="if(this.value > <?php echo $row->batasmax; ?>) this.value = null;"  class="form-control" value="<?php if($row->batasmax <=1) {  echo '1' ;}?>" <?php if($row->batasmax <=1) {  echo 'readonly' ;}?>></td>	
			  <td style="text-align:center"> 		  
			  <input type="checkbox" class="pilihsatu" name="pilihfasilitas[]"  value="<?php echo cetak($row->harga.'-'.$row->idfasilitas);?>">
			  </td>	
			</tr>
		  <?php }?>
		  <?php $no=0; foreach($fasilitas2->result() as $row2){ $no++;?>
			<tr>
			  <td><?php echo cetak($row2->namafasilitas);?></td>
			  <td style="text-align:left">Rp <?php echo cetak(number_format($row2->harga)).'/'.$row2->batasmax;?></td>
			  <td style="text-align:center">
			  <input type="number"    id="nilai1" name="jumlah_pil1" class="form-control " value="1" <?php if($row2->batasmax <=1) {  echo 'readonly' ;}?>  onkeyup="if(this.value > <?php echo $row2->batasmax; ?>) this.value = null;" ></td>	
			  <td style="text-align:center">			 
			  <input type="checkbox" class="pilihdua" name="pilihfasilitas_pil1" value="<?php echo cetak($row->harga.'-'.$row->idfasilitas);?>">
			  </td>	
			</tr>
		  <?php }?>		  		
			<tr>
			<td colspan="1">Grand Total <input type="hidden" id="total" ><input type="hidden" id="total2"><input  type="hidden" id="field3"></td>
			<td colspan="2"><input type="text" id="grandtotal"  class="form-control"  readonly="readonly"></td>
			</tr>				
		  </tbody>
		</table>			
      <div class="modal-footer">
        <button type="button" class="btn btn-primary btn-sm"  data-dismiss="modal">Selesai</button>
      </div>
    </div>
  </div>
</div>
<!-- Malam -->
<!-- Malam -->
<div class="modal fade bd-example-modal-lg" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true" style="margin-top:-2%">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Fasilitas Malam / Hari</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
		<table class="table table-striped table-hover">
		  <thead>
			<tr>
			  <th scope="col" style="width:40%">Fasilitas</th>
			  <th scope="col" style="width:30%">Harga / Jml Maksimal</th>
			  <th scope="col" style="width:30%">Jumlah</th>
			  <th scope="col" style="text-align:center" style="width:20%">Pilih</th>
			</tr>
		  </thead>
		  <tbody>
		  <?php $no=0; foreach($fasilitasmalam->result() as $row){ $no++;?>
			<tr>
			  <td> <?php echo cetak($row->namafasilitas);?></td>
			  <td style="text-align:left">Rp <?php echo cetak(number_format($row->harga)).'/'.$row->batasmax;?></td>
			  <td style="text-align:center"><input type="number"    name="jumlah[]"  onkeyup="if(this.value > <?php echo $row->batasmax; ?>) this.value = null;"  class="form-control" value="<?php if($row->batasmax <=1) {  echo '1' ;}?>" <?php if($row->batasmax <=1) {  echo 'readonly' ;}?>></td>	
			  <td style="text-align:center"> 		  
			  <input type="checkbox" class="pilihsatu_set" name="pilihfasilitas[]" value="<?php echo cetak($row->harga.'-'.$row->idfasilitas);?>">
			  </td>	
			</tr>
		  <?php }?>
		  <?php $no=0; foreach($fasilitasmalam2->result() as $row2){ $no++;?>
			<tr>
			  <td><?php echo cetak($row2->namafasilitas);?></td>
			  <td style="text-align:left">Rp <?php echo cetak(number_format($row2->harga)).'/'.$row2->batasmax;?></td>
			  <td style="text-align:center">
			  <input type="number"    id="nilai1_set"  name="jumlah_pil1" class="form-control " value="1" <?php if($row2->batasmax <=1) {  echo 'readonly' ;}?>  onkeyup="if(this.value > <?php echo $row2->batasmax; ?>) this.value = null;" ></td>	
			  <td style="text-align:center">			 
			  <input type="checkbox" class="pilihdua_set" name="pilihfasilitas_pil1" value="<?php echo cetak($row2->harga.'-'.$row2->idfasilitas);?>">
			  </td>	
			</tr>
		  <?php }?>		  		
			<tr>
			<td colspan="1">Grand Total <input type="hidden" id="total_set" ><input type="hidden" id="total2_set"><input  type="hidden" id="field3_set"></td>
			<td colspan="2"><input type="text" id="grandtotal_set"  class="form-control"  readonly="readonly"></td>
			</tr>				
		  </tbody>
		</table>			
      <div class="modal-footer">
        <button type="button" class="btn btn-primary btn-sm"  data-dismiss="modal">Selesai</button>
      </div>
    </div>
  </div>
</div>

</main><!-- End #main -->
 <!-- Modal -->
<?php echo form_close(); ?>	
<script src="<?php echo base_url().'assets_v1'.'/';?>assets/js/jquery.min.js"></script>
<script>

//Siang
$('input[class="pilihsatu"]').change(function (){
      var total = 0;
      $('input[class="pilihsatu"]:checked').each(function(){
       total += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
      });   
      $("#total").val(total);
	var grandtotalok = (parseInt($("#total").val()  || '0') +parseInt($("#total2").val() || '0')+ parseInt($("#field3").val()  || '0')) -  parseInt($("#total2").val() || '0');
		$("#grandtotal").val('Rp ' + parseFloat(grandtotalok, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());
});
$('input[class="pilihdua"]').change(function (){
	var total = 0;
	$('input[class="pilihdua"]:checked').each(function(){
	total += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val()   );
	});   
	$("#total2").val(total);
	var grandtotalok = (parseInt($("#total").val()  || '0') +parseInt($("#total2").val() || '0')+ parseInt($("#field3").val()  || '0')) -  parseInt($("#total2").val() || '0');
		$("#grandtotal").val('Rp ' + parseFloat(grandtotalok, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());
});
	$("input").on("change", function() {
	var nilai1 = $('#nilai1').val();
	var ret = parseInt($("#nilai1").val() || '0') * parseInt($("#total2").val() || '0');
	$("#field3").val(ret);
	//var kosong = 0;
	var grandtotalok = (parseInt($("#total").val()  || '0') +parseInt($("#total2").val() || '0')+ parseInt($("#field3").val()  || '0')) -  parseInt($("#total2").val() || '0');
		$("#grandtotal").val('Rp ' + parseFloat(grandtotalok, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());
  });
  
  
  
 //malam 
$('input[class="pilihsatu_set"]').change(function (){
      var total = 0;
      $('input[class="pilihsatu_set"]:checked').each(function(){
       total += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
      });   
      $("#total_set").val(total);
	var grandtotalok_set = (parseInt($("#total_set").val()  || '0') +parseInt($("#total2_set").val() || '0')+ parseInt($("#field3_set").val()  || '0')) -  parseInt($("#total2_set").val() || '0');
		$("#grandtotal_set").val('Rp ' + parseFloat(grandtotalok_set, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());
});
$('input[class="pilihdua_set"]').change(function (){
	var total = 0;
	$('input[class="pilihdua_set"]:checked').each(function(){
	total += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val()   );
	});   
	$("#total2_set").val(total);
	var grandtotalok_set = (parseInt($("#total_set").val()  || '0') +parseInt($("#total2_set").val() || '0')+ parseInt($("#field3_set").val()  || '0')) -  parseInt($("#total2_set").val() || '0');
		$("#grandtotal_set").val('Rp ' + parseFloat(grandtotalok_set, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());
});
	$("input").on("change", function() {
	var nilai1_set = $('#nilai1_set').val();
	var ret = parseInt($("#nilai1_set").val() || '0') * parseInt($("#total2_set").val() || '0');
	$("#field3_set").val(ret);
	//var kosong = 0;
	var grandtotalok_set = (parseInt($("#total_set").val()  || '0') +parseInt($("#total2_set").val() || '0')+ parseInt($("#field3_set").val()  || '0')) -  parseInt($("#total2_set").val() || '0');
		$("#grandtotal_set").val('Rp ' + parseFloat(grandtotalok_set, 10).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, "$1,").toString());
  });
</script>
<script>
function myFunction() {
  var isi = "";
  var x = document.getElementById("mySelect").value;
  document.getElementById("demo").innerHTML = x;
  if(x=="0"){
	  isi ='<button type="button" class="btn btn-sm btn-block btn-primary" data-toggle="modal" data-target="#exampleModal" style="margin-bottom:12px;">Klik Fasilitas yang dipesan</button> ';
   }
  if(x=="1"){
	  isi ='<button type="button" class="btn btn-sm btn-block btn-primary" data-toggle="modal" data-target="#exampleModal2" style="margin-bottom:12px;">Klik Fasilitas yang dipesan</button> ';
   }   
  document.getElementById("demo").innerHTML = isi;
}
</script>