<div style="padding:10px;"></div>

<div class="detil" style="padding: 4px;font-size:14px;margin-top:25px;width: 55%;margin: 0 auto;border-color: #FFFFFF;">
	<?php if($openinput==1){?>
	<form id="frm_edit_tanggal" style="padding: 4px;background:white;margin:0;" method="post" action="<?php echo base_url().'saveberkaspk';?>">
	<?php }?>
	<form id="frm_edit_tanggal" style="padding: 4px;background:white;margin:0;" method="post" action="<?php echo base_url().'savetanggalpk';?>">
		
		<table id="tableDetilPerkara" style="font-size:14px;">
			<col width="40%">
			<col width="60%">
			<tbody>
				<tr id="tr_pihak">
					<td colspan="2" class="divider"><?php echo $title;?></td>
				</tr>
				<?php if($openinput==2){
				?>
				<tr>
					<td>Nomor Perkara<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;"><?php echo (!empty($noperkarapn) ? $noperkarapn : '');?></td>
				</tr>
				<tr>
					<td>Tanggal Permohonan<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;"><?php echo (!empty($tglpermohonan) ? $tglpermohonan : '');?></td>
				</tr>
				<tr class ="tr_pemohon">
					<td>Nama Pihak<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;"><?php echo (!empty($namapihak) ? $namapihak : '');?></td>
				</tr>
				<tr class ="tr_pemohon">
					<td>Status Pihak<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;"><?php echo (!empty($statuspk) ? $statuspk : '');?></td>
				</tr>
				<?php }?>
				<tr id="tr_pihak">
					<input type="hidden" id="date_put" value="<?php echo (!empty($tglputusan))? $tglputusan:'';?>">
					<input type="hidden" id="enc" name="enc" value="<?php echo (!empty($idperkara))? $idperkara:'';?>">
					<input type="hidden" id="enc_id" name="enc_id" value="<?php echo (!empty($enc_id))? $enc_id:'';?>">
					<input type="hidden" id="enc_func" name="enc_func" value="<?php echo (!empty($enc_func))? $enc_func:'';?>">
					<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
				</tr>
				<tr>
					<td><?php echo $subtitle;?><font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;">
						<input id="tanggal" name="tanggal" value="<?php echo (!empty($tanggal) ? $tanggal : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
					</td>
				</tr>
				<?php if($openinput==1){
				?>
				<tr>
					<td><?php echo $inputsubtitle;?> <font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;">
						<input type="text" id='input_area' name='input_area' value="<?php echo (!empty($input_area) ? $input_area : '');?>" class="standard-input" maxlength="255">
						
					</td>
				</tr>
				<?php }?>
				<tr>
					<td colspan="2" style="background:white;" align="center">
						<input type="button" value="Kembali" id="kembali" class="btn">
						<?php
							if(!empty($tanggal)){
								echo '<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>
			</tbody>
		</table>
	</form>
</div>
<script type="text/javascript">
$('#kembali').closingFormWin();
$('#hapus').ButtonClickHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'.close_form',
	whenStatus:1,
	actions:'<?php echo base_url()?>detil_pk/hapus_tanggal_pk/',
	formName:'#frm_edit_tanggal',
	actionName:'Hapus Data'
});
$( document ).ready(function() {
    $('#frm_edit_tanggal').SubmitHandling({
		refresh:'1',
		setRefresh:1,
		divRef:'#frm_edit_tanggal',
		clicked:1,
		btnClicked:'.close_form',
		whenStatus:1
	});
	$('.datepicker').ValidateDateInput();
    $( function() {
        $('#tanggal').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");
				}
			}
        });
    });
});
</script>
