<?php
if($this->session->userdata('is_logged_in')===FALSE){
            redirect('login');
}
?>
<!--<div class="templatepopcentering" >
    <div id='pop' style="padding:5px;">-->
<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_akta_pid_tdk_kasasi" class="templatepopform" method="" action="">
        	<table id="" style="padding:5px;">
                <tr><td colspan="2" class="templatepoptitle">
            <?php 
                foreach ($template->result() as $template)
                {
                    echo strtoupper($template->namatemplate."<br/>Perkara ".$template->jnsperkara);
                }
            ?>
                </td></tr>
                <tr>
                    <td class="templatepopleftcol">Tanggal Pengajuan <font color=red>*</font></td>
                    <td style=""><input class='datepicker' type="text" name="tglCabut" id="tglCabut" style="height: 30px;" placeholder="tgl/bln/tahun"></td>
                </tr>
                <tr>
                    <td class="templatepopleftcol">Jenis Template<font color=red>*</font></td>
                    <td style="">
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:250px;'  name="jenisTemplate" id="jenisTemplate" class="custom-dropdown__select custom-dropdown__select--white">
                                <option value='-1'>--Pilih Pilih Template---</option>
                                <option value='1'>&nbsp;1.&nbsp;Akta Tidak Mengajukan Permohonan Kasasi</option>
                                <option value='2'>&nbsp;2.&nbsp;Akta Terlambat Mengajukan Permohonan Kasasi</option>
                            </select>
                        </span>
                    </td> 
                </tr>   
                <tr>
                    <td class="templatepopleftcol">Pihak Pengaju<font color=red>*</font></td>
                    <td style="">
                        <span class="custom-dropdown custom-dropdown--emerald">
                            <select style='width:250px;'  name="pengaju" id="pengaju" class="custom-dropdown__select custom-dropdown__select--white">
                                <option value='-1'>--Pilih Pihak Pengaju--</option>
                                <option value='1'>&nbsp;1.&nbsp;Penuntut Umum</option>
                                <option value='2'>&nbsp;2.&nbsp;Terdakwa</option>
                                <option value='3'>&nbsp;3.&nbsp;Para Terdakwa</option>
                                <option value='4'>&nbsp;4.&nbsp;Penasihat Hukum Terdakwa</option>
                                <option value='5'>&nbsp;5.&nbsp;Penasihat Hukum Para Terdakwa</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">
                                <option value='-1'>--Pilih Pembuat Penetapan--</option>
                                <?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>";
                                			}
                                		}
                                	}
                                ?>
                            </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:250px;'  name="putusan" id="putusan" class="custom-dropdown__select custom-dropdown__select--white">
                                <option value='-1'>--Silakan Pilih Terhadap Putusan--</option>
                                <?php 
                                    if($dataPutusan != ''){
                                        if($dataPutusan->num_rows>0){
                                            foreach ($dataPutusan->result() as $row) {
                                               // echo "<option value='".$row->idPut."'>".$row->tahapan.' - '.$row->nama."</option>";
                                                $idPut = base64_encode($this->encrypt->encode($row->idPut));
                                                echo "<option value='".$idPut."'>&nbsp;". $row->tahapan ."&nbsp;Nomor: ". $row->nomorPerkara .".&nbsp  Tgl Putus : ".$this->templatehelper->convertKeTglIndo($row->tglPutus) ." </option>";
                                            }
                                        }
                                    }
                                ?>
                            </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>
            </table>
		</form>
		</form>
	</div>
</div>
<script type="text/javascript">

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

function print(){
    var tglCabut = $('#tglCabut').val();
    if(tglCabut==''){
        alert('Silahkan Isikan Tanggal Pengajuan');
        return;
    }
    var jenisTemplate = $('#jenisTemplate').val();
    if(jenisTemplate==-1){
        alert('Silahkan Pilih Jenis Template');
        return;
    }
    var pengaju = $('#pengaju').attr('value');
    if(pengaju==-1){
        alert('Silahkan Pilih Pihak Pengaju');
        return;
    }
    var pembuat = $('#pembuat').val();
    if(pembuat == -1){
        alert('Silahkan Pilih Pejabat Pembuat AKTA');
        return;
    }
    var putusan = $('#putusan').val();
    if(putusan == -1){
        alert('Silahkan Pilih Tahapan Putusan');
        return;
    }
    var tglCabut = $('#tglCabut').val();
    var jenisTemplate = $('#jenisTemplate option:selected').attr('value');
    var pengaju = $('#pengaju option:selected').attr('value');
    var pembuat = $('#pembuat option:selected').attr('value');
    var putusan = $('#putusan option:selected').attr('value');
    /*var id = "<?php echo $idperkara; ?>";*/
    var enc = "<?php echo ($enc); ?>";
    window.open('<?php echo base_url("c_template_akta_kasasi_pid/cetak_akta_tidak_kasasi")?>/'
        +enc+'/'
        +jenisTemplate+'/'
        +pengaju+'/'
        +pembuat+'/'
        +putusan+'/'
        +tglCabut,'_self');
}

$( function() {
        $('#tglCabut').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
                var date = $(this).datepicker('getDate');
                var dayOfWeek = weekday[date.getDay()];
                var error = 0;
                var message ='';
                if(dayOfWeek=='Sunday' || dayOfWeek=='Saturday'){
                    message ='Tidak Dapat Memilih diluar Hari Kerja.';
                    error = 1;
                }
            }
        });
});
</script>