<div class="centering" style="width:570px;margin-top: 5%;">
    <div id='penetapan_verzet' style="border: 1px solid #ffffff;">
        <div class="detil" style="padding: 2px;background-color: white;">
            <form id="frm_verzet_pen_pp" method="post" action="<?php echo base_url().'tab_verzet_c/validateInputPenetapanPanitera';?>">
            <table id="tableDetilPerkara" style="font-size:14px;">
                <col width="45%">
                <col width="65%">
                    <tbody>
                        <tr>
                            <td colspan="2" style="background:white;border:0px;font-size: 20px;color: #648C03;" align="center">PENUNJUKAN PANITERA PENGGANTI</td>
                        </tr>
                        <tr>
                        	<td id="first-child">Nomor Perkara</td>
                        	<td>
                        		<span><?php echo $nomor_perkara;?></span>
                                <input type='hidden' name='nomor_perkara' value='<?php echo $nomor_perkara;?>'>
                                <input type='hidden' name='enc' value='<?php echo $enc;?>'>
                            </td>
                        </tr>
                            <?php
                            $tmp = explode('/', $nomor_perkara);
                            if($this->session->userdata('jenis_pengadilan')==3){
                                $kode = '/PLW/';
                            }else{
                                $kode = '/Pdt.Plw/';
                            }
                            $nomorperkaraverzet = $tmp[0].$kode.$tmp[2].'/'.$tmp[3];
                            ?>
                        <tr>
                            <td id="first-child">Nomor Perkara <?php echo $this->nativesession->getLangguage('verzet');?></td>
                            <td>
                                <span><?php echo $nomorperkaraverzet;?></span>
                            </td>
                        </tr>
                        <tr>
                        	<td id="first-child">Tanggal Putusan</td>
                        	<td>
                        		<span><?php echo $this->tanggalhelper->convertDayDate($tanggal_putusan);?></span>
                            </td>
                        </tr>
                        <tr>
                        	<td id="first-child">Tanggal Pendaftaran <?php echo $this->nativesession->getLangguage('verzet');?><font color="red">*</font></td>
                        	<td>
                                <span><?php echo $this->tanggalhelper->convertDayDate($tanggal_pendaftaran_verzet);?></span>
                        	</td>
                        </tr>
                        <?php
                        if($this->session->userdata('jenis_pengadilan')==1 OR $this->session->userdata('jenis_pengadilan')==4){
                        ?>
                            <tr>
                                <td id="first-child">Menggunakan Panitera Pengganti Awal</td>
                                <td>
                                    <span class="custom-dropdown custom-dropdown--emerald" style='width:80px;'>
                                        <select style="width:80px" name="status" id="status" class="custom-dropdown__select custom-dropdown__select--white">                                                                                                  
                                            <option value="Y">YA</option>
                                            <option value="T">TIDAK</option>
                                        </select>
                                    </span>
                                </td>
                            </tr>
                        <?php 
                        }
                        ?>
                        <tr class='tr_new_pen'>
                            <td id="first-child">Tanggal Penetapan Panitera Pengganti</td>
                            <td>
                                <input id="tgl_pen_panitera" name="tgl_pen_panitera" value="<?php echo $this->tanggalhelper->convertToInputDate($penetapan_panitera_pengganti);?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
                            </td>
                        </tr>
                        <tr class='tr_new_pen'>
                            <td id="first-child"><span>Panitera Pengganti</span></td>
                            <td>
                                <span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
                                    <select style="width:200px" name="panitera1" id="panitera1" class="custom-dropdown__select custom-dropdown__select--white">                                                                                                  
                                        <option value="">Pilih Panitera Pengganti</option>
                                        <?php
                                        if($listPanitera->num_rows()>0){
                                            foreach ($listPanitera->result() as $row) {
                                                $id = base64_encode($this->encrypt->encode($row->id));
                                                $select = ($idPanitera1==$row->id)? 'selected':'';
                                                echo '<option value="'.$id.'" '.$select.'>'.$row->nama_gelar.'</option>';
                                            }
                                        }
                                        ?>
                                    </select>
                                </span>
                            </td>
                        </tr>
                        <?php
                        if(!empty($idPanitera2)){
                        ?>
                            <tr class='tr_new_pen'>
                                <td id="first-child"><span>Panitera Pengganti II</span></td>
                                <td>
                                    <span class="custom-dropdown custom-dropdown--emerald" style='width:200px;'>
                                        <select style="width:200px" name="panitera2" id="panitera2" class="custom-dropdown__select custom-dropdown__select--white">                                                                                                  
                                            <option value="">Pilih Panitera Pengganti II</option>
                                            <?php
                                            if($listPanitera->num_rows()>0){
                                                foreach ($listPanitera->result() as $row) {
                                                    $id = base64_encode($this->encrypt->encode($row->id));
                                                    $select = ($idPanitera2==$row->id)? 'selected':'';
                                                    echo '<option value="'.$id.'" '.$select.'>'.$row->nama_gelar.'</option>';
                                                }
                                            }
                                            ?>
                                        </select>
                                    </span>
                                </td>
                            </tr>
                        <?php
                        }
                        ?>
                        <tr>
							<td colspan="2" style="background:white;padding:2px;">
								<input type="hidden" id="enc" name="enc" value="<?php echo $enc;?>">
								<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
							</td>
						</tr>
                    	<tr>
							<td colspan="2" style="background:white;" align="center">
								<input type="button" id='close_form_add_verzet' value="Kembali" class="btn">
                                <?php
                                if(!empty($penetapan_panitera_pengganti)){
                                    echo '<input type="submit" id="hapus" value="Hapus" class="btn btn-danger" onclick="return false;">';
                                }
                                ?>
                                <input id="simpan" class="btn" type="submit" value="Simpan">
							</td>
						</tr>
                    </tbody>
            </table>
        </form>
        </div>
    </div>
