<div class="centering" style="width:1024px;margin-top: 1%;z-index:-100">
<div id='pemeriksaan_persiapan' style="border: 1px solid #ffffff;">
	<div class="detil" style="padding: 2px;background-color: white;">
		<form id="show_pemeriksaan_persiapan" style="background:white;margin:0;" method="post" action="<?php echo base_url().'perbaikan_gugatan/validatePerbaikanGugatanEdit';?>">
			<table id="tableDetilPerkara" style="font-size:14px;">
				<col width="40%">
				<col width="60%">
				<tbody>
					<tr>
						<td colspan="2" style='text-align:center;background:#fff;color:#5fb85c;border:2px solid #fff;margin-bottom:10px;font-size: 20px;'>Edit Data Perbaikan Gugatan</td>
					</tr>
					<tr>
						<td>Tanggal Saran Perbaikan Gugatan  <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">							
							<input value="<?php echo $tanggal_saran_perbaikan?>" id="tgl_saran_perbaikan_gugatan" name="tgl_saran_perbaikan_gugatan"  class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
						</td>
					</tr>
					<tr>
						<td>Perbaikan Gugatan <font color="red">*</font></td>
						 <td>                                													                       
                                <span class="custom-dropdown custom-dropdown--emerald">
		                            <select style='width:330px;'  name="perbaikan" id="perbaikan"  class="custom-dropdown__select custom-dropdown__select--white">   
									                            
		                                <option value=''>Pilih</option>			                                
		                                <option value='1' <?php if ($perbaikan==1){echo "selected";} else {echo "";}?>>Diperbaiki dan dinyatakan Lengkap</option>
		                                <option value='2' <?php if ($perbaikan==2){echo "selected";} else {echo "";}?>>Dinyatakan Lengkap Tanpa Perbaikan</option>
		                            </select>
		                        </span>			                                                       		
                            </td>
					</tr>
					<tr>
						<td>Tanggal Perbaikan/Dinyatakan Lengkap  <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">							
							<input value="<?php echo $tgl_perbaikan_gugatan?>" id="tgl_dinyatakan_lengkap" name="tgl_dinyatakan_lengkap"  class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
						</td>
					</tr>
					<input id="enc" name="enc" type="hidden" value="<?php echo $enc; ?>">
					<tr id='tr_petitum' style="display:none">
						<td>Petitum</td>
						<td style="background:white;" id="petitum_text">
							<?php echo $this->ckeditor->editor("petitum",$petitum);?>
						</td>
					</tr>
					<input type="hidden" id="curr_date" value="<?php echo $curr_date;?>">
					<tr>
						<td colspan="2" style="background:white;border:0px;" align="center">
							<input type="button" id='close_form_pemeriksaan_persiapan' value="Kembali" class="btn">
							<input type="submit" id="simpan" value="Simpan" class="btn">
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
</div>
<script type="text/javascript">
$('#close_form_pemeriksaan_persiapan').click(function(){
        window.open("<?php echo base_url('perkara_detil_tun/'.$enc.'/100');?>","_self");    
    });
$('#show_pemeriksaan_persiapan').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_pemeriksaan_persiapan',
	whenStatus:1,
	isCKEdit:1,
	tdID:'petitum_text',
	textID:'petitum',
	next_step:1
});

$('#tgl_dinyatakan_lengkap').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
		}

		dob = new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00");
		var tglDaftar = new Date($('#tanggalPendaftaran').val());
		var age = Math.floor((tglDaftar-dob) / (365.25 * 24 * 60 * 60 * 1000));
		if(age >1){
			message = 'Tanggal Tidak Valid. Silahkan Periksa Kembali';
			error = 1
		}
		if(error==1){
			message_error_show(message);
			$(this).css("background-color", "red");
		}else{
			$(this).css("background-color", "#dedbdb");
		}
		error = 0;
 	}
});
$('#tgl_saran_perbaikan_gugatan').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
		}

		dob = new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00");
		var tglDaftar = new Date($('#tanggalPendaftaran').val());
		var age = Math.floor((tglDaftar-dob) / (365.25 * 24 * 60 * 60 * 1000));
		if(age >1){
			message = 'Tanggal Tidak Valid. Silahkan Periksa Kembali';
			error = 1
		}
		if(error==1){
			message_error_show(message);
			$(this).css("background-color", "red");
		}else{
			$(this).css("background-color", "#dedbdb");
		}
		error = 0;
 	}
});


$('.datepicker').ValidateDateInput();

$("#perbaikan").change(function(){   
	if($(this).val()=='1'){
        $('.centering').css({'width':'1000px'});
        $('.first_col').css({'width':'20%'});
        $('.second_col').css({'width':'80%'});
    }else{
        $('.centering').css({'width':'625px'});
        $('.first_col').css({'width':'30%'});
        $('.second_col').css({'width':'70%'});
    } 
    switch($(this).val()){
        case "1":               
                $('#tr_petitum').show();
        break;
        case "2":
                $('#tr_petitum').hide();               
        break;        
        case "":
                $('#tr_petitum').hide();               
        break;
    }
});
$(document).ready(function() {
    if($('#perbaikan').val()=='1'){
        $('.centering').css({'width':'1000px'});
        $('.first_col').css({'width':'20%'});
        $('.second_col').css({'width':'80%'});
    }else{
        $('.centering').css({'width':'625px'});
        $('.first_col').css({'width':'30%'});
        $('.second_col').css({'width':'70%'});
    }
});
var perbaikan='<?php echo $perbaikan;?>';
if(perbaikan==="1"){
    $('#tr_petitum').show();   
};
</script>