<div class="templatepopcentering" style="width:500px;margin-top: 1%;">
        <div id='pop' style="border: 1px solid #ffffff;">
        <div class="detil" style="padding: 4px;background-color: white;"> 
		<form id="frm_relaas_akta" style="padding: 4px;background:white;margin:0;" method="post" action="<?php echo base_url().'c_template_mil_akta_banding_pidana/cetak_relaas_banding';?>">
			<table id="" style="padding:5px;">				
                <tr><td colspan="2" style="background:#5fb85c;padding:10px;color:#fff;text-align:center;">
            <?php 
                echo strtoupper($judul."<br/>Cetak Relaas Perkara ".$jnsperkara);
            ?>
                </td></tr>
				<tr>
                    <td class="templatepopleftcol">Jenis Relaas 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($jenisrelas ==1 AND $pihakasal==1){
                                    echo "<option value='1'>Relaas Pemberitahuan Pernyataan Banding Kepada Oditur</option>";
                                }elseif($jenisrelas ==1 AND $pihakasal==2){
                                    echo "<option value='2'>Relaas Pemberitahuan Pernyataan Banding Kepada Terdakwa</option>";
                                }elseif($jenisrelas ==2 AND $pihakasal==1){
                                    echo "<option value='7'>Relaas Penerimaan Memori Banding Kepada Oditur</option>";
                                }elseif($jenisrelas ==2 AND $pihakasal==2){
                                    echo "<option value='8'>Relaas Penerimaan Memori Banding Kepada Terdakwa</option>";
                                }elseif($jenisrelas ==3 AND $pihakasal==1){
                                    echo "<option value='9'>Relaas Penyerahan Memori Banding Kepada Oditur</option>";
                                }elseif($jenisrelas ==3 AND $pihakasal==2){
                                    echo "<option value='10'>Relaas Penyerahan Memori Banding Kepada Terdakwa</option>";
                                }elseif($jenisrelas ==4 AND $pihakasal==1){
                                    echo "<option value='11'>Relaas Penerimaan Kontra Memori Banding Kepada Oditur</option>";
                                }elseif($jenisrelas ==4 AND $pihakasal==2){
                                    echo "<option value='12'>Relaas Penerimaan Kontra Memori Banding Kepada Terdakwa</option>";
                                }elseif($jenisrelas ==5 AND $pihakasal==1){
                                    echo "<option value='13'>Relaas Penyerahan Kontra Memori Banding Kepada Oditur</option>";                                    
                                }elseif($jenisrelas ==5 AND $pihakasal==2){
                                    echo "<option value='14'>Relaas Penyerahan Kontra Memori Banding Kepada Terdakwa</option>";
                                }elseif($jenisrelas ==6 AND $pihakasal==1){
                                    echo "<option value='3'>Relaas Pemberitahuan Inzage Kepada Oditur</option>";
                                }
                                elseif($jenisrelas ==6 AND $pihakasal==2){
                                    echo "<option value='4'>Relaas Pemberitahuan Inzage Kepada Terdakwa</option>";
                                }
                                elseif($jenisrelas ==7 AND $pihakasal==2){
                                    echo "<option value='5'>Relaas Pemberitahuan Putusan Banding Kepada Terdakwa</option>";
                                }
                                elseif($jenisrelas ==7 AND $pihakasal==1){
                                    echo "<option value='6'>Relaas Pemberitahuan Putusan Banding Kepada Oditur</option>";
                                }
                                ?>
                            </select>
                        </span>
                    </td>
                </tr>                 
                <?php
                if($pihakasal== 1){
                ?>
                    <tr class="trTerdakwa"  >
                        <td class="templatepopleftcol">Nama Terdakwa<font color=red>*</font></td>
                        <td>
                            <span class="custom-dropdown custom-dropdown--emerald">
                                <select style='width:275px;'  name="terdakwa" id="terdakwa"  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'>Data Terdakwa Tidak ada</option>";
                                            }
                                        }else{
                                            echo "<option value='-1'>Data Terdakwa Tidak ada</option>";
                                        }
                                    ?>                                 
                                </select>
                            </span>
                        </td> 
                    </tr>
                <?php 
                }
                ?>
                <?php if($pihakasal==2){
                ?>
                    <tr class="trTerdakwa"  >
                        <td class="templatepopleftcol">Nama Terdakwa<font color=red>*</font></td>
                        <td>
                            <span class="custom-dropdown custom-dropdown--emerald">
                                <select style='width:275px;'  name="terdakwa" id="terdakwa"  class="custom-dropdown__select custom-dropdown__select--white">
                                   <?php                                
                                        if($relaasTerdakwa != ''){
                                            if($relaasTerdakwa->num_rows>0){
                                                if($relaasTerdakwa->num_rows>1){
                                                    echo '<option value="-1">Pilih Nama Terdakwa</option>';
                                                }foreach ($relaasTerdakwa->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'>Data Terdakwa Tidak ada wooo</option>";
                                            }
                                        }else{
                                            echo "<option value='-1'>Data Terdakwa Tidak ada</option>";
                                        }
                                    ?>                                 
                                </select>
                            </span>
                        </td> 
                    </tr>
                <?php 
                }
                ?>                
                <?php 
                    if($pihakasal==1){
                        echo '<tr class="trPenuntut">';
                        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."'>".$this->templatehelper->standradnaming($row->nama)."</option>";
                                                }
                                            }else{
                                                echo "<option value='-1'>Mohon Mengisikan Penuntut Umum Terlebih Dahulu</option>";
                                            }
                                        }else{
                                            echo "<option value='-1'>ohon Mengisikan Penuntut Umum Terlebih Dahulu</option>";
                                        }                                                                                                                             
                            echo '</select>';
                            echo '</span>';
                        echo '</td>';
                    echo '</tr>';
                    }
                ?>                
                <tr class="trPembanding" style="display:none;">
                    <td class="templatepopleftcol">Pihak Pembanding<font color=red>*</font></td>
                    <td>
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="pembanding" id="pembanding"  class="custom-dropdown__select custom-dropdown__select--white">                                
                                <?php                                
                                    if($listPembanding != ''){
                                        if($listPembanding->num_rows>0){
                                            if($listPembanding->num_rows>1){
                                                echo '<option value="-1">Pilih Pihak Pembanding</option>';
                                            }foreach ($listPembanding->result() as $row) {
                                                $IDPihak = base64_encode($this->encrypt->encode($row->IDPihak));
                                                echo "<option value='".$IDPihak."' attPembanding1='".$row->penyerahan_kontra_banding."'attPembanding2='".$this->templatehelper->convertKeTglIndo($row->penyerahan_kontra_banding)."'>".$this->templatehelper->standradnaming($row->nama)."</option>";
                                                $tglserahindo = $this->templatehelper->convertKeTglIndo($row->penyerahan_kontra_banding);
                                                $tglserah = $row->penyerahan_kontra_banding;
                                            }
                                        }else{
                                            echo "<option value='-1'>Data Pembanding Tidak ada</option>";
                                        }
                                    }else{
                                        echo "<option value='-1'>Data Pembanding Tidak ada</option>";
                                    }
                                ?>                                                                 
                            </select>
                        </span>
                    </td> 
                </tr>
                <tr class="trterbanding" style="display:none;">
                    <td class="templatepopleftcol">Pihak Terbanding<font color=red>*</font></td>
                    <td>
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:275px;'  name="terbanding" id="terbanding"  class="custom-dropdown__select custom-dropdown__select--white">                               
                                <?php                                
                                    if($listTerbanding != ''){
                                        if($listTerbanding->num_rows>0){
                                            if($listTerbanding->num_rows>1){
                                                echo '<option value="-1">Pilih Pihak Terbanding</option>';
                                            }foreach ($listTerbanding->result() as $row) {
                                                $IDPihak = base64_encode($this->encrypt->encode($row->IDPihak));
                                                echo "<option value selected='".$IDPihak."' attTerbanding1='".$row->penerimaan_kontra_banding."'attTerbanding2='".$this->templatehelper->convertKeTglIndo($row->penerimaan_kontra_banding)."'>".$this->templatehelper->standradnaming($row->nama)."</option>";
                                                $tglmemoriindo = $this->templatehelper->convertKeTglIndo($row->penerimaan_kontra_banding);
                                                $tglmemori = $row->penerimaan_kontra_banding;
                                            }
                                        }else{
                                            echo "<option value='-1'>Data Terbanding Tidak ada</option>";
                                        }
                                    }else{
                                        echo "<option value='-1'>Data Terbanding Tidak ada</option>";
                                    }
                                ?>                                 
                            </select>
                        </span>
                    </td> 
                </tr>
                <tr>
                    <td class="templatepopleftcol">Tanggal Pemberitahuan<font color=red>*</font></td>                    
                    <td>                        
                        <input id='inputrelaasbanding' name='inputrelaasbanding' style="background-color:#8;padding:5px;padding-left:10px" value="<?php echo (empty($tglserahindo))? $tglpemberitahuanindo: $tglserahindo; ?>" disabled>
                        <input type="hidden" id="tglpemberitahuan" name = 'tglpemberitahuan' value="<?php echo (empty($tglserah))? $tglpemberitahuan: $tglserah; ?>">                          
                    </td>
                </tr>                
                <tr class="trinputpenerimaankontra" style="display:none;">
                    <td class="templatepopleftcol">Tanggal Penerimaan Kontra Memori<font color=red>*</font></td>                    
                    <td>
                        <input id='inputpenerimaankontra2' name='inputpenerimaankontra2' style="background-color:#8;padding:5px;padding-left:10px" value="<?php echo $tglmemoriindo; ?>" disabled>
                        <input type="hidden" id="inputpenerimaankontra1" name = 'inputpenerimaankontra1' value="<?php echo $tglmemori; ?>">
                    </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>
