<?php
function parse_day_to_year($vonis){
	$result = array();
	$month = (int)($vonis/30);
	$year = (int) ($month/12);
	$month = (int) ($month%12);
	$total = (int)($year*12*30+$month*30);
	$day = intval($vonis-$total);
	$result['year'] = $year;
	$result['month'] = $month;
	$result['day'] = $day;
	return $result;
}
function fetchStatusPutusanText($data,$idpihak){
	$status ='';
	foreach ($data->result() as $row) {
		if($row->id==$idpihak){
			$satuan = $row->satuan;
			$infohukuman = '';
			if($satuan==1){
				$infohukuman = parse_day_to_year($row->durasi_nominal);
				$year = '';$month = '';$day = '';
				if(!empty($infohukuman['year'])){
					$year = $infohukuman['year'].' Tahun ';
				}
				if(!empty($infohukuman['month'])){
					$month = $infohukuman['month'].' Bulan ';
				}
				if(!empty($infohukuman['day'])){
					$day = $infohukuman['day'].' Hari';
				}
				$infohukuman = '('.$year.$month.$day.')';
			}elseif($satuan==2 && ($row->status_putusan_id)!=68){
				$infohukuman = 'Rp.'.number_format($row->durasi_nominal,2,',','.');
			}else{
				$infohukuman = (!empty($row->durasi_nominal))? '('.$row->durasi_nominal.')':'';
			}
			$status .= $row->status_putusan_text.' '.$infohukuman.'<br>';
		}
	}
	return $status;
}
?>
<script src="<?php echo base_url();?>resources/js/autoNumeric.js"></script>
<div class="centering" style="width:1024px;margin-top: 1%;">
	<div id='pihak_pilih' style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
			<?php
			if($error==TRUE){
				if($error_message=='404'){
					show_404();
					exit();
				}else{
					echo "<h1>".$error_message."</h1>";
				}
				echo '<input type="button" id="close_form_putusan" value="Kembali" class="btn">';
			}
			?>
			<form id="frm_putusan" style="background:white;margin:0;" method="post" action="<?php echo base_url().'managePutusanAkhir/validateInput';?>">
				<table id='infoPerkara' style="font-size:14px;">
					<col width="15%">
					<col width="85%">
					<tbody>
					<?php 
					if($idalurperkara==2){
						$title = 'DATA PENETAPAN (PUTUSAN AKHIR)';
						$status = 'Penetapan';
					}else{
						$title = 'DATA PUTUSAN AKHIR';
						$status = 'Putusan';
					}
					if ($this->authorization->HasRuleFormHakimPanitera($idperkara)){
						?>
						<tr>
							<td colspan="2" style="background-color: white;font-size:18px;text-align:center"><?php echo $title;?></td>						
						</tr>
						<tr>
							<td id="first-child">Tanggal <?php echo $status;?><font color="red">*</font></td>						
							<td>
								<input id="tgl_putusan" name="tgl_putusan" value="<?php echo (!empty($tanggal_putusan)? $tanggal_putusan:$sidang_terakhir);?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td id="first-child" >Status <?php echo $status;?><font color="red">*</font></td>						
							<td style="padding:0px;padding-left:5px;">
							<?php
								if($idalurperkara>100 AND $idalurperkara!=119 AND $idalurperkara!=123){
								?>
								
									<?php
									if($status_putusan!=''){
										if($status_putusan->num_rows>0){
									?>
										<div class="cssTable" style="margin:0px;border:0px;">
											<table id="tableinfo" style="margin:0px;padding:0px;">
												<col width="5%">
												<col width="30%">
												<col width="15%">
												<col width="40%">
												<col width="10%">
												<tbody>
													<tr>
														<td>No</td>
														<td>Nama</td>
														<td>Tanggal Putusan</td>
														<td>Putusan</td>
														<td>Action</td>
													</tr>
										<?php
											$i=0;
											$repeat = True;
											$idss = 0;
											foreach ($status_putusan->result() as $rows) {
												if($idss!=$rows->id){
													$repeat = False;
													$i++;
													$idss = $rows->id;
												}else{
													$repeat = True;
												}
												if($repeat==False){
													echo "<tr>";
														$status_putusan_terdakwa = fetchStatusPutusanText($status_putusan,$rows->id);
														echo "<td>".$i."</td>";
														echo "<td>".$rows->nama."</td>";
														echo "<td>".$this->tanggalhelper->convertDayDate($rows->tanggal_putusan)."</td>";
														echo "<td>".$status_putusan_terdakwa."</td>";
														$enc_pihak = base64_encode($this->encrypt->encode($rows->id));
														if(empty($rows->tanggal_putusan) OR empty($status_putusan_terdakwa)){
															$action = 'Tambah';
															$url = base_url('add_putusan_terdakwa/'.$enc.'/tambah/'.$enc_pihak);
														}else{
															$url = base_url('add_putusan_terdakwa/'.$enc.'/edit/'.$enc_pihak);
															$action = 'Edit';
														}
														echo '<td align="center">[<a href="#" onClick="popup_form2nd(\''.$url.'\')">'.$action.'</a>]</td>';
													echo "</tr>";
												}
												if(empty($idss)){
													$idss = $rows->id;
												}
											}
											?>
												</tbody>
											</table>
										</div>
									<?php
										}
									}
								}elseif($idalurperkara<100 OR $idalurperkara==119 OR $idalurperkara!=123){
								?>

								<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
									<select name="status_putusan" id="status_putusan" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
										<option value="-1">Pilih Status Putusan</option>
										<?php
										if($status_putusan !=''){
											if($status_putusan->num_rows>0){
												foreach ($status_putusan->result() as $row) {
													$selected = ($row->id==$status_putusan_id)? 'selected':'';
													echo '<option value="'.$row->id.'" '.$selected.'>'.$row->nama.'</option>';
												}
											}
										}
										?>
									</select>
								</span>
								<?php
								}
								?>
							</td>
						</tr>
						<?php
						if($idalurperkara<100 OR $idalurperkara==119 OR $idalurperkara==123 OR $idalurperkara==114){
							if($idalurperkara!=9 AND $idalurperkara!=2 AND $idalurperkara!=10 AND $idalurperkara!=11 AND $idalurperkara!=12 AND $idalurperkara!=13 AND $idalurperkara!=14){
						?>
							<tr id="verstek_tr">
								<td id="first-child">Putusan Verstek<font color="red">*</font></td>
								<td style="padding:0px;padding-left:5px;">
									<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
										<select name="verstek" id="verstek" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
											<option value="T" <?php echo ('T'==$verstek)? 'selected':'';?> >Tidak</option>
											<option value="Y" <?php echo ('Y'==$verstek)? 'selected':'';?> >Ya</option>
										</select>
									</span>
								</td> 
							</tr>
							<?php } if($idalurperkara!=114){ ?>						
							<tr id="sumber_hukum_tr">
								<td id="first-child">Sumber Hukum<font color="red">*</font></td>
								<td style="padding:0px;padding-left:5px;">
											<?php
											if($sumber_hukum !=''){
												$ex_sumber_hukum=explode(',',$sumber_hukum_put);	
												if($sumber_hukum->num_rows>0){
													foreach ($sumber_hukum->result() as $row) {
														if(in_array($row->id, $ex_sumber_hukum)){
															$cek = "checked";
														}else{
															$cek="";
														}
														echo "<input type='checkbox' name='sumber_hukum[]' value=".$row->id." ".$cek." />".$row->nama."<br/>";
													}
												}
											}											
											?>
								</td>
							</tr>
							<?php 	}
								
							$jenis_perkara = $this->tanggalhelper->getIDJenisPerkara($idperkara);
							$jenis_pengadilan = $this->session->userdata('jenis_pengadilan');
							if ($jenis_pengadilan==4 AND ($jenis_perkara==347 OR $jenis_perkara==346)){ ?>
							<tr id="popup_faktor_tr">
								<td id="first-child">Faktor Penyebab Perceraian <font color="red">*</font></td>
								<td style="padding:0px;padding-left:5px;">
									<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
										<select name="faktor_cerai" id="faktor_cerai" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
											<option value="-1">Pilih Faktor</option>
											<?php
											if($faktor_percerian !=''){
												if($faktor_percerian->num_rows>0){
													foreach ($faktor_percerian->result() as $row) {
														$selected = ($row->id==$faktor_percerian_put)? 'selected':'';
														echo '<option value="'.$row->id.'" '.$selected.'>'.$this->templatehelper->standradnaming($row->nama).'</option>';
													}
												}
											}											
											?>
										</select>
									</span>
								</td>
							</tr>
							<?php } ?>
							<?php if($jenis_pengadilan==4 AND ($jenis_perkara==347 or ($jenis_perkara==346 and $is_islam_ikrar>1))){ ?>
							<tr id="popup_keadaan_tr">
								<td id="first-child">Keadaan Istri<font color="red">*</font></td>
								<td style="padding:0px;padding-left:5px;">
									<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
										<select name="keadaan_istri" id="keadaan_istri" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
											<?php (!empty($keadaan_istri_id))? $keadaan_istri_id:$keadaan_istri_id=''; ?>
											<option value="">Pilih Keadaan Istri</option>
											<option value="1" <?php echo ($keadaan_istri_id=='1')? 'selected':''?> >Suci</option>
											<option value="2" <?php echo ($keadaan_istri_id=='2')? 'selected':''?> >Haid</option>
											<option value="3" <?php echo ($keadaan_istri_id=='3')? 'selected':''?> >Hamil</option>
											<option value="4" <?php echo ($keadaan_istri_id=='4')? 'selected':''?> >Tidak diketahui</option>										
										</select>
									</span>
								</td>
							</tr>
							<?php } ?>
							<?php if($idalurperkara !=2 AND $idalurperkara<9){ ?>
								<tr id="ganti_kerugian">
									<td id="first-child">Nilai Ganti Kerugian</td>
									<td style='padding:0px;padding-left:5px;'>							
										<input data-a-sep="." data-a-dec="," id='nilai_ganti_sengketa' name='nilai_ganti_sengketa' value='<?php echo (!empty($nilai_ganti_sengketa) ? number_format($nilai_ganti_sengketa,0,",",".") : '')?>' class='standard-input' maxlength='20' placeholder='' style='width:180px;text-align:right;'>
									</td>
								</tr>
							<?php
							}
							?>
						<?php
						}
						?>
						
						<tr>
							<td id="first-child" style="vertical-align:top;">Amar <?php echo $status;?><font color="red">*</font></td>						
							<td style="background:white;" id="amar_text">
								<span class="custom-dropdown custom-dropdown--emerald">
									<select style='width:130px;' id="template_amar"  class="custom-dropdown__select custom-dropdown__select--white">
	                                	<option value=''>Pilih amar</option>
	                                	<?php
	                                	if(!empty($list_amar)){
	                                		foreach ($list_amar as $key => $value) {
	                                			echo "<option value='".$value->id."'>".$value->nama."</option>";
	                                		}
	                                	}
	                                	?>
	                            	</select>
	                        	</span>
								<?php echo $this->ckeditor->editor("amar",$amar);?>
							</td>
						</tr>						
						<?php
						if($idalurperkara==3){
						?>
							<tr>
								<td id="first-child">Tanggal Penetapan Hakim Pengawas</td>
								<td>
									<input id="tgl_penetapan_pengawas" name="tgl_penetapan_pengawas" value ="<?php echo (!empty($penHakim)? $penHakim:'');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
								</td>
							</tr>
							<tr>
								<td id="first-child">Nomor Penetapan Hakim Pengawas</td>
								<td style="padding:0px;padding-left:5px;">
									<input type="text" id='no_penetapan_pengawas' name='no_penetapan_pengawas' class="standard-input" maxlength="50" style="width:250px;">
								</td>
							</tr>
							<tr>
								<td id="first-child">Hakim Pengawas</td>
								<td style="padding:0px;padding-left:5px;">
									<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
										<select name="hakim_pengawas" id="hakim_pengawas" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
											<option value="-1">Pilih Hakim Pengawas</option>
											<?php
											if($hakim !=''){
												if($hakim->num_rows>0){
													foreach ($hakim->result() as $row) {
														$select = ($idhakim==$row->id)? 'selected':'';
														echo '<option value="'.base64_encode($this->encrypt->encode($row->id)).'" '.$select.'>'.$row->nama_gelar.'</option>';
													}
												}
											}
											?>
										</select>
									</span>
								</td>
							</tr>
							<?php
							/* disable sementara karena tidak ada referensi kurator
							<tr>
								<td id="first-child">Kurator</td>
								<td style="padding:0px;padding-left:5px;">
									<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
										<select name="kurator" id="kurator" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
											<option value="-1">Pilih Kurator</option>
											<?php
											if($kurator !=''){
												if($kurator->num_rows>0){
													foreach ($kurator->result() as $row) {
														echo '<option value="'.base64_encode($this->encrypt->encode($row->pihak_id)).'">'.$row->nama.'</option>';
													}
												}
											}
											?>
										</select>
									</span>
								</td>
							</tr>
							*/
							?>
							<tr>
								<td id="first-child">Tanggal pengumuman dalam Berita Negara RI</td>
								<td>
									<input id="tgl_berita" name="tgl_berita" value ="<?php echo (!empty($tglBerita)? $tglBerita:'');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
								</td>
							</tr>
							<tr>
								<td id="first-child">Tanggal dimuat dalam Surat Kabar</td>
								<td>
									<input id="tgl_surat_kabar" name="tgl_surat_kabar" value ="<?php echo (!empty($tglSuratKabar)? $tglSuratKabar:'');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
								</td>
							</tr>
							<tr>
								<td id="first-child">Nama Surat Kabar</td>
								<td style="padding:0px;padding-left:5px;">
									<input type="text" id='nama_surat_kabar' name='nama_surat_kabar' value="<?php echo (!empty($namaSurat) ? $namaSurat : '');?>" class="standard-input" maxlength="50" style="width:250px;">
								</td>
							</tr>
							<script type="text/javascript">
								$("#tgl_penetapan_pengawas").datepicker({
									inline: true,
									showOtherMonths: true,
									dateFormat: "dd/mm/yy",
									dayNamesMin: ["Ming", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
									beforeShowDay: $.datepicker.noWeekends,
									onSelect: function(dateText, inst) {
										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();
											message_error_show(message);
											$(this).css("background-color", "red");
										}else{
											$(this).css("background-color", "#dedbdb");
										}
									}
								});
								$("#tgl_berita").datepicker({
									inline: true,
									showOtherMonths: true,
									dateFormat: "dd/mm/yy",
									dayNamesMin: ["Ming", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
									beforeShowDay: $.datepicker.noWeekends,
									onSelect: function(dateText, inst) {
										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();
											message_error_show(message);
											$(this).css("background-color", "red");
										}else{
											$(this).css("background-color", "#dedbdb");
										}
									}
								});
								$("#tgl_surat_kabar").datepicker({
									inline: true,
									showOtherMonths: true,
									dateFormat: "dd/mm/yy",
									dayNamesMin: ["Ming", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
									beforeShowDay: $.datepicker.noWeekends,
									onSelect: function(dateText, inst) {
										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();
											message_error_show(message);
											$(this).css("background-color", "red");
										}else{
											$(this).css("background-color", "#dedbdb");
										}
									}
								});
							</script>
						<?php
						}
					}
					?>
					<tr>
							<td id="first-child">Keterangan</td>
							<td>
								<textarea class="standard-input" id="keterangan" name ="keterangan" style="width: 827px; height: 70px;resize: none;"><?php echo (!empty($keterangan) ? $keterangan : '');?></textarea>
							</td>
							
							<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
							<input type="hidden" id="enc" name="enc" value="<?php echo $enc;?>">
							<input type="hidden" id="enc_alur" name="enc_alur" value="<?php echo $enc_alur;?>">
							<input type="hidden" id="act" name="act" value="<?php echo $act;?>">
						</tr>
						<tr>
							<td colspan="2" style="background:white;border:0px;" align="center">
								<input type="button" id='close_form_putusan' value="Kembali" class="btn">
								<?php
								$act = $this->encrypt->decode(base64_decode($act));
								if($act=="update" AND (empty($statusBHT) OR $statusBHT=='' OR $jenis_perkara==624)){
									echo '<input type="submit" id="hapus" value="Hapus" class="btn btn-danger" onclick="return false;">';
								}
								?>
								<input type="submit" id="simpan" value="Simpan" class="btn">
								<input type="hidden" id='close_form_refresh' value="">
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
$('#close_form_refresh').closingFormWin();
<?php 
if($this->session->userdata('jenis_pengadilan')==1){
?>
    $('#close_form_putusan').click(function(){
        window.open("<?php echo base_url('perkara_detil/'.$enc.'/10');?>","_self");    
    });
<?php
}else if($this->session->userdata('jenis_pengadilan')==2){
?>
    $('#close_form_putusan').click(function(){
        window.open("<?php echo base_url('perkara_detil_mil/'.$enc.'/10');?>","_self");    
    });    
<?php
}else if($this->session->userdata('jenis_pengadilan')==3){
?>
    $('#close_form_putusan').click(function(){
        window.open("<?php echo base_url('perkara_detil_tun/'.$enc.'/10');?>","_self");    
    });
<?php
}else if($this->session->userdata('jenis_pengadilan')==4){
?>
    $('#close_form_putusan').click(function(){
        window.open("<?php echo base_url('perkara_detil_agama/'.$enc.'/10');?>","_self");    
    });        
<?php
}else{
?>
    $('#close_form_putusan').closingFormWin();
<?php
}
?> 
var status_putusan = '<?php echo $status_putusan_id;?>';
if(status_putusan==6 || status_putusan==5){
	$('#verstek_tr').hide();	
}
if(status_putusan==7 || status_putusan==37 || status_putusan==67){
	$('#verstek_tr').hide();
	$('#ganti_kerugian').hide();
}

