<?php
if($this->session->userdata('is_logged_in')===FALSE){
    redirect('login');
}
?>

<div class="centering" style="width:500px;margin-top: 1%;z-index:-100">
     <div id='pbt' style="border: 1px solid #ffffff;">
        <div class="detil" style="padding: 2px;background-color: white;">
        <form id="frm_pemb_put_pdt" class="templatepopform" method="" action="">
            <table style="padding:5px;width:100%">
                <colgroup>
                    <col width="30%">
                    <col width="70">
                </colgroup>
                <tbody>
                    <tr>
                        <td colspan="2" class="templatepoptitle"><?php echo strtoupper('Pemberitahuan Isi Putusan');?></td>
                    </tr>    
                    <tr>
                        <td class="templatepopleftcol">Pilih Surat <font color=red>*</font></td>
                    
                        <td>
                            <span class="custom-dropdown custom-dropdown--emerald">
                                <select style='width:250px;'  name="blangko_pbt" id="blangko_pbt" class="custom-dropdown__select custom-dropdown__select--white">                                
                                    <?php
                                    if($blangko_pbt->num_rows==0){
                                        echo "<option value='0'>-- Blanko Tidak Ditemukan--</option>";
                                    }elseif($blangko_pbt->num_rows>1){
                                        echo "<option value='-1'>--Pilih Blanko--</option>";
                                    }
                                        foreach($blangko_pbt->result() as $data){
                                    ?>
                                            <option value='<?php echo $data->kode; ?>'><?php echo $this->templatehelper->ucname($data->nama); ?></option><?php
                                        }
                                    ?>
                                </select> 
                            </span>
                        </td> 
                    </tr>
                    <tr>
                        <td class="templatepopleftcol">Nama Jurusita / Jurusita Pengganti<font color=red>*</font></td>
                        <td>
                            <span class="custom-dropdown custom-dropdown--emerald">
                                <select style='width:250px;'  name="jursit" id="jursit" class="custom-dropdown__select custom-dropdown__select--white">
                                    <?php
                                    if($datajurusita->num_rows==0){
                                        echo "<option value='0'>--Masukan Penetapan Jurusita--</option>";
                                    }elseif($datajurusita->num_rows>1){
                                        echo "<option value='-1'>--Pilih Jurusita--</option>";
                                    }
                                    foreach($datajurusita->result() as $data){
                                    ?><option value='<?php echo $data->id.'|'.$data->jabatan; ?>'><?php echo $data->nama_gelar; ?></option><?php
                                    }
                                    ?>
                                </select>
                            </span>
                        </td> 
                    </tr>
             
                        <tr>
                            <td colspan="2" style="background:white;" align="center">
                                <input type="button" id="kembali" value="Kembali" class="btn">
                                <input type="button" id="print_btn" onClick='print();' value="Cetak" class="btn">
                            </td>
                        </tr>
                </tbody>
            </table>
        </form>
        </div>
    </div>
</div>
<script type="text/javascript">

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


$("#blangko_pbt").change(function(){
    var pbt=$('#blangko_pbt').val()

});

function print(){
    
    var jursit = $('#jursit').val();
    var pbt=$('#blangko_pbt option:selected').attr('value')
    if (pbt=='-1') {
        message_show('Pilih Jenis PBT')
        return
    }
    
    var str = $('#jursit option:selected').attr('value');
    if (str==0) {
        message_show('Jurusita Belum Ditetapkan')
        return
    }else if (str==-1) {
        message_show('Jurusita Belum Dipilih')
        return
    }
    var temp = str.split("|");
    var jursit = temp[0];

    var jursitLabel = temp[1];
    var id = '<?php echo $enc; ?>';
    var idpihak = '<?php echo $encidpihak; ?>';

    var obj = new Object();
    obj.idPerkara = id;
    obj.idPihak  = idpihak;
    obj.idJurusita = jursit;
    obj.dokumen = pbt;
    var data= encodeURIComponent(JSON.stringify(obj));

    window.open('<?php echo base_url("c_template_agama_perdata_pemberitahuan_putusan/cetak_pemberitahuan_putusan_tergugat")?>/'+data,'_self');
};


</script>