<div class="centering" style="width:80%;margin-top: 1%;z-index:-100">
     <div id='popup_cabut_perkara' style="border: 1px solid #ffffff;">
        <div class="detil" style="padding: 2px;background-color: white;">
		<div id="sub_title" style="color:#5FB85C;text-align:center;"><h2>CABUT PERKARA</h2></div>
		<form id="frm_cabut_perkara" style="background:white;margin:0;" method="post" action="<?php echo base_url().'cabut_perkara_c/validateInput';?>">
			<table id="tableDetilPerkara" style="font-size:14px;">
				<col width="40%">
				<col width="60%">
                    <tbody>
                        <tr>
                            <td>Nomor Perkara</td>
                            <td style="padding:0px;padding-left:5px;">
                                <?php echo $nomor_perkara;?>
                            </td>
                        </tr>
                        <tr>
                            <td>Tanggal Pendaftaran</td>
                            <td style="padding:0px;padding-left:5px;">
                                <?php echo $this->tanggalhelper->convertDayDate($tanggal_pendaftaran); ?>
                            </td>
                        </tr>
                        <tr>
                            <td>Tanggal Cabut<font color="red">*</font></td>
                            <td style="padding:0px;padding-left:5px;">
                                <input id="tgl_cabut" name="tgl_cabut" value="" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                            </td>
                        </tr>
                        <tr id="sumber_hukum_tr">
                                <td>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>

						<tr>
							<td valign="top" style="vertical-align:top">Amar Pencabutan<font color="red">*</font></td>
							<td style="background:white;" id="isi_cabut_text">
								<?php echo $this->ckeditor->editor("isi_cabut",$isi_cabut);?>
							</td>
						</tr>
                        <!--<tr>
                            <td>Dokumen Amar Pencabutan</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="file" id="dok_cabut" name="dok_cabut" value="<?php $dok_akta_perdamaian=''; echo (!empty($dok_akta_perdamaian) ? $dok_akta_perdamaian : '');?>" >
                            </td>
                        </tr>-->
                        <tr>
                            <td colspan="2" style="background:white;" align="center">
                            <input type="hidden" id="enc" name="enc" value="<?php echo $enc; ?>">
                            <input type="hidden" id="curr_date" name="curr_date" value="<?php echo $tgl_sekarang;?>">
                            <input type="button" id='close_form_cabut' value="Batal" class="btn">
                            <?php
                            //if($this->authorization->isAuthorized('hakim_pn_edit',$AuthorizationForm)){
                            ?>
                            
                                <input type="submit" id="simpan_btn" value="Simpan" class="btn">
                            <?php
                            //}
                            ?>
                        </td>
                        </tr>
                    </tbody>

			</table>
		</form>
	</div>
</div>
<script type="text/javascript">

$('#tgl_cabut').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 date = $(this).datepicker('getDate');
                var dayOfWeek = weekday[date.getDay()];
                //var error = 0;
                var message ='';
                if(dayOfWeek=='Sunday' || dayOfWeek=='Saturday'){
                    message ='Tidak Dapat Memilih diluar Hari Kerja.';
                    error = 1;
                }
				
				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;
        	}
      	});


$('#frm_cabut_perkara').SubmitHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
	btnClicked:'#close_form_cabut',
	whenStatus:1,
	isCKEdit:1,
	tdID:'isi_cabut_text',
	textID:'isi_cabut',
    next_step:1
});

// $('#close_form_cabut').closingFormWin();
<?php 
if($this->session->userdata('jenis_pengadilan')==1){
?>
    $('#close_form_cabut').click(function(){
        window.open("<?php echo base_url('perkara_detil/'.$enc.'/10');?>","_self");    
    });
<?php
}else if($this->session->userdata('jenis_pengadilan')==2){
?>
    $('#close_form_cabut').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_cabut').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_cabut').click(function(){
        window.open("<?php echo base_url('perkara_detil_agama/'.$enc.'/10');?>","_self");    
    });        
<?php
}else{
?>
    $('#close_form_cabut').closingFormWin();
<?php
}
?> 
$('.datepicker').ValidateDateInput();

</script>