<?php
if($this->session->userdata('is_logged_in')===FALSE){
            redirect('login');
}
// echo "idakta : ".$idakta;
?>
<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_mil_akta_pid_perm_kasasi" class="templatepopform" method="post" action="<?php echo base_url().'c_template_mil_akta_penerimaan_memori_kasasi_terdakwa/cetak_akta_permohonan_kasasi';?>">
           <table id="" style="padding:5px;"> 
            <tr>
                <td colspan="2" class="templatepoptitle">
                <?php 
                $i=0;
                foreach ($template->result() as $template)
                {
                    if ($i=='0')
                    {
                        $judul=$template->namatemplate;
                        $judul=explode("-",$judul);
                        $jnsperkara=$template->jnsperkara;
                    }
                }
                    echo strtoupper($judul[0]."<br/>Perkara ".$jnsperkara);
                ?>
                </td>
            </tr>
            <tr class="row_terdakwa" style="display:none;">
                <td class="templatepopleftcol">Pemohon Kasasi</td>
                <td style="">
                    Terdakwa/Penasihat Hukum </br>
                </td> 
            </tr>
            <?php if ($idakta=='1pc' || $idakta=='11' || $idakta=='10' || $idakta=='12'){ 
						if ($idakta=='1pc'){ $namakolom="Tgl Pemberitahuan Cabut";}
						elseif ($idakta=='11'){ $namakolom="Tgl Batas Penyerahan";} 
                        elseif ($idakta=='10'){ $namakolom="Tgl Batas Pengajuan";} 
                        elseif ($idakta=='12'){ $namakolom="Tgl Penyerahan";}             
			?>
            <tr class="row_terdakwa">
                <td class="templatepopleftcol"><?php echo $namakolom; ?><font color=red>*</font></td>
                    <td style="">
					<input type="text" id="tgl_pemberitahuan_cabut" name="tgl_pemberitahuan_cabut" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
					</td> 
            </tr>
            <?php
            }else{echo "<input type='hidden' name='tgl_pemberitahuan_cabut' id='tgl_pemberitahuan_cabut' value=''> ";} 
            if ($pihakasal=='2'){
            ?>
            <tr class="row_terdakwa">
                <td class="templatepopleftcol">Pilih Terdakwa<font color=red>*</font></td>
                    <td style="">
                        <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($info_DataTerdakwa != ''){
                                        if($info_DataTerdakwa->num_rows>0){
                                            if($info_DataTerdakwa->num_rows>1){
                                                echo '<option value="-1">Pilih Terdakwa</option>';
                                            }foreach ($info_DataTerdakwa->result() as $row) {
                                                $pihak_id = base64_encode($this->encrypt->encode($row->pihak_id));
                                                echo "<option value='".$pihak_id."'>".$this->templatehelper->standradnaming($row->pihak_nama)."</option>";
                                            }
                                        }else{
                                            echo '<option value="-1">Data Terdakwa Yang Melakukan Kasasi Tidak Ada</option>';
                                        }
                                    }else{
                                        echo '<option value="-1">Data Terdakwa Yang Melakukan Kasasi Tidak Ada</option>';
                                    }
                                ?>
                            </select>
                    </span>
                </td> 
            </tr>
            <?php
            }
            if ($pihakasal=='1'){
            ?>
            <tr class="row_terdakwa">
                <td class="templatepopleftcol">Pilih Terdakwa<font color=red>*</font></td>
                    <td style="">
                        <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($info_DataTerdakwa2 != ''){
                                        if($info_DataTerdakwa2->num_rows>0){
                                            if($info_DataTerdakwa2->num_rows>1){
                                                echo '<option value="-1">Pilih Terdakwa</option>';
                                            }foreach ($info_DataTerdakwa2->result() as $row) {
                                                $pihak_id = base64_encode($this->encrypt->encode($row->pihak_id));
                                                echo "<option value='".$pihak_id."'>".$this->templatehelper->standradnaming($row->pihak_nama)."</option>";
                                            }
                                        }else{
                                            echo '<option value="-1">Data Terdakwa Yang Melakukan Kasasi Tidak Ada</option>';
                                        }
                                    }else{
                                        echo '<option value="-1">Data Terdakwa Yang Melakukan Kasasi Tidak Ada</option>';
                                    }
                                ?>
                            </select>
                    </span>
                </td> 
            </tr>
            <?php
            }
            ?>


            <tr>
                <td class="templatepopleftcol">Terhadap Putusan<font color=red>*</font></td>
                    <td style="">
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:250px;'  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">Pembuat Penetapan<font color=red>*</font></td>
                    <td style="">
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:250px;'  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.' - '.$row->pw."</option>";
                                            }
                                        }else{
                                            echo '<option value="-1">Data Pembuat Penetapan Tidak ada</option>';
                                        }
                                    }else{
                                        echo '<option value="-1">Data Pembuat Penetapan Tidak ada</option>';
                                    }
                                ?>
                            </select>
                    </span>
                </td> 
            </tr>            
            <tr>
                <td colspan="2" style="background:white;" align="center">                    
                    <input type="hidden" id='curr_date' value="<?php echo date('d/m/Y');?>">
					<input type="hidden" id="enc" name = 'enc' value="<?php echo $enc; ?>">
                    <input type="hidden" id="encpemohon" name = 'encpemohon' value="<?php echo $encpemohon; ?>">
                    <input type="hidden" id="pihakasal" name = 'pihakasal' value="<?php echo $pihakasal; ?>">
                    <input type="hidden" id="idakta" name = 'idakta' value="<?php echo $idakta; ?>">
                    <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();
$('#frm_mil_akta_pid_perm_kasasi').submit(function(e) {
    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 Kasasi Terhadap Putusan PN/PT');
        e.preventDefault();
    }

});
$('#tgl_akta').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay:$.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
            	var error = 0;
				
				var tmp = $(this).val().split("/");
				var tmp2 = $('#curr_date').val().split("/");

				if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
					message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
					error = 1
				}
				if(error==1){
					message_error_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
				error = 0;
        	}
      	});

$('#tgl_pemberitahuan_cabut').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            beforeShowDay:$.datepicker.noWeekends,
            onSelect: function(dateText, inst) {
                var error = 0;
                
                var tmp = $(this).val().split("/");
                var tmp2 = $('#curr_date').val().split("/");

                if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp2[2]+"-"+tmp2[1]+"-"+tmp2[0]+"T00:00:00").getTime())){
                    message = 'Tidak Dapat Memilih Melebihi Hari ini. Sekarang Tanggal '+$('#curr_date').val();
                    error = 1
                }
                if(error==1){
                    message_error_show(message);
                    $(this).css("background-color", "red");
                }else{
                    $(this).css("background-color", "#dedbdb");
                }
                error = 0;
            }
        });

$('.datepicker').ValidateDateInput();
</script>