<br/><br/>
<hr class="thick-line" style="clear:both;">
<div style="margin: 0 auto;top: 10%;margin-top: 1%;margin-bottom: 25px;">
	<div class="detil" style="background-color:white;border-color: white;font-size:14px;margin-top:25px;width: 85%;margin: 0 auto;">
		<form id="frm_grasi" style="background:white;margin:0;" method="post"  action="<?php echo base_url().'perkara_grasi/validasiInsertGrasi';?>">
		<table id="tableDetilPerkara">
			<col width="30%">
			<col width="70%">
			<tbody>
			<?php
					if($this->session->userdata('jenis_pengadilan')==2){
							$nop="Nomor Perkara Dilmil";
							$put="Putusan Dilmil";
							$bersi="Pengiriman Berkas Grasi ke Orditurat Militer";
							$nobersi="Nomor Surat Pengiriman Berkas Grasi ke Orditurat Militer";
							$nos="Pemberitahuan Putusan Grasi Kepada Pemohon dan Oditur";
							$nosi="Penerimaan Tembusan Berita Acara Pelaksanaan Putusan Dari Oditur Militer";
					}if($this->session->userdata('jenis_pengadilan')==4){
							$nop="Nomor Perkara MS";
							$put="Putusan MS";
							$bersi="Pengiriman Berkas Grasi ke Kejaksaan Negeri";
							$nobersi="Nomor Surat Pengiriman Berkas Grasi ke Kejaksaan Negeri";
							$nos="Pemberitahuan Putusan Grasi Kepada Pemohon dan Jaksa";
							$nosi="Penerimaan Tembusan Berita Acara Pelaksanaan Putusan Dari Penuntut Umum";
					}else{
							$nop="Nomor Perkara PN";
							$put="Putusan PN";
							$bersi="Pengiriman Berkas Grasi ke Kejaksaan negeri";
							$nobersi="Nomor Surat Pengiriman Berkas Grasi ke Kejaksaan Negeri";
							$nos="Pemberitahuan Putusan Grasi Kepada Pemohon dan Jaksa";
							$nosi="Penerimaan Tembusan Berita Acara Pelaksanaan Putusan Dari Penuntut Umum";
						}
					?>		
				<tr>
					<td style="color:white;"><?php echo $nop;?></td>
					<td style="padding:0px;padding-left:5px;">
						<input type="hidden" id='perkara_id' name='perkara_id'>
						<input type="hidden" id='alur_perkara_id' name='alur_perkara_id'>
						<input type="hidden" id='curr_date' name='curr_date'>
						<input type="text" id='nomor_perkara' name='nomor_perkara' class="standard-input">
						<input type="button" id="cariPerkara" value="Cari" onclick="pencarianPerkara()" style="padding: 7px 0;color:white;background: #7f8c8d;border: 0 none;  -webkit-border-radius: 0 0 0 0;width: 90px;">
					</td>
					</tr>
					<tr>
						<td style="color:white;"><?php echo $put;?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='putusan_pn' name='putusan_pn' class="standard-input" style="width:20%" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Nomor Perkara Banding</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nomor_perkara_banding' name='nomor_perkara_banding' class="standard-input" style="width:30%" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Putusan Banding</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='putusan_banding' name='putusan_banding' class="standard-input" style="width:20%" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Nomor Perkara Kasasi</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nomor_perkara_kasasi' name='nomor_perkara_kasasi' class="standard-input" style="width:30%" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Putusan Kasasi</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='putusan_kasasi' name='putusan_kasasi' class="standard-input" style="width:20%" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Nomor Perkara PK</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nomor_perkara_pk' name='nomor_perkara_pk' class="standard-input" style="width:30%" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Putusan PK</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='putusan_pk' name='putusan_pk' class="standard-input" style="width:20%" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Permohonan Grasi <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
						<input type="text" id='permohonan_grasi' class="datepicker" placeholder="tgl/bln/tahun" name='permohonan_grasi' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Permohonan Penundaan Pidana</td>
						<td style="padding:0px;padding-left:5px;">
						<input type="text" id='permohonan_penundaan_pidana' class="datepicker" placeholder="tgl/bln/tahun" name='permohonan_penundaan_pidana' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr id="tr_terdakwa">
						<td style="color:white;">Nama Terdakwa <font color="red">*</font></td>
						
					</tr>
					<tr>
						<td style="color:white;">Nama Pemohon <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="hidden" id='enc_pemohon' name='enc_pemohon'>
							<input type="text" id='nama_pemohon' name='nama_pemohon' class="standard-input" maxlength="200">
							<input type="button" onClick="popup_form('<?php echo base_url('pihak_list_up');?>')" value="Cari" style="padding: 7px 0;color:white;background: #7f8c8d;border: 0 none;  -webkit-border-radius: 0 0 0 0;width: 90px;">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Pekerjaan Pemohon <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='pekerjaan_pemohon' name='pekerjaan_pemohon' class="standard-input" style="width:99%" maxlength="200">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Alamat Pemohon <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
						<textarea type="text" id='alamat_pemohon' name='alamat_pemohon' class="standard-input" style="width:99%" maxlength="200" ></textarea>
						</td>
					</tr>
					<tr>
						<td style="color:white;">Pemberitahuan Putusan Tetap</td>
						<td style="padding:0px;padding-left:5px;">
						<input type="text" id='pemberitahuan_putusan_tetap' class="datepicker" placeholder="tgl/bln/tahun" name='pemberitahuan_putusan_tetap' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Menjalani Pidana Pengganti<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
						<span class="custom-dropdown custom-dropdown--emerald"  style="border:1px #ddd solid; width:250px;">
							<select name="status_pidana_pengganti" id="status_pidana_pengganti" onchange="" style="width:250px;" class="custom-dropdown__select custom-dropdown__select--white">
								<option value="" selected>Status Pidana Pengganti</option>
								<option value="Y">Ya</option>
								<option value="T">Tidak</option>
							</select>
						</span>
						</td>
					</tr>
					<tr>
						<td style="color:white;">Terpidana Dalam Tahanan<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald"  style="border:1px #ddd solid; width:250px;">
							<select name="status_terpidana_tahanan" id="status_terpidana_tahanan" onchange="" style="width:250px;" class="custom-dropdown__select custom-dropdown__select--white">
								<option value="" selected>Status Tahanan</option>
								<option value="Y">Ya</option>
								<option value="T">Tidak</option>
							</select>
							</span>
						</td>
					</tr>
					<tr>
						<td style="color:white;">Denda Dibayar<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald"  style="border:1px #ddd solid; width:250px;">
							<select name="status_terpidana_denda" id="status_terpidana_denda" onchange="" style="width:250px;" class="custom-dropdown__select custom-dropdown__select--white">
								<option value="" selected>Status Denda</option>
								<option value="Y">Ya</option>
								<option value="T">Tidak</option>
							</select>
							</span>
						</td>
					</tr>
					<tr>
						<td style="color:white;">Barang Rampasan</td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald"  style="border:1px #ddd solid; width:250px;">
							<select name="status_terpidana_barang_rampasan" id="status_terpidana_barang_rampasan" onchange="" style="width:250px;" class="custom-dropdown__select custom-dropdown__select--white">
								<option value="" selected>Status Barang Rampasan</option>
								<option value="Y">Disimpan</option>
								<option value="T">Diuangkan</option>
							</select>
							</span>
						</td>
					</tr>
					<tr>
						<td style="color:white;">Tanggal Pertimbangan Mahkamah Agung</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='tanggal_pertimbangan_ma' class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_pertimbangan_ma' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Isi Pertimbangan Mahkamah Agung</td>
						<td style="padding:0px;padding-left:5px;" id="isi_petimbangan_ma_text" name="isi_petimbangan_ma_text">
							<?php echo $this->ckeditor->editor("isi_petimbangan_ma",'&nbsp;');?>
						</td>
					</tr>
					<tr>
						<td style="color:white;"><?php echo $bersi;?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='tanggal_pengiriman_berkas_kejaksaan' class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_pengiriman_berkas_kejaksaan' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;"><?php echo $nobersi;?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nomor_pengiriman_berkas_kejaksaan' name='nomor_pengiriman_berkas_kejaksaan' class="standard-input" maxlength="100" style="width:50%">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Pengiriman Berkas Grasi ke MA</td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='tanggal_pengiriman_berkas_ma' class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_pengiriman_berkas_ma' class="standard-input" maxlength="30">
							</td>
					</tr>
					<tr>
						<td style="color:white;">Nomor Surat Pengiriman Berkas Grasi ke MA</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nomor_pengiriman_berkas_ma' name='nomor_pengiriman_berkas_ma' style="width:50%" class="standard-input">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Pengiriman Pertimbangan Hakim Grasi</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='tanggal_pengiriman_pertimbangan_hakim' class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_pengiriman_pertimbangan_hakim' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Tanggal Putusan Presiden</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='tanggal_putusan_presiden' class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_putusan_presiden' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Nomor Putusan Presiden</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nomor_putusan_presiden' style="width:50%" name='nomor_putusan_presiden' class="standard-input">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Isi Keputusan Presiden</td>
						<td style="padding:0px;padding-left:5px;" id="isi_putusan_presiden_text" name="isi_putusan_presiden_text">
						<?php echo $this->ckeditor->editor("isi_putusan_presiden",'');?>
						</td>
					</tr>
					<tr>
						<td style="color:white;">Tanggal Penerimaan Kembali Berkas Grasi</td>
						<td style="padding:0px;padding-left:5px;">
						<input type="text" id='tanggal_penerimaan_kembali_berkas' class="datepicker" placeholder="tgl/bln/tahun"  name='tanggal_penerimaan_kembali_berkas' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;"><?php echo $nos;?></td>
						<td style="padding:0px;padding-left:5px;">
						<input type="text" id='tanggal_pemberitahuan_putusan_grasi' class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_pemberitahuan_putusan_grasi' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;"><?php echo $nosi;?></td>
						<td style="padding:0px;padding-left:5px;">
						<input type="text" id='tanggal_terima_tembusan_pelaksanaan_putusan' class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_terima_tembusan_pelaksanaan_putusan' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Keterangan</td>
						<td style="padding:0px;padding-left:5px;" id="keterangan_text" name="keterangan_text">
						<?php echo $this->ckeditor->editor("keterangan",'');?>
						</td>
					</tr>
					<tr>
						<td colspan="2" style="background:white;border:0px;" align="center">
						<input type="button" id="goback" onclick="kembali()" value="Kembali" class="btn">
						<input type="submit" id="simpan" value="Simpan" name="simpan" class="btn">
						</td>
					</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">