if(status_putusan!=62){
	$('#popup_faktor_tr').hide();
	$('#popup_keadaan_tr').hide();
}

<?php

if($idalurperkara==15){ ?>
	$('#status_putusan').change(function(e){
		var status = $(this).val();
		if($(this).val()==62){
			$('#popup_faktor_tr').show();
			$('#popup_keadaan_tr').show();
		}else{
			$('#popup_faktor_tr').hide();
			$('#popup_keadaan_tr').hide();
		}
		e.preventDefault();
		return false;
	});
<?php
}else{
?>
	$('#status_putusan').change(function(e){
		var status = $(this).val();
		if($(this).val()==7 || $(this).val()==6 || $(this).val()==5){
			$('#verstek_tr').hide();
		}else{
			$('#verstek_tr').show();
		}
		e.preventDefault();
		return false;
	});
<?php 
} 
?>


function doDownload(param){
	window.open("<?php echo base_url('managePutusanAkhir/doDownload/');?>"+'/'+param)
}

$('#frm_putusan').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_putusan',
	whenStatus:1,
	isCKEdit:1,
	tdID:'amar_text',
	textID:'amar',
	next_step:1
});
$('#hapus').ButtonClickHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_refresh',
	whenStatus:1,
	actions:'<?php echo base_url()?>managePutusanAkhir/validateDelete',
	formName:'#frm_putusan',
	actionName:'Hapus Data'
});

