<script src="<?php echo base_url();?>resources/js/jquery.ui.timepicker.js"></script>
<div class="centering" style="width:650px;margin-top: 1%;z-index:-100">
<div id='form_penetapan_sidang_pertama' style="border: 1px solid #ffffff;">
	<div class="detil" style="padding: 2px;background-color: white;">
        	<div style="font-size:14px;">
            	<form id="frm_sidang_pertama" class="removeformbottomspace" method="post" action="<?php echo base_url().'detil_pk/simpan_penetapan_pemeriksaan_pk';?>">
            	<table id='tableDetilPerkara' style="font-size:14px; width:100%" border="0">
            		<tr><td colspan='2' style="padding:4px;background:white;font-size:16px;color:#111;" align="center"><strong>PENETAPAN HARI PEMERIKSAAN</strong></td></tr>
                	<col width="280px">
                	<col>
                	<tbody>
                		
			<tr>
                        			<td id="first-child">Tanggal Penetapan Hari Pemeriksaan <span style="color:red">*</span></td>
                        			<td><input id="tanggal_penetapan" name="tanggal_penetapan" value="<?php echo $tanggal_penetapan; ?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" ></td>
                    		</tr>
                    		<tr>
                        			<td id="first-child">Tanggal Hari Pemeriksaan<span style="color:red">*</span></td>
                        			<td><input id="tanggal_sidang" name="tanggal_sidang" value="<?php echo $tanggal_sidang; ?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" ></td>
                    		</tr>
                    		<tr>
                        			<td id="first-child">Jam Pemeriksaan<span style="color:red">*</span></td>
                        			<td><input id="mulai_jam" name="mulai_jam" value="<?php echo $mulai_jam; ?>" class="datepicker" maxlength="4" placeholder="HH:mm" readonly='' ></td>
                    		</tr>
			<tr>
                                                            <td id="first-child">Ruang Pemeriksaan <span style="color:red">*</span></td>
                        			 <td style="background:white;">
					<span class="custom-dropdown custom-dropdown--emerald" style="width:200px">
					<?php echo form_dropdown('ruang_sidang', $ruang_sidang, $ruangan_id, ' style="width:200px;" class="form-control" id="ruang_sidang"'); ?>
					</span>
				</td>
				<input type="hidden" id="tanggal_sekarang" value="<?php echo $tanggal_sekarang;?>">
				<input type="hidden" name="perkara_id" id="perkara_id" value="<?php echo $perkara_id;?>">
                    		</tr>
			<tr>
                    			<td colspan="2" class="buttongroup">
                            				
                         				<input type="button" id='close_form_add_sidang_pertama' value="Kembali" class="btn">
                                			<input type="button" id="hapus" value="Hapus" style="text-decoration:none" class="btn btn-danger">
                                			<input type="submit" id="simpan" value="Simpan" class="btn">
                        			</td>
                    		</tr>
                    		<input type="hidden" id="refresh" class='detil_perkara_refresh' value="0">
            		</tbody>
         	</table>
     	</form>
        	</div>
    	</div>
</div>
</div>

<script type="text/javascript">
$('#close_form_add_sidang_pertama').closingFormWin();
$('#frm_sidang_pertama').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'.close_form',
	whenStatus:1,
    next_step:1
});
$('#mulai_jam').timepicker({});


$('#hapus').ButtonClickHandling({
    refresh:'1',
    setRefresh:1,
    divRef:'#konten',
    clicked:1,
    btnClicked:'#close_form_add_sidang_pertama',
    whenStatus:1,
    actions:'<?php echo base_url()?>detil_pk/hapus_penetapan_pemeriksaan_pk/<?php echo $perkara_id; ?>',
    formName:'#frm_edit_jadwal_sidang',
    actionName:'Hapus Data'
});






$('#tanggal_penetapan').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 = $('#tanggal_sekarang').val().split("/");
                var tmp3 = $('#tanggal_sidang').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 '+$('#tanggal_sekarang').val();
					error = 1;
                    $(this).val('');
				}
                if((new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00").getTime() > new Date(tmp3[2]+"-"+tmp3[1]+"-"+tmp3[0]+"T00:00:00").getTime())){
                    $('#tanggal_sidang').val('');
                }
				if(error==1){
					message_error_show(message);
					$(this).css("background-color", "red");
				}else{
					$(this).css("background-color", "#dedbdb");
				}
				error = 0;
        	}
});
$('#tanggal_sidang').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 = $('#tanggal_penetapan').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 Sebelum Tanggal '+$('#tanggal_penetapan').val();
                    error = 1;
                    $(this).val('');
                }
    			if(error==1){
    			    message_error_show(message);
    				$(this).css("background-color", "red");
    			}else{
    				$(this).css("background-color", "#dedbdb");
    			}
    			error = 0;
            }
});
$('.datepicker').ValidateDateInput();
</script>