<link rel="stylesheet" href="<?php echo base_url('resources/css/bootstrap.css') ?>" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<?php echo base_url('resources/css/AdminLTE.min.css') ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
<div style="font-size:14px;">
	<table id='infoPerkara' style="font-size:14px;">
		<col width="15%">
		<col width="">
		<col width="290px">
		<tbody>
			<?php
			$encputsela='';
			$tglPutusanSela = '';
			$keberatan = '';
			$amar_sela = '';
			$E_doc = '';
			$pemberitahuanPenggugat = '';
			$pemberitahuanTergugat = '';
			$pemberitahuanIntervensi = '';
			$isi = False;
			$urutan=1;
			if($putusan !=''){
				$jumdata=$putusan->num_rows();
				if($jumdata>0){
					foreach ($putusan->result() as $row) {
						$encputsela=base64_encode($this->encrypt->encode($row->putusansela_id));
						$tglPutusanSela = $this->tanggalhelper->convertDayDate($row->tanggal_putusan_sela);
						if(($row->is_keberatan_diterima)==1){
							$keberatan = 'Keberatan Diterima';
						}elseif(($row->is_keberatan_diterima)==2){
							$keberatan = 'Keberatan Ditolak';
						}else{
							$keberatan = '';
						}
						$amar_sela = $row->amar_sela;
						$E_doc = $row->amar_sela_dok;
						$pemberitahuanPenggugat = $this->tanggalhelper->convertDayDate($row->pemberitahuan_putusan_sela_pihak1);
						$pemberitahuanTergugat = $this->tanggalhelper->convertDayDate($row->pemberitahuan_putusan_sela_pihak2);
						$pemberitahuanIntervensi = $this->tanggalhelper->convertDayDate($row->pemberitahuan_putusan_sela_pihak3);
						$pemberitahuanTurutTergugat = $this->tanggalhelper->convertDayDate($row->pemberitahuan_putusan_sela_pihak4);
						$tgldaftar=$tglpendaftaran;
						$isi = True;
			if ($jumdata>1){
			?>
			<tr><td colspan="3" style="background-color:#A3DBA8;padding:5px;"><strong>Putusan Sela ke <?php echo $urutan; ?></td></tr>
			<?php } ?>
			<tr>
				<td id="first-child">Tanggal Putusan Sela</td>
				<td><?php echo $tglPutusanSela;?></td>
				<td style="text-align:right;">
				<?php
				if ($this->authorization->HasRuleHakimPanitera($idperkara)){
					if($isi==True && $urutan==$jumdata){
					echo '<a href="#" onClick="popup_form(\''.base_url('add_putusan_sela/'.$enc.'/edit/'.$encputsela).'\')" class="btn btn-default btn-sm"><i class="fa fa-legal"></i> Edit Putusan Sela</a>';
						if($alur_perkara_id==120){
							echo '|[ <a href="#" onClick="cetakPutselMil()">Cetak Putusan Sela</a> ]';					
						}
					}
				}
				?>				
				</td>
			</tr>
			<?php if ($alur_perkara_id==111){ ?>
			<tr>
				<td id="first-child">Hasil Putusan Sela</td>
				<td colspan="2"><?php echo  $keberatan; ?></td>
			</tr>
			<?php } ?>
			<tr>
				<td id="first-child">Amar Putusan Sela </td>
				<td colspan="2"><?php echo $amar_sela;?></td>
			</tr>
			<tr>
				<td id="first-child">E-Doc Putusan Sela</td>
				<td><?php 
				$baseurl=$E_doc;
                if (($baseurl) and (file_exists($baseurl))){
                    echo "<a target='_new' href=$baseurl>Unduh Dokumen</a>";
                }else{
                    echo "<span style='color:red;font-weight:bold'>Dokumen Belum Ada</span>";
                }
				?></td>
				<td style="text-align:right;">
				<?php
				if ($this->authorization->HasRuleHakimPanitera($idperkara)){
					if($isi==True && $urutan==$jumdata){					
					echo '<a href="#" style="color:white;margin-bottom:15px" onClick="popup_form(\''.base_url('fileupload/'.$enc.'/putsela/'.$encputsela.'/'.$urutan).'\')" class="btn btn-warning btn-sm"><i class="fa fa-file-word-o"></i> Edit E-Dokumen</a>';					
					}
				}
				?>				
				</td>
				
			</tr>
                    <?php
                    if($this->authorization->HasRuleHakimPanitera($idperkara)) {
	                   	if ($alur_perkara_id==='111') {
	                    ?>
						<tr>
							<td id="first-child">Cetak Dokumen Putusan</td>
							<td colspan="2">
			                    <span class="custom-dropdown custom-dropdown--emerald">
			                    <select style="width:500px;z-index:99999" class="custom-dropdown__select custom-dropdown__select--white">
			                    <option>Pilih Dokumen Putusan Sela</option>
									<option onClick=cetakPutusanSelaKeberatanPutusAkhir();>Putusan Sela Pidana Umum- Keberatan diputus bersama Putusan Akhir</option>
									<option onClick=cetakPutusanSelaKeberatanDiterima();>Putusan Sela Pidana Umum- Keberatan Diterima</option>
									<option onClick=cetakPutusanSelaKeberatanTidakDiterima();>Putusan Sela Pidana mum- Keberatan Tidak Diterima</option>
			                    </select>
			                    </span>
							</td>
						</tr>			
	                    <?php
	                    }elseif ($alur_perkara_id==='9') {
	                    ?>
							<tr>
								<td id="first-child">Cetak Dokumen Putusan Sela</td>
								<td colspan="2">
				                    <span class="custom-dropdown custom-dropdown--emerald"><img src="<?php echo base_url();?>resources/img/nm_icon_doc.gif">
				                    <select style="width:250px;z-index:99999" class="custom-dropdown__select custom-dropdown__select--white">
				                    <option>Pilih Dokumen Putusan Sela</option>
										<option onClick=cetakPutusanSela1('<?php echo $encputsela;?>');>Putusan Sela - Pencabutan Gugatan (Dikabulkan)</option>
										<option onClick=cetakPutusanSela2('<?php echo $encputsela;?>');>Putusan Sela - Pencabutan Gugatan (Ditolak)</option>
										<option onClick=cetakPutusanSela3('<?php echo $encputsela;?>');>Putusan Sela - Penundaan Pelaksanaan KTUN (Dikabulkan) </option>
										<option onClick=cetakPutusanSela4('<?php echo $encputsela;?>');>Putusan Sela - Penundaan Pelaksanaan KTUN (Ditolak) </option>
										<option onClick=cetakPutusanSela5('<?php echo $encputsela;?>');>Putusan Sela - Penetapan Pihak Intervensi (Dikabulkan) </option>
										<option onClick=cetakPutusanSela6('<?php echo $encputsela;?>');>Putusan Sela - Penetapan Pihak Intervensi (Ditolak) </option>
										<option onClick=cetakPutusanSela7('<?php echo $encputsela;?>');>Putusan Sela - Gugatan Tidak Dapat Diterima</option>
				                    </select>
				                    </span>
								</td>
							</tr>	
						<?php
	                    }elseif ( ($alur_perkara_id==='120') AND ($alur_perkara_id==='121') ) {
	                    ?>
							<tr>
								<td id="first-child">Cetak Dokumen Putusan Sela MILITER</td>
								<td colspan="2">
				                    <span class="custom-dropdown custom-dropdown--emerald">
				                    <select style="width:500px;z-index:99999" class="custom-dropdown__select custom-dropdown__select--white">
				                    <option>Pilih Dokumen Putusan Sela</option>
										<option onClick=cetakPutusanSelaKeberatanPutusAkhir();>belum tak bikin yaaaaaa</option>
				                    </select>
				                    </span>
								</td>
							</tr>			
					<?php
						}
					}
						?>

			<tr>
				<td id="first-child">
				<?php 
				echo "Pemberitahuan Putusan Sela Kepada ".$this->nativesession->getStatusPihak(10,$alur_perkara_id,1,$jenis_perkara_id);
				?>
				</td>
				<td colspan="2"><?php echo $pemberitahuanPenggugat;?></td>
			</tr>
			<tr>
				<td id="first-child">
				<?php 
				echo "Pemberitahuan Putusan Sela Kepada ".$this->nativesession->getStatusPihak(10,$alur_perkara_id,2,$jenis_perkara_id);
				?>
				</td>
				<td colspan="2"><?php echo $pemberitahuanTergugat;?></td>
			</tr>
			<?php
			if($alur_perkara_id<100 AND $alur_perkara_id!=2 AND $alur_perkara_id!=8 AND $alur_perkara_id!=10 AND $alur_perkara_id!=11){ ?>			
			<tr>
				<td id="first-child"><?php echo "Pemberitahuan Putusan Sela Kepada ".$this->nativesession->getStatusPihak(10,$alur_perkara_id,3,$jenis_perkara_id);?></td>
				<td colspan="2"><?php echo $pemberitahuanIntervensi;?></td>
			</tr>
			<?php if($alur_perkara_id<100 AND $alur_perkara_id!=9 ){ ?>
			<tr>
				<td id="first-child"><?php echo "Pemberitahuan Putusan Sela Kepada ".$this->nativesession->getStatusPihak(10,$alur_perkara_id,4,$jenis_perkara_id);?></td>
				<td colspan="2"><?php echo $pemberitahuanTurutTergugat;?></td>
			</tr>
			<?php } 
				} 
			$urutan++;
					}
				}
			}
			?>
		</tbody>
	</table>