$("#tgl_putusan").datepicker({
	inline: true,
	showOtherMonths: true,
	dateFormat: "dd/mm/yy",
	dayNamesMin: ["Ming", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
	beforeShowDay:$.datepicker.noWeekends,
	onSelect: function(dateText, inst) {
		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();
			$('#tgl_putusan').val('');
			message_error_show(message);
			$(this).css("background-color", "red");
		}else{
			$(this).css("background-color", "#dedbdb");
		}
	}
});
$("#tgl_kirim_salinan_penyidik").datepicker({
	inline: true,
	showOtherMonths: true,
	dateFormat: "dd/mm/yy",
	dayNamesMin: ["Ming", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"],
	beforeShowDay:$.datepicker.noWeekends,
	onSelect: function(dateText, inst) {
		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();
			message_error_show(message);
			$(this).css("background-color", "red");
		}else{
			$(this).css("background-color", "#dedbdb");
		}
	}
});
$('#tgl_minutasi').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay:$.datepicker.noWeekends,
            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();
					message_error_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
        	}
      	});
$('.datepicker').ValidateDateInput();
function refreshDataPutusan(){
	openLoadingDialog();
	$("#popup_form").remove();
	popup_form('<?php echo base_url("add_putusan_akhir/".$enc."/update");?>')
	$("#popup_form").hide();
	closeLoading()
}
function doDelete(){
	var values = $('form').serializeArray();
	values = jQuery.param(values);
	var url = "<?php echo base_url('managePutusanAkhir/doDelete/');?>";
	$.post(url,values, function(json){
		closeLoading()
		if(json.st==1){
			message_show(json.msg);
		}else{
			message_error_show_parent(json.msg);
		}
	},'json');
}
$(document).ready(function() {
    $('#nilai_ganti_sengketa').ForceNumericOnly();
    $('#nilai_ganti_sengketa').autoNumeric('init', {mDec: '0'});
    $('#template_amar').change(function(){
    	$.post( "<?php echo base_url('managePutusanAkhir/getAmar');?>", { selected: $(this).val(), enc: "<?php echo $enc;?>" })
		.done(function( data ) {
		   	CKEDITOR.instances['amar'].setData(data); 
		});
    })

});
</script>
</script>