</div>

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

$('#terbanding').change(function(e){
    var terbanding = $('#terbanding').val(); 
    var tanggal1 = $('#terbanding :selected').attr('attTerbanding1');       
    var tanggal2 = $('#terbanding :selected').attr('attTerbanding2');
    if((tanggal1!='') || (terbanding!=-1)){
        $("#inputpenerimaankontra1").empty();  
        $('#inputpenerimaankontra1').val(tanggal1);
        $('#inputpenerimaankontra2').val(tanggal2);      
    }else{                  
        alert('Mohon Mengisikan Tanggal Penerimaan Kontra Banding');
        $("#inputpenerimaankontra1").empty();
        $("#inputpenerimaankontra2").empty();
    }
});
$('#pembanding').change(function(e){
    var terbanding = $('#pembanding').val(); 
    var tanggal1 = $('#pembanding :selected').attr('attPembanding1');       
    var tanggal2 = $('#pembanding :selected').attr('attPembanding2');
    if((tanggal1!='') || (pembanding!=-1)){
        $("#tglpemberitahuan").empty();  
        $('#tglpemberitahuan').val(tanggal1);
        $('#inputrelaasbanding').val(tanggal2);      
    }else{                  
        alert('Mohon Mengisikan Tanggal Penyerahan Kontra Banding');
        $("#tglpemberitahuan").empty();
        $("#inputrelaasbanding").empty();
    }
});

