<?php
if($this->session->userdata('is_logged_in')===FALSE){
            redirect('login');
}
?>
<div class="templatepopcentering" style="width:500px;margin-top: 1%;">
        <div id='pop' style="border: 1px solid #ffffff;">
            <div class="detil" style="padding: 2px;background-color: white;">         
            <form id="frm_relaas_akta" class="templatepopform" method="post" action="<?php echo base_url().'c_template_agama_pk/cetak_akta_pk';?>">
            <table id="" >              
                <tr><td colspan="2" class="templatepoptitle">
            <?php 
                $i=0;
                foreach ($template->result() as $template){
                    if ($i=='0'){
                        $judul=$template->namatemplate;
                        $judul=explode("Oleh",$judul);
                        $jnsperkara=$template->jnsperkara;
                    }
                }
                    echo strtoupper($judul[0]."<br/>Perkara ".$jnsperkara);
            ?>
                </td></tr>
                <tr>
                    <td class="templatepopleftcol">Pihak Pemohon PK</td>
                        <td style="font-size:13px; padding-left:10px"><?php echo $namapihak;?>
                    </td>
                </tr>
                <tr>
                    <td class="templatepopleftcol">Akta PK<font color=red>*</font></td>
                    <td>
                        <input type="hidden" id="pihakasal" name = 'pihakasal' value="<?php echo $pihakasal; ?>">
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="jenisAkta" id="jenisAkta" class="custom-dropdown__select custom-dropdown__select--white">
                                <?php 
                                if ($jenisaktapk==1) {                                 
                                        echo '<option value="-1">Pilih Jenis Akta</option>';
                                        echo '<option value="1">Akta Permohonan PK Penggugat</option>';
                                        echo '<option value="2">Akta Permohonan PK Kuasa Penggugat</option>';
                                        echo '<option value="3">Akta Permohonan PK (Melalui Kuasa Insidentil)</option>';
                                        echo '<option value="4">Akta Permohonan PK Secara Prodeo</option>';
                                        echo '<option value="41">Akta Pencabutan Permohonan PK, SEBELUM berkas dikirim ke MA</option>';
                                        echo '<option value="42">Akta Pencabutan Permohonan PK, SETELAH berkas dikirim ke MA</option>';
                                }elseif ($jenisaktapk==2) {
                                        echo '<option value="21" selected>Tanda Terima Memori PK</option>';
                                }elseif ($jenisaktapk==3) {
                                        echo '<option value="31" selected>Tanda Terima Kontra Memori PK</option>';
                                }else {
                                        echo '<option value="-1">Tidak ada Template</option>';
                                }
                                ?>                                
                            </select>
                        </span>
                    </td>
                </tr>                                
                <tr>
                    <td class="templatepopleftcol">Terhadap Putusan<font color=red>*</font></td>
                        <td style="">
                            <span class="custom-dropdown custom-dropdown--emerald">
                                <select style='width:275px;'  name="putusan" id="putusan" class="custom-dropdown__select custom-dropdown__select--white">                                
                                    <?php 
                                        if($dataPutusan != ''){
                                            if($dataPutusan->num_rows>0){
                                                if($dataPutusan->num_rows>1){
                                                    echo '<option value="-1">Silakan Pilih Terhadap Putusan</option>';
                                                }foreach ($dataPutusan->result() as $row) {
                                                    $idPut = base64_encode($this->encrypt->encode($row->idPut));
                                                    echo "<option value='".$idPut."'>".$this->templatehelper->standradnaming($row->tahapan)." - Nomor: ". $row->nomorPerkara ." - Tgl Putus : ".$this->templatehelper->convertKeTglIndo($row->tglPutus) ." </option>";
                                                }
                                            }else{
                                                echo '<option value="-1">Data Putusan Tidak Ada</option>';
                                            }
                                        }else{
                                            echo '<option value="-1">Data Putusan Tidak Ada</option>';
                                        }
                                    ?>
                                </select>
                            </span>
                    </td> 
                </tr>                                                                                              
                <tr>
                    <td class="templatepopleftcol">Penanda Tangan Akta<font color=red>*</font></td>
                    <td>
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="penandaT" id="penandaT"  class="custom-dropdown__select custom-dropdown__select--white">                                
                                <?php                                
                                    if($listPembuatAkta != ''){
                                        if($listPembuatAkta->num_rows>0){
                                            foreach ($listPembuatAkta->result() as $row) {
                                                $id = base64_encode($this->encrypt->encode($row->id));
                                                echo "<option value='".$id."'>".$this->templatehelper->standradnaming($row->namaPanitera)."</option>";
                                            }
                                        }
                                    }
                                ?>                                                                                                
                            </select>
                        </span>
                    </td> 
                </tr>                                   
                <tr>
                    <td colspan="2" style="background:white;" align="center">
                        <input type="hidden" id="enc" name = 'enc' value="<?php echo $enc; ?>">                        
                        <input type="hidden" id="encpemohon" name = 'encpemohon' value="<?php echo $encpemohon; ?>">
                        <input type="button" id="kembali" value="Kembali" class="btn">
                        <input type="submit" id="print_btn" value="Cetak" class="btn">
                    </td>
                </tr>
            </table>
        </div>
    </div>
</div>

<script type="text/javascript">
$('#kembali').closingFormWin();

$('#frm_relaas_akta').submit(function(e) {
        
    var putusan = $('#putusan').val();
    if(putusan==-1){
        message_error_show('Silahkan Pilih Terhadap Putusan');
        e.preventDefault();
    }
    
    var jenisAkta=$('#jenisAkta').val();
    if(jenisAkta==-1){
        message_error_show('Silahkan Pilih Jenis Akta PK');
        e.preventDefault();
    }
    
});
</script>