function kembali(){
	window.open('<?php echo $history; ?>', '_self');
}

$( document ).ready(function() {
    $('#frm_grasi').SubmitHandling({
		refresh:'1',
		setRefresh:1,
		divRef:'#frm_grasi',
		clicked:1,
		whenStatus:1,
		btnClicked:'#goback',
		isCKEdit:1,
		tdID:'isi_petimbangan_ma_text',
		textID:'isi_petimbangan_ma',
	});

      
    $( function() {
    	 $('#permohonan_grasi').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 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.';
            		message_error_show_parent(message);
            		return;
            	}

            	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();
					message_error_show_parent(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
			}
        });



        $('#permohonan_penundaan_pidana').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });


        $('#pemberitahuan_putusan_tetap').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });

		
		$('#tanggal_pertimbangan_ma').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });


		$('#tanggal_pengiriman_berkas_kejaksaan').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });


		$('#tanggal_pengiriman_berkas_ma').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });
		

		$('#tanggal_pengiriman_pertimbangan_hakim').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });

		$('#tanggal_pengiriman_pertimbangan_hakim').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });


		$('#tanggal_putusan_presiden').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });

		
		$('#tanggal_penerimaan_kembali_berkas').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });


		$('#tanggal_pemberitahuan_putusan_grasi').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });

		$('#tanggal_terima_tembusan_pelaksanaan_putusan').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 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.';
            		message_error_show_parent(message);
            		return;
            	}
			}
        });

    $('input,select').not('#simpan').keypress(function(event) { return event.keyCode != 13; });
    });
});

