<script src="<?php echo base_url();?>resources/js/jquery.ui.timepicker.js"></script>
<div class="centering" style="width:800px;margin-top: 1%;">
	<div id='edit_jadwal_sidang' style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
			<form id="frm_edit_pemeriksaan_proses" style="background:white;margin:0;" method="post" action="<?php echo base_url().'pemeriksaan_persiapan/validateEditPemeriksaanPersiapan';?>">
				<table id="tableDetilPerkara" style="font-size:14px;">
					<col width="20%">
					<col width="80%">
					<tbody>
					<tr><td colspan="2" style="padding:4px;background:white;font-size:16px;color:#111;" align="center"><strong>Edit Pemeriksaan Persiapan</strong></td></tr>
					<input type="hidden" name="IDPersiapanProses" value="<?php echo $IDPersiapanProses; ?>">
					<input type="hidden" name="IDPerkara" value="<?php echo $IDPerkara; ?>">
					<input type="hidden" id="tanggalPenetapanPemeriksaan" name="tanggalPenetapanPemeriksaan" value="<?php echo $tanggalPenetapanPemeriksaan; ?>">
					<tr>
						<td>Tanggal<span style="color:red">*</span></td>
						<td><input type='text' value="<?php echo $tanggal;?>" id='tgl_musyawarah' name='tgl_musyawarah' class='datepicker' maxlength='10' placeholder='tgl/bln/tahun'></td>
					</tr>
					<tr>
						<td>Jam Pelaksanaan<span style="color:red">*</span></td>
						<td><input id="waktu_pelaksanaan" name="waktu_pelaksanaan" value="<?php echo $waktu; ?>" class="timepicker" maxlength="4" placeholder="HH:mm"></td>
					</tr>
					<tr>
						<td>Agenda<span style="color:red">*</span></td>
						<td style="padding:0px;padding-left:5px;">
							<textarea name="agenda" id="agenda" maxlength="500" class="standard-input" style="margin: 0px; width: 610px; height: 100px;resize: none;"><?php echo $agenda; ?></textarea>
						</td>
					</tr>
					<tr>
						<td>Dihadiri Oleh<span style="color:red">*</span></td>
						<td>
							<span class="custom-dropdown custom-dropdown--emerald" style="width:200px">
								<select name="dihadiri_oleh" id="dihadiri_oleh" style="width:200px" class="custom-dropdown__select custom-dropdown__select--white">
									<option value="1" <?php echo ($dihadiri_oleh==1)? 'selected':''; ?>>Semua Pihak</option>
									<option value="2" <?php echo ($dihadiri_oleh==2)? 'selected':''; ?>>Pihak Penggugat Saja</option>									
									<option value="3" <?php echo ($dihadiri_oleh==3)? 'selected':''; ?>>Pihak Tergugat Saja</option>
									<option value="4" <?php echo ($dihadiri_oleh==4)? 'selected':''; ?>>Para Pihak Tidak Hadir</option>
								</select>
							</span>
						</td>
					</tr>
					<tr>
						<td>Keterangan</td>
						<td style="background:white; padding:0px;padding-left:5px;">
						<textarea name="keterangan" id="keterangan" maxlength="500" class="standard-input" style="margin: 0px; width: 610px; height: 100px; resize: none;"><?php echo $keterangan; ?></textarea>
						</td>
					</tr>
					<tr>
						<td colspan="2" class="buttongroup">									
							<input type="button" id='close_edit_jadwal_sidang' value="Kembali" class="btn">
							<?php if($urutan!=1){ ?>
							<input type="button" id="hapusProses" value="Hapus" style="text-decoration:none" class="btn btn-danger">
							<?php } ?>
							<input type="submit" id="simpan" value="Simpan" class="btn">
						</td>
					</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>


<script type="text/javascript">
$('#close_edit_jadwal_sidang').closingFormWin();
$('#frm_edit_pemeriksaan_proses').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_edit_jadwal_sidang',
	whenStatus:1
 });
$('#tgl_musyawarah').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 = $('#tanggalPenetapanPemeriksaan').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 Tanggal Sebelum Atau Tepat Pada Tanggal Penetapan Pemeriksaan';
					error = 1
				}
				dob = new Date(tmp[2]+"-"+tmp[1]+"-"+tmp[0]+"T00:00:00");
				var tglDaftar = new Date($('#tglPendaftaran').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;
        	}
});

$('#hapusProses').ButtonClickHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_edit_jadwal_sidang',
	whenStatus:1,
	actions:'<?php echo base_url()?>pemeriksaan_persiapan/hapusPemeriksaanProses/<?php echo $IDPersiapanProses; ?>',
	formName:'#frm_edit_pemeriksaan_proses',
	actionName:'Hapus Data'
});

$('.datepicker').ValidateDateInput();
$('#waktu_pelaksanaan').timepicker({});
</script>
