<hr class="thick-line" style="clear:both;">
<div id="left">
	<?php
	echo form_open(base_url().$page_url.'/search');
	$attributes = array('name' => 'search', 'id' => 'search-box', 'type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
	echo form_input($attributes);
	$data = array(
		'enc' => $enc
	);
	echo form_hidden($data);
	echo "<span>  </span>";
	$attributes = array('value' => 'Search', 'id' => 'search-btn1', 'type' => 'submit');
	echo form_submit($attributes);
	echo form_close('');
	?>
</div>
<div id="left">
<input type="submit" onClick="popup_form('<?php echo base_url();?>search_pk/<?php echo $enc; ?>');" value="Search Detil" id="search-btn1"></input>
<?php if($idalurperkara=='118'){ ?>
<input type="submit" onClick="popup_form('<?php echo base_url();?>register_pk/<?php echo $idalurperkara; ?>');" value="Cetak Register" id="cetak_reg" class="btn btn-warning"></input>
<?php } ?>
</div>

<div id="left" style="margin-left:50px;">
	<input id="cetak_perkara_list" type="submit" value="Excel" class="btn"></input>
</div>
<?php
if($this->session->userdata('is_logged_in')){
	if($this->authorization->HasRuleAddPermohonanUpayaHukum($idalurperkara) && $idalurperkara>100){
?>
			<div id="left" style="margin-left:50px;">
				<input type="submit" onclick="tambahPerkaraPK()" value="Tambah Perkara" class="btn"></input>
			</div>
<?php
	}
}
?>
<div id="pages">
    <div id="selector"></div>
</div>
<div class="cssTable">
	<table id="tablePerkaraAll">
		<col  width="3%" />
        <col  width="12%"/>
        <col  width="12%"/>
        <col  width="9%"/>
        <col  width="9%"/>
        <col  width="9%"/>
        <col  width="9%"/>
        <col  width="9%"/>
        <col  width="8%" />
        <col  width="4%" />
		<tbody>
			<?php
				if($this->session->userdata('jenis_pengadilan')==2){
					$nop="Nomor Perkara Dilmil";
				}else{
					$nop="Nomor Perkara PN";
					 }
			?>
			<tr>
				<td>No</td>
				<td onclick="sorting(1)"><?php echo $lang_nomor_perkara;?></td>
				<td onclick="sorting(2)">Pemohon PK</td>
				<td onclick="sorting(4)">Tanggal Pengiriman Berkas PK</td>
				<td onclick="sorting(5)">Nomor Putusan PK</td>
				<td onclick="sorting(6)">Tanggal Putusan PK</td>
				<td onclick="sorting(7)">Tanggal Penerimaan Berkas PK</td>
				<td onclick="sorting(8)">Tanggal Pemberitahuan Putusan PK</td>
				<td>Status PK</td>
				<td></td>
			</tr>
			<?php
				function parse_date($date){
					if(!empty($date)){
						$date_fmt = new DateTime(str_replace("-","",$date));
						return $date_fmt->format('d M Y');
					}else{
						return '';
					}
				}

				if($list_perkara!=''){
					if($list_perkara->num_rows>0){
						if($page_active<1){
							$con = 1;
						}else{
							$con = $page_active+1;
						}
		    			foreach ($list_perkara->result() as $row) {
		    				echo "<tr>";
		    					echo '<td>'.$con.'</td>';
			    				echo '<td>'.$row->nomor_perkara_pn.'</td>';
			    				echo '<td>'.$row->pemohon_pk.'</td>';
			    				echo '<td>'.parse_date($row->pengiriman_berkas_pk).'</td>';
			    				echo '<td align="center">'.$row->nomor_perkara_pk.'</td>';
			    				echo '<td align="center">'.parse_date($row->putusan_pk).'</td>';
			    				echo '<td>'.parse_date($row->penerimaan_berkas_pk).'</td>';
			    				echo '<td align="center">'.parse_date($row->pemberitahuan_putusan_pk).'</td>';
			    				echo '<td align="center">'.$row->status_pk_text.'</td>';
			    				echo '<td align="center">[<a href="'.base_url('perkara_pk_detil/'.base64_encode($this->encrypt->encode($row->perkara_id))).'">detil</a>]';
		    				echo "</tr>";
		    				$con++;
		    			}
			    	}else{
		    			echo "<tr><td colspan='10' align='center'>Data Tidak diTemukan</td></tr>";
		    		}
				}else{
		    		echo "<tr><td colspan='10' align='center'>Data Tidak diTemukan</td></tr>";
		    	}

			?>
		</tbody>
	</table>
</div>
<?php
if($keyword!==''){
	$keyword=$keyword;
} else {
	$keyword="0";
}
?>
<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    <div id="selector_bottom"></div>
</div>
<?php
$url = base_url().$page_url.'/sort/';

?>
<script type="text/javascript">
	function sorting(col){
		window.open('<?php echo $url;?>'+col+'/<?php echo $enc; ?>/<?php echo $keyword; ?>','_self');
	}
	<?php $enc = (!empty($enc)) ? "/".$enc : $enc;?>
	function searchDetilShow(){
		window.open('<?php echo base_url();?>search<?php echo $enc; ?>','_self');
	}
	function tambahPerkaraPK(col){
		window.open('<?php echo base_url("new_pk/").$enc;?>','_self');
	}
	$('#cetak_perkara_list').click(function(){
		window.open('<?php echo base_url(); echo "perkara_list_cetak/cetak/4".$enc."/".$keyword; ?>','_self')
	});

</script>
