<?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_mil_akta_banding_pidana/cetak_akta_banding';?>">
			<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">Akta Banding<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($idakta==1 AND $pihakasal==2){                                        
                                        echo '<option value="1">Akta Permohonan Banding (Terdakwa)</option>';
                                    }elseif($idakta==1 AND $pihakasal==1){
                                        echo '<option value="2">Akta Permohonan Banding (Oditur)</option>';
                                    }else{
                                        echo '<option value="-1">Pilih Jenis Akta</option>';
                                    }
                                ?>                                
                            </select>
                        </span>
                    </td>
                </tr>
                <?php if($pihakasal==1){ ?>
                <tr class="tr_terdakwa">
                    <td class="templatepopleftcol">Nama Terdakwa<font color=red>*</font></td>
                    <td>
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="idterdakwa" id="idterdakwa"  class="custom-dropdown__select custom-dropdown__select--white">
                                <?php                                
                                    if($listAllTerdakwa != ''){
                                        if($listAllTerdakwa->num_rows>0){
                                            if($listAllTerdakwa->num_rows>1){
                                                echo '<option value="-1">Pilih Nama Terdakwa</option>';
                                            }foreach ($listAllTerdakwa->result() as $row) {
                                                $IDPihak = base64_encode($this->encrypt->encode($row->IDPihak));
                                                echo "<option value='".$IDPihak."' atttgl='".$this->templatehelper->convertKeTglDatepicker($row->tglPemberitahuan)."'>".$this->templatehelper->standradnaming($row->nama)."</option>";                                                    
                                            }
                                        }else{
                                            echo "<option value='-1'>Terdakwa Tidak Langsung Mengajukan Permohonan Banding</option>";
                                        }
                                    }else{
                                        echo "<option value='-1'>Terdakwa Tidak Langsung Mengajukan Permohonan Banding</option>";
                                    }
                                ?>                                 
                            </select>
                        </span>
                    </td> 
                </tr> 
                <?php } ?> 
                <?php if($pihakasal==2){ ?>   
                <tr class="tr_terdakwa">
                    <td class="templatepopleftcol">Nama Terdakwa<font color=red>*</font></td>
                    <td>
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="idterdakwa" id="idterdakwa"  class="custom-dropdown__select custom-dropdown__select--white">
                                <?php                                
                                    if($listTerdakwa != ''){
                                        if($listTerdakwa->num_rows>0){
                                            if($listTerdakwa->num_rows>1){
                                                echo '<option value="-1">Pilih Nama Terdakwa</option>';
                                            }foreach ($listTerdakwa->result() as $row) {
                                                $IDPihak = base64_encode($this->encrypt->encode($row->IDPihak));
                                                echo "<option value='".$IDPihak."' atttgl='".$this->templatehelper->convertKeTglDatepicker($row->tglPemberitahuan)."'>".$this->templatehelper->standradnaming($row->nama)."</option>";                                                    
                                            }
                                        }else{
                                            echo "<option value='-1'>Terdakwa Tidak Langsung Mengajukan Permohonan Banding</option>";
                                        }
                                    }else{
                                        echo "<option value='-1'>Terdakwa Tidak Langsung Mengajukan Permohonan Banding</option>";
                                    }
                                ?>                                 
                            </select>
                        </span>
                    </td> 
                </tr> 
                <?php } ?>          
                <tr class="tr_kuasa" style="display:none;">
                    <td class="templatepopleftcol">Penasihat Hukum<font color=red>*</font></td>
                    <td>
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="idpenasihat" id="idpenasihat"  class="custom-dropdown__select custom-dropdown__select--white">                                
                                <?php                                
                                if($listKuasa != ''){
                                    if($listKuasa->num_rows>0){
                                        if($listKuasa->num_rows>1){
                                            echo '<option value="-1">Pilih Kuasa Hukum</option>';
                                        }
                                        foreach ($listKuasa->result() as $row) {
                                            $IDPihak = base64_encode($this->encrypt->encode($row->IDPihak));
                                                echo "<option value='".$IDPihak."' atttgl='".$this->templatehelper->convertKeTglDatepicker($row->tglPemberitahuan)."'>".$this->templatehelper->standradnaming($row->nama)."</option>";
                                        }                                        
                                    }else{
                                        echo "<option value='-1'>Mohon Mengisikan Kuasa Hukum Terlebih Dahulu</option>";
                                    }
                                }else{
                                    echo "<option value='-1'>ohon Mengisikan Kuasa Hukum Terlebih Dahulu</option>";
                                }
                                ?>                                 
                            </select>
                        </span>
                    </td> 
                </tr> 
                <?php 
                    if($pihakasal==1){
                        echo '<tr>';
                        echo '<td class="templatepopleftcol">Oditur<font color=red>*</font></td>';
                        echo '<td>';
                            echo '<span class="custom-dropdown custom-dropdown--emerald">';
                            echo '<select style="width:275px;"  name="idpenuntut" id="idpenuntut"  class="custom-dropdown__select custom-dropdown__select--white">';
                                    ?>
                                    <?php                                
                                        if($listPenuntut != ''){
                                            if($listPenuntut->num_rows>0){
                                                if($listPenuntut->num_rows>1){
                                                    echo '<option value="-1">Pilih Nama Penuntut Umum</option>';
                                                }foreach ($listPenuntut->result() as $row) {
                                                    $IDPihak = base64_encode($this->encrypt->encode($row->IDPihak));
                                                    echo "<option value='".$IDPihak."' atttgl='".$this->templatehelper->convertKeTglDatepicker($row->tglPemberitahuan)."'>".$this->templatehelper->standradnaming($row->nama)."</option>";
                                                }
                                            }else{
                                                echo "<option value='-1'>Mohon Mengisikan Penuntut Umum Terlebih Dahulu</option>";
                                            }
                                        }else{
                                            echo "<option value='-1'>Mohon Mengisikan Penuntut Umum Terlebih Dahulu</option>";
                                        }                                                                                                                             
                            echo '</select>';
                            echo '</span>';
                        echo '</td>';
                    echo '</tr>';
                    }
                ?>                                                   
                <tr class="trPermintaan" style="display:none;">
                    <td class="templatepopleftcol">Permintaan Banding<font color=red>*</font></td>
                    <td>
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="bandingMelalui" id="bandingMelalui"  class="custom-dropdown__select custom-dropdown__select--white">
                                <option value='-1'>Pilih Banding Melalui</option>
                                <option value='1'>Kalapas</option>
                                <option value='2'>Karutan</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 class="templatepopleftcol">Tanggal Akta<font color=red>*</font></td>                    
                    <td>                        
                        <input style="background-color:#8;padding:5px;" value="<?php echo $tglpermohonanindo;?>" disabled>
                    </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="inputpemberitahuan" name = 'inputpemberitahuan' value="<?php echo $tglpermohonan; ?>">                        
						<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 jenisAkta = $('#jenisAkta').val();

    if(jenisAkta==1 && $(pihakasal==2)){    
        var terdakwa = $('#idterdakwa').val();
        if(terdakwa==-1 || terdakwa==''){
            message_error_show('Silahkan Pilih Nama Terdakwa Yang Melakukan Banding');
            e.preventDefault();
        }
    } 
    
    if(jenisAkta==2 && $(pihakasal==1)){
        var penuntut = $('#idpenuntut').val();
        if(penuntut==-1){
            message_error_show('Silahkan Pilih Oditur Yang Mengajukan Banding');
             e.preventDefault();
        }
    }   
    var penandaT = $('#penandaT').val();
    if(penandaT==-1){
        message_error_show('Silahkan Pilih Pembuat Akta Banding');
         e.preventDefault();
    }
    var tglakta = $('#inputpemberitahuan').val();
    if(tglakta=='-' || tglakta==''){
        message_error_show('Silahkan Rekam Tanggal Akta Terlebih Dahulu');
         e.preventDefault();
    }
    var jenisAkta=$('#jenisAkta').val();
    if(jenisAkta==-1){
        message_error_show('Silahkan Pilih Jenis Akta Banding');
        e.preventDefault();
    }
    
});
</script>