$("#jenisAkta").change(function(){
    if(($(this).val()==2)||($(this).val()==3)||($(this).val()==5)||($(this).val()==9)||($(this).val()==11))
    $("tr.tr_terdakwa").show();
    else $("tr.tr_terdakwa").hide();
})
$("#jenisAkta").change(function(){
    if(($(this).val()==1)||($(this).val()==4)||($(this).val()==6)||($(this).val()==8)||($(this).val()==10))
    $("tr.tr_penuntut").show();
    else $("tr.tr_penuntut").hide();
})
$("#jenisAkta").change(function(){
    if($(this).val()==7)
    $("tr.trPembanding").show();
    else $("tr.trPembanding").hide();
})
$("#jenisAkta").change(function(){
    if($(this).val()==7)
    $("tr.trterbanding").show();
    else $("tr.trterbanding").hide();
})
$("#jenisAkta").change(function(){
    if($(this).val()==7)
    $("tr.trinputpenyerahankontra").show();
    else $("tr.trinputpenyerahankontra").hide();
})
$("#jenisAkta").change(function(){
    if($(this).val()==7)
    $("tr.trinputpenerimaankontra").show();
    else $("tr.trinputpenerimaankontra").hide();
})
$("#jenisAkta").change(function(){
    if($(this).val()==7)
    $("tr.trTerdakwa").hide();
    $("tr.trPenuntut").hide();
})
$("#jenisAkta").change(function(){
    if($(this).val()==5)
    $("tr.trTerdakwa").show();
})
$("#jenisAkta").change(function(){
    if($(this).val()==6)
    $("tr.trPenuntut").show();
})

$('#frm_relaas_akta').submit(function(e) {
    var jenisAkta=$('#jenisAkta').val();
    var tglbanding=$('#inputrelaasbanding').val();
    if(tglbanding==''){
        message_error_show('Silahkan Isi Tanggal Relaas Pemberitahuan');
        e.preventDefault();
    }
    if((jenisAkta==2)||(jenisAkta==3)||(jenisAkta==5)||(jenisAkta==9)||(jenisAkta==11)){
        var terdakwa = $('#terdakwa').val();
        if(terdakwa==-1){
            message_error_show('Silahkan Pilih Nama Terdakwa');
            e.preventDefault();
        }
    }        
    if((jenisAkta==1)||(jenisAkta==4)||(jenisAkta==6)||(jenisAkta==8)||(jenisAkta==10)){
        var penuntut = $('#idpenuntut').val();
        if(penuntut==-1){
            message_error_show('Silahkan Pilih Penuntut Umum');
            e.preventDefault();
        }
    }
    if(jenisAkta==7){
        var terbanding = $('#terbanding').val();
        if(terbanding==-1){
            message_error_show('Silahkan Pilih Pihak Terbanding');
            e.preventDefault();
        }
    }
    if(jenisAkta==-1){
        message_error_show('Silahkan Pilih Jenis Akta Relaas Banding');
        e.preventDefault();
    }      
});

</script>