<?php
if (count($listdata->result())>0)
{
	$edit=false;
	if ($this->authorization->HasRuleFormHakimPanitera($perkara_id)){
		$edit=true;
	}
	if ($this->authorization->HasRuleEditPendaftaran($alur_perkara_id, $perkara_id)){
		$edit=true;
	}
	if ($edit && $sudahputus==0)
	{
	?>
		<div id='infoPerkara' style="font-size:14px;">
		<a href="#" onClick="popup_form('<?php echo base_url('add_saksi/'.$enc.'/add');?>')" class="btn btn-default btn-sm">Tambah Data Saksi</a>
		</div>
	<?php
	}
	?>
					<div class="cssTable">
						<table id="tableinfo" style="margin:0px;padding:0px;">
							<col width="50px">
							<col width="120px">
							<col width="">
							<col width="">
							<col width="120px">
							<col width="100px">
							<col width="">
							<?php if($sudahputus==0){
								echo '<col width="50px">';
							} ?>
							<tbody>
									<tr>
										<td>No</td>
										<td>Pihak Yang<br>Menghadirkan</td>
										<td>Nama Saksi</td>
										<td>Pekerjaan</td>
										<td>Tempat/<br>Tanggal Lahir</td>
										<td>Jenis Kelamin</td>
										<td>Tempat Tinggal</td>
										<?php if($sudahputus==0){ ?>
											<td></td>
										<?php } ?>										
									</tr>
					<?php
							$i=1;
							foreach ($listdata->result() as $row) {
								$encpihak = base64_encode($this->encrypt->encode($row->pihakid));
								$pesan = '';
								if($row->jenis_kelamin=='L'){$jk="Laki-Laki";}else{$jk="Perempuan";}
								echo "<tr>";
									echo "<td align='center'>".$i."</td>";
									echo "<td align='center'>".$this->nativesession->getStatusPihak(10,$alur_perkara_id,$row->saksi_pihak_ke)."</td>";
									echo "<td>".$row->nama;										
										if($row->jenis_saksi==3 AND $alur_perkara_id>100){
											foreach ($data_ortu->result() as $data_ortu) {
												if($data_ortu->id_anak==$row->pihakid){													
													echo '<br><font color="#259FD3">Nama Orang Tua/Wali : </font>'.$data_ortu->nama;
													$ada_ortu = $data_ortu->nama;													
												}
											}
											if(!empty($ada_ortu->nama)){
												$aksi='edit';
											}else{
												$aksi='add';
											}
											echo '<br><br><a href="#" onClick="popup_form(\''.base_url('addOrtu/show_data_wali_saksi/'.$enc.'/'.$encpihak.'/'.$aksi).'\')" class="btn btn-default btn-sm">Tambah/Edit Orang Tua/Wali</a>';
										}
									echo "</td>";
									echo "<td>".$row->pekerjaan;
									if ($row->pangkat){
									echo "<br>Pangkat : ".$row->pangkat;
									echo "<br>NRP : ".$row->nrp;
									echo "<br>Jabatan : ".$row->jabatan;
									echo "<br>Kesatuan : ".$row->kesatuan;
									}
									echo "</td>";
									echo "<td style='text-align:center'>".$row->tempat_lahir."<br>".$this->tanggalhelper->convertDate($row->tanggal_lahir)."</td>";
									echo "<td style='text-align:center'>".$jk."</td>";
									echo "<td>".$row->alamat."</td>";
																		
									$encpihak5 = base64_encode($this->encrypt->encode($row->pihak5id));
									if($sudahputus==0){
										echo '<td align="center" style="cursor:pointer;">';
										if($edit==True OR $this->session->userdata('idgroup')==30){
											echo '<a href="#" onClick="popup_form(\''.base_url('add_saksi/'.$enc.'/edit/'.$encpihak).'/urt/'.$row->urutan.'/'.$encpihak5.'\')">[Edit]</a>';
										}
										echo '</td>';
									}
								echo "</tr>";
								$i++;
							}
							?>
								</tbody>
							</table>
					</div>
<?php 
}
else{
	echo "Tidak Ada Pencatatan Register Saksi";
}
?>
<script type="text/javascript">
    closeLoading();
</script>
