
<hr class="thick-line" style="clear:both;">
<div id="left">
	<?php
	echo form_open(base_url().'perkara_list_delegasi/search');
	$attributes = array('idalur'=>$idalur,'name' => 'search', 'id' => 'search-box', 'type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
	echo form_input($attributes);
	echo "<span>  </span>";
	$attributes = array('value' => 'Search', 'id' => 'search-btn1', 'type' => 'submit');
	echo form_submit($attributes);
	echo form_close('');
	if($this->session->userdata('jenis_pengadilan')==1){
		$jenis_pengadilan = "Negeri";
	}elseif($this->session->userdata('jenis_pengadilan')==2){
		$jenis_pengadilan = "Militer";
	}elseif($this->session->userdata('jenis_pengadilan')==3){
		$jenis_pengadilan = "Tata Usaha Negara";
	}elseif($this->session->userdata('jenis_pengadilan')==4){
		$jenis_pengadilan = "Agama";
	}
	$idalur = $this->encrypt->decode(base64_decode($idalur));
	if ($idalur==1) {
		$sumber="Asal";
	}else{
		$sumber="Tujuan";
	}
	?>
</div>
<?php
if($this->session->userdata('is_logged_in') and $idalur==2){
	if($this->authorization->HasRuleDelegasiJurusita($iddelegasi) AND $this->session->userdata('idgroup')!=600){
?>
<!--	<div id="left" style="margin-left:50px;">
		<input style="width:200px;" onClick="popup_form('<?php /*echo base_url('manage_delegasi_perkara/tambah_delegasi_keluar')*/;?>')" id="tambah_delegasi_keluar" type="submit" value="Tambah Delegasi Keluar" class="btn">
	</div>
-->
<?php }
}
?>
<div id="pages">
    <div id="selector"></div>
</div>
<div class="cssTable">
	<table id="tablePerkaraAll">
		<col  width="3%" />
        <col  width="20%" />
        <col  width="17%" />
        <col  width="14%" />
        <col  width="13%" />
        <col  width="17%" /> 
        <col  width="13%" /> 
        <col  width="5%" />
        <col  width="10%" />
        <col  width="5%" />
		<tbody>
			<tr>
				<td>No</td>
				<td onclick="sorting(1)">Pengadilan <?php echo $jenis_pengadilan;?> <?php echo $sumber;?></td>
				<td onclick="sorting(2)">Nomor Perkara</td>
				<td onclick="sorting(3)">Tanggal Resi Kirim</td>
				<td onclick="sorting(4)">Nomor Surat Pengantar</td>
				<td onclick="sorting(5)">Jenis Delegasi</td>
				<td>JS/JSP Ditunjuk</td>
				<td onclick="sorting(7)">Lama Proses</td>
				<td onclick="sorting(6)">Status</td>
				<td>Link</td>
			</tr>
			<?php 
				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>';
			    				if ($idalur==1) {
			    					echo '<td>'.$row->pn_asal_text.'</td>';
			    				}else{
			    					echo '<td>'.$row->pn_tujuan_text.'</td>';
			    				}
			    				$tglresi = (!empty($row->tgl_resi) AND $row->tgl_resi!='0000-00-00')? $this->templatehelper->convertKeTglIndo($row->tgl_resi):'-';
			    				echo '<td>'.$row->nomor_perkara.'</td>';
			    				echo '<td align="center">'.$tglresi.'</td>';
			    				echo '<td>'.$row->nomor_surat.'</td>';
			    				echo '<td>'.$row->jenis_delegasi_text.'</td>';
			    				if(!empty($row->jurusita_nama)){
			    					echo '<td>'.$row->jurusita_nama.'</td>';
			    				}else{
			    					if($row->tgl_surat>'2017-12-11'){
			    						echo '<td style="background-color:#FFC750">Belum Ditunjuk</td>';
			    					}else{
			    						echo '<td>Data lama dan tidak perlu di ubah</td>';
			    					}
			    				}			    				
			    				echo '<td align="center">'.$row->lama.'</td>';
			    				if ($row->status_kirim==0){
			    					if ($idalur==1){
										echo '<td style="background-color:#FFC750">Belum Dilaksanakan</td>';
			    					}else{
			    						echo '<td style="background-color:#FFC750">Belum Terkirim</td>';
			    					}
								}else if ($row->status_kirim==1){
									echo '<td style="background-color: #339E6C;color:#fff">Sudah terkirim</td>';
								}else if ($row->status_kirim==2){
									echo '<td style="background-color: #339E6C;color:#fff">Sudah dilaksanakan</td>';
								}
			    				echo '<td align="center">[<a href="'.base_url('manage_delegasi_perkara/detil_delegasi/'.base64_encode($this->encrypt->encode($idalur))."/".base64_encode($this->encrypt->encode($row->id))."/".base64_encode($this->encrypt->encode($row->id_pn_asal))."/".base64_encode($this->encrypt->encode($row->id_pn_tujuan))).'">detil</a>]</td>';
		    					echo '</tr>';
		    				$con++;
		    			}
			    	}else{
		    			echo "<tr><td colspan='9' align='center'>Data Tidak diTemukan</td></tr>";
		    		}
				}else{
		    		echo "<tr><td colspan='9' align='center'>Data Tidak diTemukan</td></tr>";
		    	}
			?>

		</tbody>
	</table>
</div>
<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    <div id="selector_bottom"></div>
</div>
<script type="text/javascript">

	function refreshPageList(){
		window.open("<?php echo $main_history;?>","_self");
	}
</script>
