<hr class="thick-line" style="clear:both;">
<div style="padding:20px;"></div>
	<div class="detil" style="font-size:14px;margin-top:25px;width: 75%;margin: 0 auto;border-color: #FFFFFF;">
		<form id="frm_edit_data_umum_eksekusi" style="background:white;margin:0;" method="post" action="<?php echo base_url().'add_perdata_eksekusi/validateInputEdit';?>">
			<table id="tableDetilPerkara" style="font-size:14px;" width="750px" >
				<col width="25%">
				<col width="75%">
				<tbody >
                        <tr><td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong> Pengadilan Negeri</td></tr>
                        <tr>
                            <td bgcolor='#5FB85C'><font color='#fff'>Nomor Perkara PN</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id="nomor_perkara_pn" name="nomor_perkara_pn" value="<?php echo $nomor_perkara_pn;?>" class="standard-input" style="width:200px;" readonly="readonly">
                            </td>
                         </tr>
                         <tr>
                            <td bgcolor='#5FB85C'><font color='#fff'>Tanggal Putusan</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id='tgl_putusan_pn' name='tgl_putusan_pn' value="<?php echo $tgl_putusan_pn;?>" class="standard-input" style="width:15%" readonly="readonly">
                            </td>
                        </tr>
                        <tr class="banding_hide">
                            
                            <td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong>Data Banding</td>
                        </tr>
                        <tr class="banding_hide">
                            <td bgcolor='#5FB85C'><font color='#fff'>Nomor Perkara Banding</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id='nomor_perkara_banding' name='nomor_perkara_banding' value="<?php echo $nomor_perkara_banding;?>" class="standard-input" style="width:200px;" readonly="readonly">
                            </td>
                         </tr>
                         <tr class="banding_hide">                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Tanggal Putusan Banding</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id='tgl_putusan_banding' name='tgl_putusan_banding' value="<?php echo $tgl_putusan_banding;?>" class="standard-input" style="width:15%" readonly="readonly">
                            </td>

                        </tr >
                        <tr class="kasasi_hide">
                            <td colspan="2" style='background:white;'></td>
                            <td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong>Data Kasasi</td>
                        </tr>
                        <tr class="kasasi_hide">
                            <td bgcolor='#5FB85C'><font color='#fff'>Nomor Perkara Kasasi</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id='nomor_perkara_kasasi' name='nomor_perkara_kasasi' value="<?php echo $nomor_perkara_kasasi;?>"  class="standard-input" style="width:200px;" readonly="readonly">
                            </td>
                        </tr>
                        <tr class="kasasi_hide">                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Tanggal Putusan Kasasi</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id='tgl_putusan_kasasi' name='tgl_putusan_kasasi' value="<?php echo $tgl_putusan_kasasi;?>" class="standard-input" style="width:15%" readonly="readonly">
                            </td>
                        </tr>
                        <tr class="pk_hide">
                            <td colspan="2" style='background:white;'></td>
                            <td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong>Data Peninjauan Kembali</td>
                        </tr>                        
                        <tr class="pk_hide">                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Nomor Perkara Peninjauan Kembali</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id='nomor_perkara_pk' name='nomor_perkara_pk' value="<?php echo $nomor_perkara_pk;?>" class="standard-input" style="width:200px;" readonly="readonly">
                            </td>
                        </tr>
                        <tr class="pk_hide">                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Tanggal Putusan Peninjauan Kembali</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="text" id='tgl_putusan_pk' name='tgl_putusan_pk' value="<?php echo $tgl_putusan_pk;?>" class="standard-input" style="width:15%" readonly="readonly">
                            </td>
                        </tr>
                        <tr><td colspan="2" style='background:white;'></td></tr>
                        <tr><td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong>Pemohon Eksekusi</td></tr>
                        <tr id="tr_put_amar">
                            <td bgcolor='#5FB85C'><font color='#fff'>Putusan Yang Dieksekusi</td>
                            <td style="padding:0px;padding-left:5px;" id="td_put_amar" >
                                <span class="custom-dropdown custom-dropdown--emerald" style="width:100px">
                                    <select name="listdataput" id="listdataput" style='width:100px;' class="custom-dropdown__select custom-dropdown__select--white">
                                        <option value="0">- Pilih - </option>
                                        <option id='put_1' value="10" <?php if($eksekusi_putusan_id==10){echo 'selected';}?>>PN</option>
                                        <option id='put_2' value="20" <?php if($eksekusi_putusan_id==20){echo 'selected';}?>>Banding</option>
                                        <option id='put_3' value="30" <?php if($eksekusi_putusan_id==30){echo 'selected';}?>>Kasasi</option>
                                        <option id='put_4' value="40" <?php if($eksekusi_putusan_id==40){echo 'selected';}?>>PK</option>
                                    </select>
                                </span>                            	
                            </td>
                         </tr>
                         <tr>                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Nomor Perkara Yang di Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;">
								<input type="text" id="no_perkara_mhn_eksekusi" name="no_perkara_mhn_eksekusi" value="<?php echo $eksekusi_nomor_perkara; ?>" class="standard-input" style="width:200px;">
                            </td>
                        </tr>
                         <tr id="tr_amar">                            
                            <td bgcolor='#5FB85C' ><font color='#fff'>Amar Putusan Yang di Eksekusi</td>
                            <td id="td_amar"><?php echo $eksekusi_amar_putusan; ?></td>
                        </tr>
                        <tr>
                            <td bgcolor='#5FB85C'><font color='#fff'>Tanggal Permohonan Eksekusi</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input id="tgl_permohonan_eksekusi" name="tgl_permohonan_eksekusi" value="<?php echo $this->tanggalhelper->convertToInputDate($tgl_permohonan_eksekusi);?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">

                            </td>
                        </tr>
                         <tr>                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Nama Pemohon</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input type="hidden" id='enc_pemohon' name='enc_pemohon' value="<?php echo base64_encode($this->encrypt->encode($pemohon_id));?>">
                                <input type="text" id='nama_pemohon' name='nama_pemohon' value="<?php echo $pemohon_eksekusi?>" class="standard-input" maxlength="200" readonly="readonly" style="width: 236px;">
                                <input type="button" onClick="popup_form('<?php echo base_url('pihak_list_up');?>')" value="Cari" style="padding: 7px 0;color:white;background: #7f8c8d;border: 0 none;  -webkit-border-radius: 0 0 0 0;width: 70px;">
                            </td>
                        </tr>
                         <tr>                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Pekerjaan Pemohon</td>
                            <td style="padding:0px;padding-left:5px;">
                                    <input type="text" id='pekerjaan_pemohon' name='pekerjaan_pemohon' value="<?php echo $pekerjaan?>" class="standard-input" style="width: 236px;" maxlength="200" readonly="readonly">
                            </td>
                        </tr>
                         <tr>                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Alamat Pemohon</td>
                            <td style="padding:0px;padding-left:5px;">
                                <textarea type="text" id='alamat_pemohon' name='alamat_pemohon' class="standard-input" readonly="readonly" style="width: 311px; height: 90px;resize: none;"><?php echo $alamat?></textarea>
                            </td>
                        </tr>

                        <tr>
                            <td bgcolor='#5FB85C'><font color='#fff'>Tanggal Surat Kuasa</td>
                            <td style="padding:0px;padding-left:5px;">
                                <input id="tgl_surat_kuasa" name="tgl_surat_kuasa" value="<?php echo $this->tanggalhelper->convertToInputDate($tgl_surat_kuasa)?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" >
                            </td>
                        </tr>
                         <tr>                            
                            <td bgcolor='#5FB85C'><font color='#fff'>Nomor Surat Kuasa</td>
                            <td style="padding:0px;padding-left:5px;">
								<input type="text" id="no_surat_kuasa" name="no_surat_kuasa" value="<?php echo $nomor_surat_kuasa?>" class="standard-input" style="width:311px;">
                            </td>
                        </tr>
                        <tr><td colspan="2" style='background:white;'></td></tr>
                        <tr><td colspan="2" style="background-color:#A3DBA8;padding:5px;"><strong>Pihak Yang dimohonkan Eksekusi</td></tr>
                        <tr id="tr_penggugat">
                            <td bgcolor='#5FB85C'><font color='#fff'>Penggugat</td>
                            <td>
                            <?php
                            
                                $y=1;
                                if($parapenggugat->num_rows>0){
                                    foreach ($parapenggugat->result() as $row) {
                                        if(preg_match('/'.$row->pihak_id.'/',$parapemohon)){
                                        echo "<input class=\"c_penggugat\" type=\"checkbox\" value=\"$row->pihak_id;$row->nama\" id=\"penggugat$y\" name=\"penggugat[]\" checked>$row->nama<br>";
                                    }else{
                                        echo "<input class=\"c_penggugat\" type=\"checkbox\" value=\"$row->pihak_id;$row->nama\" id=\"penggugat$y\" name=\"penggugat[]\" >$row->nama<br>";
                                    }
                                        $y++;
                                    }
                                }                            
                            ?>
                            </td>                        
						</tr>
                        <tr id="tr_tergugat">
                            <td bgcolor='#5FB85C'><font color='#fff'>Tergugat</td>
                            <td>
                            <?php

                                $y=1;
                                if($paratergugat->num_rows>0){
                                    foreach ($paratergugat->result() as $row) {
                                        if(preg_match('/'.$row->pihak_id.'/',$parapemohon)){
                                            echo "<input class=\"c_tergugat\" type=\"checkbox\" value=\"$row->pihak_id;$row->nama\" id=\"tergugat$y\" name=\"tergugat[]\" checked>$row->nama<br>";
                                        }else{
                                            echo "<input class=\"c_tergugat\" type=\"checkbox\" value=\"$row->pihak_id;$row->nama\" id=\"tergugat$y\" name=\"tergugat[]\" >$row->nama<br>";                                            
                                        }                                            
                                        $y++;
                                    }
                                }                            
                            ?>

                            </td>                        
						</tr>

                        <tr>
                            <td colspan="2" style="background:white;" align="center">
                            <input type="hidden" id="amarpn" name="amarpn" value='<?php echo $amar_pn;?>'>
                            <input type="hidden" id="amarbanding" name="amarbanding" value='<?php echo $amar_banding;?>'>
                            <input type="hidden" id="amarkasasi" name="amarkasasi" value='<?php echo $amar_kasasi;?>'>
                            <input type="hidden" id="amarpk" name="amarpk" value="<?php echo $amar_pk;?>">

                            <input type="hidden" id="idperkara" name="idperkara" value="<?php echo $idperkara;?>">
                            <input type="hidden" id="alurperkaraid" name="alurperkaraid" value="<?php echo $idalurperkara;?>">
                            <input type="hidden" id="curr_date" name="curr_date" value="<?php echo $tgl_sekarang;?>">
                            <input type="button" id="kembali" value="Kembali" class="btn">
                            <input type="submit" id="simpan" value="Simpan" class="btn">
                        </td>
                        </tr>
				</tbody>
			</table>
		</form>
	</div>

