<?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_pid_pk" class="templatepopform" method="post" action="<?php echo base_url().'c_template_tun_pemberitahuan_kontra_memori_pk/cetak_relass_kontra_memori_pk';?>">
            <table id="" style="padding:10px;"> 
            <tr><td colspan="2" style="background:#5fb85c;padding:10px;color:#fff;text-align:center;">
            <?php 
                $i=0;
                foreach ($template->result() as $template)
                {
                    if ($i=='0')
                    {
                        $judul=$template->namatemplate;
                        $judul=explode("Kepada",$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;"><span>
                    <?php 
                    if($info != ''){
                        if($info->num_rows>0){
                            foreach ($info->result() as $row) {                                
                                echo $this->templatehelper->standradnaming($row->pihak_nama)."</br>";
                                //echo "Diwakili oleh: <b>".$this->templatehelper->standradnaming($row->diwakili)."</b></br>";
                                }
                            }
                        }
                    ?>
                    </span>
                </td>
            </tr> 
            <tr>
                <td class="templatepopleftcol">Pembuat Penetapan<font color=red>*</font></td>
                    <td style="">
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="pembuat" id="pembuat" class="custom-dropdown__select custom-dropdown__select-white">
                                <?php 
                                    if($info_penadatangan != ''){
                                        if($info_penadatangan->num_rows>0){
                                            foreach ($info_penadatangan->result() as $row) {
                                                $id = base64_encode($this->encrypt->encode($row->id));
                                                echo "<option value='".$id."'>".$row->pejabat.' - '.$this->templatehelper->standradnaming($row->pw)."</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)."&nbsp;Nomor: ". $row->nomorPerkara .".&nbsp  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">Nama Jurusita/JSP<font color=red>*</font></td>
                <td>
                   <span class="custom-dropdown custom-dropdown-emerald">
                        <select style='width:275px;'  name="jurusita" id="jurusita"  class="custom-dropdown__select custom-dropdown__select--white">                                
                            <?php                                
                               /* if($listJurusita != ''){
                                    if($listJurusita->num_rows>0){
                                        if($listJurusita->num_rows>1){
                                            echo '<option value="-1">Pilih Nama Jurusita/JSP</option>';
                                        }foreach ($listJurusita->result() as $row) {
                                            $id = base64_encode($this->encrypt->encode($row->id));
                                            echo "<option value='".$id."'>".$this->templatehelper->standradnaming($row->nama_gelar)."</option>";
                                        }
                                    }else{
                                        echo '<option value="-1">Data Jurusita/JSP Tidak Ada</option>';
                                    }
                                }else{
                                    echo '<option value="-1">Data Jurusita/JSP Tidak Ada</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="button" id="kembali" value="Kembali" class="btn">
                    <input type="submit" id="print_btn" value="Cetak" class="btn">
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<script type="text/javascript">

$('#kembali').closingFormWin();

$("tr.row_ph").hide();

$("#jenisAkta").change(function(){
    if(($(this).val()==1)||($(this).val()==2))
    $("tr.row_terdakwa").show();
    else $("tr.row_terdakwa").hide();
})

$("#jenisAkta").change(function(){
    if(($(this).val()==3))
    $("tr.row_ph").show();
    else $("tr.row_ph").hide();
})
$("#jenisAkta").change(function(){
    if(($(this).val()==4))
    $("tr.row_jpu").show();
    else $("tr.row_jpu").hide();
})


$('#frm_relaas_pid_pk').submit(function(e) {
    var jenisAkta = $('#jenisAkta').attr('value');
    var jurusita = $('#jurusita').attr('value');
    if(jurusita==-1){
        message_error_show('Silahkan Pilih Nama Jurusita/JSP');
        e.preventDefault();
    }
    if(jenisAkta==-1){
        message_error_show('Silahkan Pilih Jenis Akta Permintaan Peninjauan Kembali');
        e.preventDefault();
    }
    var pembuat = $('#pembuat').val();
    if(pembuat == -1){
        message_error_show('Silahkan Pilih Pejabat Pembuat AKTA');
        e.preventDefault();
    }
    var putusan = $('#putusan').val();
    if(putusan == -1){
        message_error_show('Silahkan Pilih Tahapan Putusan');
        e.preventDefault();
    }

    if((jenisAkta==1)){
        var terdakwa = $('#terdakwa').attr('value');
        if(terdakwa == -1){
            message_error_show('Silahkan Pilih terdakwa');
            e.preventDefault();
        }
    }

    if((jenisAkta==2)){
        var terdakwa = $('#terdakwa').attr('value');
        if(terdakwa == -1){
            message_error_show('Silahkan Pilih terdakwa');
            e.preventDefault();
        }
    }

    if((jenisAkta==3)){
        var ph = $('#ph').attr('value');
        if(ph == -1){
            message_error_show('Silahkan Pilih Penasihat Hukum');
            e.preventDefault();
        }
    }
    
});
</script>