function refreshPihakList(){
	$("#popup_form").remove();
	popup_form('<?php echo base_url("pihak_list_up");?>')
	$("#refresh").remove();
}


function pencarianPerkara(){
	var val = $('#nomor_perkara').val();
	openLoadingDialog()
	$.post('<?php echo base_url()?>perkara_grasi/showDetilGrasi', {
		val:val
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading()
		if(json.st==1){
			$('#td_terdakwa').remove();
			$('.hidden').hide();
			$('.grasi_hide').show();
			$('#putusan_pn').val(json.tglPutusan);
			$('#nomor_perkara_banding').val(json.nomorPerkaraBanding);
			$('#nomor_perkara_kasasi').val(json.nomorPerkaraKasasi);
			$('#putusan_kasasi').val(json.putusanKasasi);
			$('#nomor_perkara_pk').val(json.nomorPerkaraPK);
			$('#putusan_pk').val(json.putusanPK);
			$('#perkara_id').val(json.perkaraId);
			$('#curr_date').val(json.curr_date);
			$('#tr_terdakwa').append(json.pihakhtml);
			$('#alur_perkara_id').val(json.alurPerkaraId);
			$('#putusan_banding').val(json.putusanBanding);
		}else if(json.st==0){
			message_error_show_parent(json.msg);
		}
	});
}
$("#refresh").change(function(){
	if($(this).val()==1){
		var urlRefresh = $('#refresh_dest').val();
		window.open(urlRefresh,'_self')
	}
});

$('#frm_grasi').on('change', '#terdakwa_id', function(){
	var valTerdakwa = $('#terdakwa_id').val();
	openLoadingDialog()
	$.post('<?php echo base_url()?>perkara_grasi/showCekTerdakwa', {
		valTerdakwa:valTerdakwa
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading()
		if(json.st==1){
			return;
		}else if(json.st==0){
			message_error_show_parent(json.msg);
		}
	});
});



$('#frm_grasi').on('click', '#simpan', function(event) {
	if($('#nomor_perkara').val()==''){
		message_error_show_parent('Nomor Pekara Pengadilan Negeri Masih Kosong');
		$(this).css("background-color", "red");
		event.preventDefault();
		return;
	}

	if($('#permohonan_grasi').val()==''){
		message_error_show_parent('Tanggal Permohonan Grasi Masih Kosong');
		$(this).css("background-color", "red");
		event.preventDefault();
		return;
	}

	if($('#nama_pemohon').val()==''){
		message_error_show_parent('Nama Pemohon Masih Kosong');
		$(this).css("background-color", "red");
		event.preventDefault();
		return;
	}

	if($('#alamat_pemohon').val()==''){
		message_error_show_parent('Alamat Pemohon Masih Kosong');
		$(this).css("background-color", "red");
		event.preventDefault();
		return;
	}

	if($('#pekerjaan_pemohon').val()==''){
		message_error_show_parent('Pekerjaan Pemohon Masih Kosong');
		$(this).css("background-color", "red");
		event.preventDefault();
		return;
	}
});




</script>