<script type="text/javascript">
$('#kembali').click(function(){
    window.open("<?php echo $previous;?>","_self");
});

$(".ref_pihak #refresh").change(function(){
    refreshPihakList()
});
function refreshPihakList(){
    $("#popup_form").remove();
    popup_form('<?php echo base_url("pihak_list_up");?>');
}

$('.banding_hide').hide();
$('.kasasi_hide').hide();
$('.pk_hide').hide();

var amar_pn=$('#amarpn').val();
var amar_banding=$('#amarbanding').val();
var amar_kasasi=$('#amarkasasi').val();
var amar_pk=$('#amarpk').val();

var putusan_banding='<?php echo $tgl_putusan_banding; ?>';
var putusan_kasasi='<?php echo $tgl_putusan_kasasi; ?>';
var putusan_pk='<?php echo $tgl_putusan_pk; ?>';

if(putusan_banding!='' || putusan_banding=='0000-00-00'){
    $('.banding_hide').show();
}
if(putusan_kasasi!='' || putusan_kasasi=='0000-00-00'){
    $('.kasasi_hide').show();
}
if(putusan_pk!='' || putusan_pk=='0000-00-00'){
    $('.pk_hide').show();
}

$('#listdataput').change(function(e){
    
    if($('#listdataput').val()==''){
        $('#td_amar').remove();  
        $('#tr_amar').append('');  
        $('#no_perkara_mhn_eksekusi').val('')
    }else if($('#listdataput').val()==10){
        $('#td_amar').remove();  
        $('#tr_amar').append("<td id='td_amar'>"+amar_pn+"</td>");  
        $('#no_perkara_mhn_eksekusi').val($('#nomor_perkara_pn').val())
    }else if($('#listdataput').val()==20){
        $('#td_amar').remove();  
        $('#tr_amar').append("<td id='td_amar'>"+amar_banding+"</td>");
        $('#no_perkara_mhn_eksekusi').val($('#nomor_perkara_banding').val())
    }else if($('#listdataput').val()==30){
        $('#td_amar').remove();  
        $('#tr_amar').append("<td id='td_amar'>"+amar_kasasi+"</td>");
        $('#no_perkara_mhn_eksekusi').val($('#nomor_perkara_kasasi').val())
    }else if($('#listdataput').val()==40){
        $('#td_amar').remove();  
        $('#tr_amar').append("<td id='td_amar'>"+amar_pk+"</td>");
        $('#no_perkara_mhn_eksekusi').val($('#nomor_perkara_pk').val())
    }
  
  
});



$("#frm_edit_data_umum_eksekusi").on("click",'.c_penggugat', function(){
    if($(this).is(':checked')){
       $('.c_tergugat').prop('checked', false);
    }
}); 
$("#frm_edit_data_umum_eksekusi").on("click",'.c_tergugat', function(){
    if($(this).is(':checked')){
       $('.c_penggugat').prop('checked', false);
    }
}); 


$('#tgl_permohonan_eksekusi').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();
                    error = 1
                }

                if(error==1){
                    message_error_show(message);
                    $(this).css("background-color", "red");
                }else{
                    $(this).css("background-color", "#dedbdb");
                }
                error = 0;
            }
        });

$('#tgl_surat_kuasa').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();
                    error = 1
                }

                if(error==1){
                    message_error_show(message);
                    $(this).css("background-color", "red");
                }else{
                    $(this).css("background-color", "#dedbdb");
                }
                error = 0;
            }
        });




$('#frm_edit_data_umum_eksekusi').SubmitHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#frm_edit_data_umum_eksekusi',
    clicked:1,
    btnClicked:'#kembali',
    whenStatus:1,
/*    isCKEdit:1,
    tdID:'alasan_eksekusi_text',
    textID:'alasan_eksekusi',
    */
});
</script>