</div>
<?php
if(empty($penetapan_panitera_pengganti) OR $penetapan_panitera_pengganti<$tanggal_pendaftaran_verzet){
    $show = 0;
}else{
    $show = 1;
}
if($this->session->userdata('jenis_pengadilan')==3){
    $show = 1;
}
?>
<script type="text/javascript">
$('#status').change(function(e){
    if($(this).val()=='Y'){
        $('.tr_new_pen').hide();
    }else{
        $('.tr_new_pen').show();
    }
});
    $('#frm_verzet_pen_pp').SubmitHandling({
		refresh:'1',
		setRefresh:1,
		divRef:'#konten',
		clicked:1,
		btnClicked:'#close_form_add_verzet',
		whenStatus:1

    });
    $('#hapus').ButtonClickHandling({
        refresh:'1',
        setRefresh:1,
        divRef:'#konten',
        clicked:1,
        btnClicked:'#close_form_add_verzet',
        whenStatus:1,
        actions:'<?php echo base_url("tab_verzet_c/validateDeletePanitera");?>',
        formName:'#frm_verzet_pen_pp',
        actionName:'Hapus Data Penetapan Panitera Pengganti'
    });
    <?php 
    if($this->session->userdata('jenis_pengadilan')==1){
    ?>
        $('#close_form_add_verzet').click(function(){
            window.open("<?php echo base_url('perkara_detil/'.$enc.'/5');?>","_self");    
        });
    <?php
    }else if($this->session->userdata('jenis_pengadilan')==3){
    ?>
        $('#close_form_add_verzet').click(function(){
            window.open("<?php echo base_url('perkara_detil_tun/'.$enc.'/5');?>","_self");    
        });
    <?php
    }else if($this->session->userdata('jenis_pengadilan')==4){
    ?>
        $('#close_form_add_verzet').click(function(){
            window.open("<?php echo base_url('perkara_detil_agama/'.$enc.'/5');?>","_self");    
        });        
    <?php
    }else{
    ?>
        $('#close_form_add_verzet').closingFormWin();
    <?php
    }
    ?>   
    $('#tgl_pen_panitera').datepicker({
        beforeShowDay: $.datepicker.noWeekends,
    	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;
        }
    });
    
    $('.datepicker').ValidateDateInput();
$( function() {
    var status = '<?php echo $show;?>';
    if(status==1){
        $('#status').val('T');
        $('.tr_new_pen').show();
    }else{
        $('#status').val('Y');
        $('.tr_new_pen').hide();
    }
});
</script>