<?php
$jenispengadilan=$this->session->userdata('jenis_pengadilan');
?>
<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>resources/css/autocomplete.css">
<div class="centering" style="width:500px;margin-top: 5%;">
    <div id='pihak_pilih' style="border: 1px solid #ffffff;">
          <div class="detil" style="padding: 2px;background-color: white;">
            <div style="font-size:14px;">
                  <form id="frm_add_penahanan" name="frm_add_penahanan" style="background:white;margin:0;" method="post" action="<?php echo base_url().'addPenahanan_c/input_data_bantar';?>">
                        <table id='tableDetilPerkara' style="font-size:14px;">
                              <col width="40%">
                              <col width="65%">
                              <tr>
                                <td colspan="2" style="background:white;border:0px;font-size: 20px;color: #648C03;" align="center">
                                  <?php if ($cek_bantar<0){ echo "TAMBAH";}else{echo "EDIT";};?> - DATA PENAHANAN (BANTAR)
                                </td>
                              </tr>
                              <tr>
                                   <td id="first-child">Tanggal Permohonan</td>
                                   <td>
                                        <input id="tanggal_permohonan" name="tanggal_permohonan" value="<?php echo !empty($tanggal_permohonan)?$this->tanggalhelper->convertToInputDate($tanggal_permohonan):date('d/m/Y'); ?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                                   </td>     
                              </tr>                              
                              <tr>
                                   <td id="first-child">Nomor Permohonan</td>
                                   <td>
                                        <input class="standard-input" type='text' name='nomor_permohonan' id='nomor_permohonan' value='<?php echo !empty($nomor_permohonan)?$nomor_permohonan:"";?>'>                                        
                                   </td>     
                              </tr>
                              <tr>
                                   <td id="first-child">Nama Dokter</td>
                                   <td>
                                        <input class="standard-input" type='text' name='nama_dokter' id='nama_dokter' value='<?php echo !empty($nama_dokter)?$nama_dokter:"";?>'>                                        
                                   </td>     
                              </tr>
                              <tr>
                                   <td id="first-child">Nama Rumah Sakit</td>
                                   <td>
                                        <input class="standard-input" type='text' name='nama_rumah_sakit' id='nama_rumah_sakit' value='<?php echo !empty($nama_rumah_sakit)?$nama_rumah_sakit:"";?>'>                                        
                                   </td>     
                              </tr>
                              <tr>
                                   <td id="first-child">Tanggal Mulai</td>
                                   <td>
                                        <input id="tanggal_mulai_bantar" name="tanggal_mulai_bantar" value="<?php echo !empty($tanggal_mulai_bantar)?$this->tanggalhelper->convertToInputDate($tanggal_mulai_bantar):date('d/m/Y'); ?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                                   </td>     
                              </tr>    
                              <tr class="keterangan">
                                   <td id="first-child">Alasan</td>
                                   <td>
                                        <textarea class="standard-input" id="alasan" name="alasan" cols="70" rows="7"><?php echo !empty($alasan)?$alasan:"";?></textarea>
                                   </td>     
                              </tr>


                              <tr>
                                <td colspan='2' style='background:white;text-align:center;'>
                                  <input type='hidden' value='<?php echo $perkara_id;?>' name='perkara_id' id='perkara_id'/>
                                  <input type='hidden' value='<?php echo $pihak_id;?>' name='pihak_id' id='pihak_id'/>
                                  <input type='hidden' value='<?php echo $penahanan_id;?>' name='penahanan_id' id='penahanan_id'/>
                                  <input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
                                  <input type="button" id='close_form_perpanjangan_penahanan' value="Kembali" class="btn">
                                  
								  <?php if($cek_bantar>0){?>
								  <input type="button" id="hapus" value="Hapus" style="text-decoration:none" class="btn btn-danger">
								  <?php }?>
								  <input type="submit" id="simpan" value="Simpan" class="btn">
                                  
                                </td>
                              </tr>
                         </table>
					</form>
				</div>
			</div>     
		</div>
</div>
<script type="text/javascript">
$("#close_form_perpanjangan_penahanan").closingFormWin();
$('.datepicker').ValidateDateInput();

/* === penambahan alert jika tdk menggunakan json === */
$("#hapus").click(function(){
	var konfirmasi=confirm('Apakah Anda Yakin Akan Hapus Data?');
	if (konfirmasi){
	location.href="<?php echo base_url().'addPenahanan_c/hapus_template_bantar/'.$perkara_id.'/'.$pihak_id.'/'.$id_template_bantar;?>";
	}
});


  
$('#tanggal_permohonan').datepicker({
	inline: true,
	showOtherMonths: true,
	dateFormat: 'dd/mm/yy',
	dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
	onSelect: function(dateText, inst) {
		var error = 0;
		var tmp = $(this).val().split("/");
		var tmp2 = $('#curr_date').val().split("/");
		if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
			message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
			error = 1
		}
		if(error==1){
			message_error_show(message);
			$(this).css("background-color", "red");
		}else{
			$(this).css("background-color", "#dedbdb");
		}
		error = 0;
	}
});
	 
$('#tanggal_mulai_bantar').datepicker({
  inline: true,
  showOtherMonths: true,
  dateFormat: 'dd/mm/yy',
  dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
  onSelect: function(dateText, inst) {
    var error = 0;
    var tmp = $(this).val().split("/");
    var tmp2 = $('#curr_date').val().split("/");  
  }
});
</script>