<?php
	if($infopk!=''){
		if($infopk->num_rows>0){
			foreach ($infopk->result() as $row) {
				$noperkarapn = $row->nomor_perkara_pn;
				$tglputusanpn = $this->tanggalhelper->convertDayDate($row->putusan_pn);
				$nokirimberkara = $row->nomor_surat_pengiriman_berkas_pk;
				$tglpengiriman = $this->tanggalhelper->convertDayDate($row->pengiriman_berkas_pk);
				$tglputusanpt = $this->tanggalhelper->convertDayDate($row->putusan_pk);
				$terimaberkas = $this->tanggalhelper->convertDayDate($row->penerimaan_berkas_pk);
				$minutasipt = $this->tanggalhelper->convertDayDate($row->minutasi_pk);
				$noperkarapk = $row->nomor_perkara_pk;
				$noputusanpk = $row->nomor_putusan_pk;
				$majelis = $row->majelis_hakim_pk;
				$panitera = $row->panitera_pengganti_pk;
				$amar = $row->amar_putusan_pk;
			}
		}
	}else{
		show_404();
	}
?>
<hr class="thick-line" style="clear:both;">
<div style="font-size:14px;padding-top:15px;padding-left:5px;" id="detilpk">
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="70%">
		<col width="15%">
		<tbody>
			<?php
				if($this->session->userdata('jenis_pengadilan')==2){
					$nop="Nomor Perkara Dilmil";		
					$nops="Tanggal Putusan Dilmil";
					$ppk="Panitera PK";
				}else{
					$nop="Nomor Perkara Tingkat Pertama";
					$nops="Tanggal Putusan Tingkat Pertama";	
					$ppk="Panitera Pengganti PK";			
				}
			?>		
			<tr >
				<td style="background-color:#A3DBA8;padding:5px;" colspan="3">Data Perkara Tingkat Pertama</td>
			
			</tr>
			<tr>
				<td style="padding:1px;"></td>
			</tr>
			<tr>
				<td id="first-child"><?php echo $nop;?></td>
				<td colspan="2"><?php echo (!empty($noperkarapn) ? $noperkarapn : '');?></td>
			</tr>
			<tr>
				<td id="first-child"><?php echo $nops;?></td>
				<td colspan="2"><?php echo (!empty($tglputusanpn) ? $tglputusanpn : '');?></td>
			</tr>
			<tr>
				<td colspan="3"></td>
			</tr>
		</tbody>
	</table>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="85%">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Data Para Pihak</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="5%" />
			<col width="20%" />
			<col width="35%" />
			<col width="10%" />
			<col width="30%" />
			<tbody>
				<tr>
					<td>No</td>
					<td>Status</td>
					<td>Nama</td>
					<td>Diwakili</td>
					<td>Diwakili Oleh</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						$i=1;
						foreach ($infopkdetil->result() as $row) {
							$diwakili = ($row->pihak_diwakili=='Y')? 'Ya':'Tidak';
							if($row->pihak_diwakili=='Y'){
								$pemohon = $row->pemohon_nama.'<br> Pekerjaan:'.$row->pemohon_pekerjaan.'<br> Alamat:'.$row->pemohon_alamat;
							}else{
								$pemohon = '';
							}
							$edit = FALSE;
							if($row->alur_perkara_id<100){
								$edit = TRUE;
							}else{
								if($row->pihak_asal==2){
									$edit = TRUE;
								}
							}
							
							echo '<tr>';
								echo '<td>'.$i.'</td>';
								echo '<td>'.$row->status_pihak_text.'('.$row->pihak_asal_text.')</td>';
								echo '<td>'.$row->pihak_nama.'</td>';
								echo '<td>'.$diwakili.'</td>';
								echo '<td>'.$pemohon.'</td>';
							echo '</tr>';
							$i++;
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="85%">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Data Permohonan PK</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="15%" />
			<col width="50%" />
			<col width="25%" />
			<tbody>
				<tr>
					<td>Tanggal Permohonan</td>
					<td>Pemohon PK</td>
					<td>Keterangan</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						foreach ($infopkdetil->result() as $row) {
							$diwakili = ($row->pihak_diwakili=='Y')? 'Ya':'Tidak';
							if($diwakili=='Y'){
								$pemohon = $row->pemohon_pk;
							}else{
								$pemohon = $row->pemohon_nama.'<br>'.$row->pekerjaan.'<br>'.$row->pemohon_alamat;
							}
							if(!empty($row->tanggal_cabut)){
								$status = 'Permohonan pk Telah Dicabut Pada '.$this->tanggalhelper->convertDayDate($row->tanggal_cabut);
							}else{
								$status = '';
							}
							if(!empty($row->permohonan_pk)){
								echo '<tr>';
									echo '<td>'.$this->tanggalhelper->convertDayDate($row->permohonan_pk).'</td>';
									echo '<td>'.$pemohon.'</td>';
									echo '<td>'.$status.'</td>';
								echo '</tr>';
							}
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<?php
	if($alur_perkara_id<100 AND $alur_perkara_id!=9 AND $alur_perkara_id!=10 AND $alur_perkara_id!=11 AND $alur_perkara_id!=12 AND $alur_perkara_id!=13 AND $alur_perkara_id!=14){
		$jenispkr = array('624','139','140','141','344','359','360');
    	if(!in_array($idjenisperkara, $jenispkr)){
	?>
		<div style="padding:5px;"></div>
		<table id='infoPerkara' style="font-size:14px;width:100%;">
			<col width="20%">
			<col width="80%">
			<?php			
			if($infomediasi!=''){
				if($infomediasi->num_rows>0){
					foreach ($infomediasi->result() as $row) {
						$tgl_kesepakatan 			= $this->tanggalhelper->convertDayDate($row->tgl_kesepakatan_perdamaian);
						$tgl_pengajuan_kesepakatan 	= $this->tanggalhelper->convertDayDate($row->tgl_pengajuan_kesepakatan);
						$mediator_text 				= $row->mediator_text;
						$status_mediator 			= $row->status_mediator;
						$tgl_pengiriman_kesepakatan = $this->tanggalhelper->convertDayDate($row->tgl_kirim_kesepakatan_ke_ptma);
						$keterangan 				= $row->catatan_mediasi;												
					}
				}
			}
			echo'<tbody>
				<tr><td style="background-color:#A3DBA8;padding:5px;" colspan="2">Data Mediasi</td></tr>
				<tr><td style="padding:1px;"></td></tr>
				<tr><td id="first-child">Tanggal Kesepakatan Perdamaian</td>
					<td>'.(!empty($tgl_kesepakatan) ? $tgl_kesepakatan : '-').'</td>
				</tr>
				<tr>
					<td id="first-child">Tanggal Pengajuan Kesepakatan Perdamaian</td>
					<td colspan="2">'.(!empty($tgl_pengajuan_kesepakatan) ? $tgl_pengajuan_kesepakatan : '-').'</td>
				</tr>
				<tr>
					<td id="first-child">Nama Mediator</td>
					<td colspan="2">';
					if(!empty($mediator_text)){
					?>
                    <div class="cssTable" style="">
                        <table id="tableinfo" style="margin:0px;padding:0px;">
                            <col style="width:5%">
                            <col style="width:75%">
                            <col style="width:20%">
                            <tbody>
                                <tr>
                                    <td>No</td>
                                    <td>Nama</td>
                                    <td>Status Mediator</td>
                                    
                                </tr>
		                            <?php
		                            $jumlah         = substr_count($mediator_text,"<br/>");
		                            $mediator_text  = explode("<br/>",$mediator_text);
		                            $status         = explode(",",$status_mediator);
		                            $total          = $jumlah+1;
		                            for($i=0; $i<$total; $i++){
		                                $no = $i+1;
		                                $status_med = substr_replace(",",$status[$i]."<br>",0);
		                                if($status[$i]=='H'){
		                                    $status_text ='Hakim';
		                                }elseif($status[$i]=='N'){
		                                    $status_text ='Non-Hakim';
		                                }else{
		                                    $status[$i] ="-";
		                                }
		                                if($mediator_text!=''){
		                                    echo "<tr>";
		                                        echo "<td style='text-align:center; vertical-align:top'>".$no."</td>";
		                                        echo "<td style='text-align:left; vertical-align:top;'>".substr_replace("<br/>",$mediator_text[$i]."<br>",0)."</td>";
		                                        echo "<td style='text-align:left; vertical-align:top'>".$status_text."</td>";
		                                    echo "<tr>";
		                                }else{
		                                    echo "<tr>";
		                                        echo "<td style='text-align:center' colspan='3'>Data tidak ditemukan</td>";
		                                    echo "<tr>";
		                                }
		                            }
		                            ?>
	                        </tbody>
	                    </table>
	                <?php
	            	}else{
	            		echo '-';
	            	}
	                ?>
	                </td>
				</tr>
				<tr>
					<td id="first-child">Tanggal Pengiriman Hasil Kesepakatan ke MA</td>
					<td colspan="2"><?php echo (!empty($tgl_pengiriman_kesepakatan) ? $tgl_pengiriman_kesepakatan : '-');?></td>					
				</tr>
				<tr>
					<td id="first-child">Keterangan</td>
					<td colspan="2"><?php echo (!empty($keterangan) ? $keterangan : '-');?></td>					
				</tr>				
				<tr>
					<td colspan="2"></td>
				</tr>
			</tbody>
		</table>
	<?php
		}
	}
	?>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="85%">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Tanggal Pemberitahuan Permohonan PK</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="5%" />
			<col width="25%" />
			<col width="35%" />
			<col width="15%" />
			<tbody>
				<tr>
					<td>No</td>
					<td>Status</td>
					<td>Nama</td>
					<td>Tanggal</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						$i=1;
						foreach ($infopkdetil->result() as $row) {
							if($row->status_pihak_id>1){
								echo '<tr>';
									echo '<td>'.$i.'</td>';
									echo '<td>'.$row->status_pihak_text.'('.$row->pihak_asal_text.')</td>';
									echo '<td>'.$row->pihak_nama.'</td>';
									echo '<td>'.$this->tanggalhelper->convertDayDate($row->pemberitahuan_pk).'</td>';
								echo '</tr>';
								$i++;
							}
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="85%">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Tanggal Penerimaan Memori PK</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="5%" />
			<col width="25%" />
			<col width="35%" />
			<col width="15%" />
			<tbody>
				<tr>
					<td>No</td>
					<td>Status</td>
					<td>Nama</td>
					<td>Tanggal</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						$i=1;
						foreach ($infopkdetil->result() as $row) {
							if($row->status_pihak_id==1 OR $row->status_pihak_id==2){
								echo '<tr>';
									echo '<td>'.$i.'</td>';
									echo '<td>'.$row->status_pihak_text.'('.$row->pihak_asal_text.')</td>';
									echo '<td>'.$row->pihak_nama.'</td>';
									echo '<td>'.$this->tanggalhelper->convertDayDate($row->penerimaan_memori_pk).'</td>';
								echo '</tr>';
								$i++;
							}
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="85%">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Tanggal Penyerahan Memori PK</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="5%" />
			<col width="25%" />
			<col width="35%" />
			<col width="15%" />
			<tbody>
				<tr>
					<td>No</td>
					<td>Status</td>
					<td>Nama</td>
					<td>Tanggal</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						$i=1;
						foreach ($infopkdetil->result() as $row) {
							if($row->status_pihak_id>1){
								echo '<tr>';
									echo '<td>'.$i.'</td>';
									echo '<td>'.$row->status_pihak_text.'('.$row->pihak_asal_text.')</td>';
									echo '<td>'.$row->pihak_nama.'</td>';
									echo '<td>'.$this->tanggalhelper->convertDayDate($row->penyerahan_memori_pk).'</td>';
								echo '</tr>';
								$i++;
							}
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="85%">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Tanggal Penerimaan Kontra Memori PK</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="5%" />
			<col width="25%" />
			<col width="35%" />
			<col width="15%" />
			<tbody>
				<tr>
					<td>No</td>
					<td>Status</td>
					<td>Nama</td>
					<td>Tanggal</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						$i=1;
						foreach ($infopkdetil->result() as $row) {
							if($row->status_pihak_id>1 AND $row->status_pihak_id<5){
								echo '<tr>';
									echo '<td>'.$i.'</td>';
									echo '<td>'.$row->status_pihak_text.'('.$row->pihak_asal_text.')</td>';
									echo '<td>'.$row->pihak_nama.'</td>';
									echo '<td>'.$this->tanggalhelper->convertDayDate($row->penerimaan_kontra_pk).'</td>';
								echo '</tr>';
								$i++;
							}
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="15%">
		<col width="85%">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Tanggal Penyerahan Kontra Memori PK</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="5%" />
			<col width="25%" />
			<col width="35%" />
			<col width="15%" />
			<tbody>
				<tr>
					<td>No</td>
					<td>Status</td>
					<td>Nama</td>
					<td>Tanggal</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						$i=1;
						foreach ($infopkdetil->result() as $row) {
							if($row->status_pihak_id!=3){
								echo '<tr>';
									echo '<td>'.$i.'</td>';
									echo '<td>'.$row->status_pihak_text.'('.$row->pihak_asal_text.')</td>';
									echo '<td>'.$row->pihak_nama.'</td>';
									echo '<td>'.$this->tanggalhelper->convertDayDate($row->penyerahan_kontra_pk).'</td>';
								echo '</tr>';
								$i++;
							}
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="25%">
		<col width="75%">
		<tbody>
			<tr >
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Tanggal Pengiriman Berkas PK</td>
			</tr>
			<tr>
				<td style="padding:1px;"></td>
			</tr>
			<tr>
				<td id="first-child">Tanggal Pengiriman Berkas PK</td>
				<td><?php echo (!empty($tglpengiriman) ? $tglpengiriman : '');?></td>
			</tr>
			<tr>
				<td id="first-child">Nomor Surat Pengiriman Berkas PK</td>
				<td><?php echo (!empty($nokirimberkara) ? $nokirimberkara : '');?></td>
		</tr>
			<tr>
				<td colspan="2"></td>
			</tr>
		</tbody>
	</table>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<col width="25%">
		<col width="75%">
		<tbody>
			<tr >
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Putusan PK</td>
			</tr>
			<tr>
				<td style="padding:1px;"></td>
			</tr>
			<tr>
				<td id="first-child">Tanggal Putusan PK</td>
				<td><?php echo (!empty($tglputusanpt) ? $tglputusanpt : '');?></td>
			</tr>
			<tr>
				<td id="first-child">Nomor Putusan PK</td>
				<td><?php echo (!empty($noperkarapk) ? $noperkarapk : '');?></td>
			</tr>
			<tr>
				<td id="first-child">Amar Putusan PK</td>
				<td><?php echo (!empty($amar) ? $amar : '');?></td>
			</tr>
			<tr>
				<td id="first-child">Majelis Hakim PK</td>
				<td><?php echo (!empty($majelis) ? $majelis : '');?></td>
			</tr>
			<tr>
				<td id="first-child"><?php echo $ppk;?></td>
				<td><?php echo (!empty($panitera) ? $panitera : '');?></td>
			</tr>
			<tr>
				<td id="first-child">Tanggal Penerimaan Kembali Berkas PK</td>
				<td><?php echo (!empty($terimaberkas) ? $terimaberkas : '');?></td>
			</tr>
			<tr>
				<td id="first-child">Tanggal Pengarsipan PK</td>
				<td><?php echo (!empty($minutasipt) ? $minutasipt : '');?></td>
			</tr>
			<tr>
				<td colspan="2"></td>
			</tr>
		</tbody>
	</table>
	<div style="padding:5px;"></div>
	<table id='infoPerkara' style="font-size:14px;width:100%;">
		<tbody>
			<tr>
				<td style="background-color:#A3DBA8;padding:5px;" colspan="2">Tanggal Pemberitahuan Putusan PK</td>
			</tr>
		</tbody>
	</table>
	<div style="padding:1px;"></div>
	<input type="hidden" id='close_form' value="Kembali" class="btn">
	<div class="cssTable" style="margin:0px;padding:0px;">
		<table id="tableinfo" style="font-size:14px;width:100%;">
			<col width="5%" />
			<col width="25%" />
			<col width="35%" />
			<col width="15%" />
			<tbody>
				<tr>
					<td>No</td>
					<td>Status</td>
					<td>Nama</td>
					<td>Tanggal</td>
				</tr>
				<?php
				if($infopkdetil!=''){
					if($infopkdetil->num_rows>0){
						$i=1;
						foreach ($infopkdetil->result() as $row) {
							echo '<tr>';
								echo '<td>'.$i.'</td>';
								echo '<td>'.$row->status_pihak_text.'('.$row->pihak_asal_text.')</td>';
								echo '<td>'.$row->pihak_nama.'</td>';
								echo '<td>'.$this->tanggalhelper->convertDayDate($row->pemberitahuan_putusan_pk).'</td>';
							echo '</tr>';
							$i++;
						}
					}
				}
				?>
			</tbody>
		</table>
	</div>
</div>
<script type="text/javascript">
$('#detilpk').on('click', '#close_form', function(event) {
	openLoadingDialog();
	window.open('<?php echo $history;?>','_self');	
})

$('#detilpk').on('click', '#goback', function(event) {
	openLoadingDialog();
	window.open('<?php echo $main_history;?>','_self');
	closeLoading()
})
closeLoading();
</script>