<table id="infoPerkara" style="font-size:14px;width:100%;">
	<?php 
	if($this->authorization->HasRuleHakimPanitera($idperkara)) {
	    echo '<tr>';
	        echo '<td style="text-align:center">';
	        echo '<a href="#" style="color:white" onClick="popup_form(\''.base_url('add_putusan_sela/'.$enc.'/add').'\')" class="btn btn-success btn-sm"><i class="fa fa-legal"></i> Tambah Putusan Sela</a>';	        
	       echo '</td>';
	    echo '</tr>';
    } ?>
</table>

</div>
<script type="text/javascript">
function cetakPutusanSelaKeberatanPutusAkhir(){
	window.open('<?php echo base_url("c_template_putusan_pidana/cetak_putusan_sela_keberatan_bersama_putusan_akhir/")."/".$enc;?>','_self');
}
function cetakPutusanSelaKeberatanDiterima(){
	window.open('<?php echo base_url("c_template_putusan_pidana/cetak_putusan_sela_keberatan_diterima/")."/".$enc;?>','_self');
}
function cetakPutusanSelaKeberatanTidakDiterima(){
	window.open('<?php echo base_url("c_template_putusan_pidana/cetak_putusan_sela_keberatan_tidak_diterima/")."/".$enc;?>','_self');
}
function cetakPutusanSela1(idSela){
	window.open('<?php echo base_url("c_template_tun/cetak_putusan_sela/")."/".$enc."/pencabutan_gugatan_dikabulkan/";?>'+idSela,'_self');
}
function cetakPutusanSela2(idSela){
	window.open('<?php echo base_url("c_template_tun/cetak_putusan_sela/")."/".$enc."/pencabutan_gugatan_ditolak/";?>'+idSela,'_self');
}
function cetakPutusanSela3(idSela){
	window.open('<?php echo base_url("c_template_tun/cetak_putusan_sela/")."/".$enc."/ktun_dikabulkan/";?>'+idSela,'_self');
}
function cetakPutusanSela4(idSela){
	window.open('<?php echo base_url("c_template_tun/cetak_putusan_sela/")."/".$enc."/ktun_ditolak/";?>'+idSela,'_self');
}
function cetakPutusanSela5(idSela){
	window.open('<?php echo base_url("c_template_tun/cetak_putusan_sela/")."/".$enc."/penetapan_intervensi_dikabulkan/";?>'+idSela,'_self');
}
function cetakPutusanSela6(idSela){
	window.open('<?php echo base_url("c_template_tun/cetak_putusan_sela/")."/".$enc."/penetapan_intervensi_ditolak/";?>'+idSela,'_self');
}
function cetakPutusanSela7(idSela){
	//window.open('<?php echo base_url("c_template_putusan_tun/cetak_putusan_sela/")."/".$enc."/gugatan_tidak_dapat_diterima/";?>'+idSela,'_self');
}
function cetakPutselMil(){
	window.open('<?php echo base_url("c_template_putusan_mil/cetak_putusan_sela_mil")."/".$enc;?>','_self');
}
closeLoading();
</script>
