<div class="centering" style="width:90%;margin-top: 1%;">
	<div id='pihak_pilih' style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
			<form id="frm_edit_grasi" style="background:white;margin:0;" method="post" role="form" action="<?php echo base_url().'perkara_grasi/validasiUpdateGrasiPertimbanganMA';?>">
			<table id="tableDetilPerkara">
				<col width="20%">
				<col width="80%">
				<tbody>
					<tr>
						<td colspan="2" style="background:white;text-align:center;"><?php echo $judul_popup; ?></td>
					</tr>
					<tr>
						<input type="hidden" id="id" name="id" value="<?php echo $id; ?>">
						<input type="hidden" id="perkara_id" name="perkara_id" value="<?php echo $perkara_id; ?>">
						<input type="hidden" id="curr_date" name="curr_date" value="<?php echo $curr_date; ?>">
						<input type="hidden" id="permohonan_grasi" name="permohonan_grasi" value="<?php echo $this->tanggalhelper->convertToInputDate($permohonan_grasi); ?>">
						<input type="hidden" id="nomor_perkara_pn" name="nomor_perkara_pn" value="<?php echo $nomor_perkara_pn; ?>">
					</tr>
					<tr>
						<td style="color:white;">Permohonan Grasi <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;"><?php echo $this->tanggalhelper->convertDayDate($permohonan_grasi);?></td>
					</tr>
					
					<tr>
						<td style="color:white;">Tanggal Pertimbangan MA</td>
						<td style="padding:0px;padding-left:5px;">

							<input type="text" id='tanggal_pertimbangan_ma' value="<?php echo $tanggal_pertimbangan_hakim; ?>" class="datepicker" placeholder="tgl/bln/tahun" name='tanggal_pertimbangan_ma' class="standard-input" maxlength="30">
						</td>
					</tr>
					<tr>
						<td style="color:white;">Isi Pertimbangan MA</td>
						<td style="padding:0px;padding-left:5px;" id="isi_petimbangan_ma_text">
							<?php echo $this->ckeditor->editor("isi_petimbangan_ma",$isi_perimbangan_hakim);?>
						</td>
					</tr>
					
					<tr>
						<td colspan="2" style="background:white;border:0px;" align="center">
						<input type="button" id='kembaliPOPGRASI' value="Kembali" class="btn">
						<input type="submit" id="cetak" value="SIMPAN" class="btn">
						</td>
					</tr>
				</tbody>
				</table>
				</form>
    	</div>
	</div>
</div>
<script type="text/javascript">
$('#kembaliPOPGRASI').closingFormWin();

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

      
    $( function() {
      	$('#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(message);
            		return;
            	}
				
				var tmp = $('#permohonan_grasi').val().split("/");
				var tmp2 = $('#tanggal_pertimbangan_ma').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 Kurang dari Tanggal Permohonan Grasi. Tanggal Permohonan Grasi '+$('#permohonan_grasi').val();
					message_error_show(message);
					$(this).css("background-color", "red");
				} else 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 sama dengan Tanggal Permohonan Grasi. Tanggal Permohonan Grasi '+$('#permohonan_grasi').val();
					message_error_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
			}
        });

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

