<hr class="thick-line" style="clear:both;">
<div id="left">
	<?php
	$edit_bb=false;
	if ($this->authorization->HasRuleEditBarangBukti()){
		$edit_bb=true;
	}
	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"></div>
<div id="left" style="margin-left:50px;">
	<input type="submit" id="cetak_perkara_list" value="Excel" class="btn"></input>
</div>
<?php
if($this->session->userdata('is_logged_in')){
	if($edit_bb){
?>
			<div id="left" style="margin-left:50px;">
				<input style="width:120px;" id="tambah_bb" type="submit" value="Tambah Data" class="btn">
				<script type="text/javascript">
				$('#tambah_bb').click(function(event){
					window.open('<?php echo base_url();echo "new_barang_bukti"; ?>','_self')
				});
			</script>
			</div>
<?php
	}
}
?>
<div id="pages">
    <div id="selector"></div>
</div>
<div class="cssTable">
	<table id="tablePerkaraAll">
		<col  width="3%" />
        <col  width="15%" />
        <col  width="15%" />
        <col  width="10%" />
        <col  width="11%" />
        <col  width="10%" />
        <col  width="8%" />
        <col  width="15%" />
        <col  width="7%" />
		<tbody>
			<tr>
				<td>No</td>
				<td onclick="sorting(1)">Nomor Perkara</td>
				<td onclick="sorting(2)">Jenis dan Uraian Lengkap BB</td>
				<td onclick="sorting(3)">Tanggal Terima dari PU</td>
				<td onclick="sorting(5)">Tempat Penyimpanan</td>
				<td onclick="sorting(7)">Tempat Penyerahan </td>
				<td onclick="sorting(6)">Nama Penerima</td>
				<td onclick="sorting(8)">Tanggal Penyerahan BB Setelah Putusan</td>
				<td onclick="sorting(9)">Catatan Barang Bukti</td>
				<td>Link</td>
			</tr>
			<?php
				if($this->session->userdata('jenis_pengadilan')==2){
					$goto="perkara_detil_mil";
				}elseif($this->session->userdata('jenis_pengadilan')==4){
					$goto="perkara_detil_agama";
				}else{
					$goto="perkara_detil";
				}
				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) {
		    				$dateTerima = new DateTime(str_replace("-","",$row->tanggal_penerimaan));
		    				$dateSerah = new DateTime(str_replace("-","",$row->tanggal_penyerahan));
		    				echo "<tr>";
			    				echo '<td>'.$con.'</td>';
			    				echo '<td><a href="'.base_url($goto.'/'.base64_encode($this->encrypt->encode($row->perkara_id))).'">'.$row->nomor_perkara.'</a></td>';
			    				echo '<td>'.$row->jenis_barang_bukti.'</td>';
			    				echo '<td align="center">'.$this->tanggalhelper->convertDayDate($row->tanggal_penerimaan).'</td>';
			    				echo '<td>'.$row->tempat_penyimpanan.'</td>';
			    				echo '<td>'.$row->tempat_penyerahan.'</td>';
			    				echo '<td>'.$row->nama_penerima.'</td>';
			    				echo '<td align="center">'.$this->tanggalhelper->convertDayDate($row->tanggal_penyerahan).'</td>';
			    				echo '<td>'.$row->catatan_barang_bukti.'</td>';
								if ($edit_bb){
									echo '<td>[<a href="'.base_url('add_barang_bukti/show_data_edit/'.base64_encode($this->encrypt->encode($row->id))).'">edit</a>]</td>';
								}else{
									echo '<td></td>';
								}
		    				echo "</tr>";
		    				$con++;
		    			}
			    	}else{
		    			echo "<tr><td colspan='10' align='center'>Data Tidak diTemukan</td></tr>";
		    		}
				}else{
		    		echo "<tr><td colspan='9' 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>
<script type="text/javascript">
	function sorting(col){
		window.open('<?php echo base_url();?>perkara_list_barang_bukti/sort/'+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')
	}
	$('#cetak_perkara_list').click(function(){
		window.open('<?php echo base_url(); echo "perkara_list_cetak/cetak/6".$enc."/".$keyword; ?>','_self')
	});
</script>
