<script src="<?php echo base_url();?>resources/js/autoNumeric.js"></script>
<div class="centering" style="width:1024px;margin-top: 1%;z-index:-100">
<div id='edit_data_umum' style="border: 1px solid #ffffff;">
	<div class="detil" style="padding: 2px;background-color: white;">
		<form id="frm_data_umum" style="background:white;margin:0;" method="post" enctype="multipart/form-data" action="<?php echo base_url().'manageDataUmum/validateInput';?>">
			<table id="tableDetilPerkara" style="font-size:14px;">
				<col width="18%">
				<col width="82%">
				<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 Umum</td>
					</tr>
					<tr>
						<td>Tanggal Pendaftaran</td>
						<td><?php echo $this->tanggalhelper->convertDayDate($tglPendaftaran);?></td>
					</tr>
					<tr>
						<td valign="top" style="vertical-align:top;">Pihak Dipublikasikan</td>						
						<td style="padding:0px;padding-left:5px;">
							<?php
							if($jenisPerkaraId==347 OR $jenisPerkaraId==346)
								$publikasikan="T";
							?>
							<span class="custom-dropdown custom-dropdown--emerald" style="width:100px;">							
								<select style="width:100px" name="aktif" id="aktif" class="custom-dropdown__select custom-dropdown__select--white">																 									
										<option value="Y" <?php if($publikasikan=="Y") echo "selected"; ?>>Ya</option>
										<option value="T" <?php if($publikasikan=="T") echo "selected"; ?>>Tidak</option>
								</select>							
							</span>
						</td>						
					</tr>
					<tr>
						<td>Klasifikasi Perkara</td>						
						<td>
						<span class="custom-dropdown custom-dropdown--emerald" style="width:400px;">
						<?php $js='id="klasifikasi" style="width:400px;" class="custom-dropdown__select custom-dropdown__select--white" onchange="generateNomorPerkara()"';
								echo form_dropdown('klasifikasi', $jenis_perkara, $jenisPerkaraId, $js); ?>
						</span>
						</td>
					</tr>
					<?php
					$jenis_surat = '';
					if ($idalurperkara>100) {
						$jenis_surat = 'Pelimpahan';
					}
					if($this->session->userdata('jenis_pengadilan')==2){
						echo '<tr>';
							echo '<td>Matra</td>';
							echo '<td>';
								echo '<span class="custom-dropdown custom-dropdown--emerald" style="width:100px;">';
									echo '<select style="width:100px" name="matra" id="matra" class="custom-dropdown__select custom-dropdown__select--white" onchange="generateNomorPerkara()">';
										echo '<option value="AD" '; echo ($matra==1)? ' selected ':''; echo '> AD</option>';
										echo '<option value="AL" '; echo ($matra==2)? ' selected ':''; echo '> AL</option>';
										echo '<option value="AU" '; echo ($matra==3)? ' selected ':''; echo '> AU</option>';
									echo '</select>';
								echo '</span>';
							echo '</td>';
						echo '</tr>';
					}
					?>
					<tr>
						<td>Nomor Perkara</td>
						<td><span id="no_perkara"><b><?php echo $noPerkara;?></b></span>
							<input name="nomor_perkara" class='nomor_perkara' type="hidden" value="<?php echo $noPerkara;?>"/>
						</td>
					</tr>
					<tr>
						<td>Tanggal Surat <?php echo $jenis_surat;?><?php if($idalurperkara<100 || ($idalurperkara>100 AND $idalurperkara!=119 AND $idalurperkara<=122)){ echo '<font color="red">*</font>';}?></td>
						<td style="padding:0px;padding-left:5px;">							
							<input id="tgl_surat" name="tgl_surat" value="<?php echo (!empty($tglSurat) ? $this->tanggalhelper->convertToInputDate($tglSurat) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
						</td>
					</tr>
					<input type="hidden" id="enc" name="enc" value="<?php echo $enc;?>">
					<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
					<input type="hidden" id="tglPendaftaran" value="<?php echo $tglPendaftaran;?>">
					<tr>
						<td>
						<?php if (($idalurperkara==114)AND($this->session->userdata('jenis_pengadilan')==1)){ ?>
						Nomor Seri Tilang <font color="red">*</font>
						<?php } else { ?>
						Nomor Surat <?php echo $jenis_surat;?><?php if($idalurperkara>100 AND $idalurperkara!=119 AND $idalurperkara<=122){ echo '<font color="red">*</font>';} }?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='no_surat' name='no_surat' value="<?php echo (!empty($noSurat) ? $noSurat : '');?>" class="standard-input" maxlength="50" style="width:250px;">
						</td>
					</tr>
					<?php if (($idalurperkara==114)AND($this->session->userdata('jenis_pengadilan')==1)){ ?>
					<tr>
						<td>Jenis Kendaraan</td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald"  style="border:1px #ddd solid; width:250px;">
							<select name="jenis_kendaraan_id" id="jenis_kendaraan_id" style="width:250px;" class="custom-dropdown__select custom-dropdown__select--white">
							<option value="-1">Pilih Jenis Kendaraan</option>
								<?php								
									if($kendaraan->num_rows()>0){
										foreach ($kendaraan->result() as $row) {												
											if(!empty($jenis_kendaraan_id) AND ($row->id==$jenis_kendaraan_id)){							
												echo '<option value="'.$row->id.'" selected>'.$row->nama.'</option>';
											}else{
												echo '<option value="'.$row->id.'">'.$row->nama.'</option>';
											}
										}
									}									
									?>
							</select>
							</span>
						</td>
					</tr>
					<tr>
						<td>Tanda Nomor Kendaraan Bermotor</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nomor_polisi' name='nomor_polisi' value="<?php echo (!empty($nomor_polisi) ? $nomor_polisi : '');?>" class="standard-input" maxlength="50" style="width:250px;">
						</td>
					</tr>
					<tr>
						<td>Bukti</td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald"  style="border:1px #ddd solid; width:250px;">
							<select name="bukti_tilang_id" id="bukti_tilang_id" style="width:250px;" class="custom-dropdown__select custom-dropdown__select--white">
							<option value="-1">Pilih Bukti Tilang</option>
								<?php								
									if($barangBukti->num_rows()>0){
										foreach ($barangBukti->result() as $row) {												
											if(!empty($bukti_tilang_id) AND ($row->id==$bukti_tilang_id)){							
												echo '<option value="'.$row->id.'" selected>'.$row->nama.'</option>';
											}else{
												echo '<option value="'.$row->id.'">'.$row->nama.'</option>';
											}
										}
									}									
									?>
							</select>
							</span>
						</td>
					</tr>
					<tr>
						<td>Ditilang Oleh</td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald" style="width:100px;">							
								<select style="width:100px" name="ditilang_id" id="ditilang_id" class="custom-dropdown__select custom-dropdown__select--white">																 									
										<option value="1" <?php if($ditilang_id=="1") echo "selected"; ?>>Polisi</option>
										<option value="2" <?php if($ditilang_id=="2") echo "selected"; ?>>Dinas Perhubungan</option>
										<option value="3" <?php if($ditilang_id=="3") echo "selected"; ?>>Lain-Lain</option>
								</select>							
							</span>
						</td>
					</tr>
					<?php } ?>		
					<?php
					if($this->session->userdata('jenis_pengadilan')==4 AND $idalurperkara==15) {
					?>
						<tr class='cerai'>
							<td>Tanggal Menikah <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_nikah" name="tgl_nikah" value="<?php echo (!empty($tgl_nikah) ? $this->tanggalhelper->convertToInputDate($tgl_nikah) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr class='cerai'>
							<td>Tgl. Kutipan Akta Nikah <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input id="tgl_kutipan_akta_nikah" name="tgl_kutipan_akta_nikah" value="<?php echo (!empty($tgl_kutipan_akta_nikah) ? $this->tanggalhelper->convertToInputDate($tgl_kutipan_akta_nikah) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr class='cerai'>
							<td>No. Kutipan Akta Nikah <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='no_kutipan_akta_nikah' name='no_kutipan_akta_nikah' value="<?php echo (!empty($no_kutipan_akta_nikah) ? $no_kutipan_akta_nikah : '');?>" class="standard-input" maxlength="50" style="width:250px;">
							</td>
						</tr>
						<tr class='cerai'>
							<td>KUA Tempat Menikah <font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea id="kua_tempat_nikah" placeholder='Contoh : KUA Ulujadi Kota Palu Propinsi Sulawesi Tengah' class="standard-input" style="width: 400px; height: 70px;resize: none;" maxlength="255" name="kua_tempat_nikah"><?php echo (!empty($kua_tempat_nikah) ? $kua_tempat_nikah : '');?></textarea>
							</td>
						</tr>
						<script type="text/javascript">
						$('#tgl_nikah').datepicker({
					            inline: true,
					            showOtherMonths: true,
					            dateFormat: 'dd/mm/yy',
					            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
					            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
									}

									if(error==1){
										message_error_show(message);
										$(this).css("background-color", "red");
									}else{
										$(this).css("background-color", "#dedbdb");
									}
									error = 0;
					        	}
					      	});
 						$('#tgl_kutipan_akta_nikah').datepicker({
					            inline: true,
					            showOtherMonths: true,
					            dateFormat: 'dd/mm/yy',
					            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
					            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
									}

									var tmp3 = $(this).val().split("/");
									var tmp4 = $('#tgl_nikah').val().split("/");
									
									if(error==1){
										message_error_show(message);
										$(this).css("background-color", "red");
									}else{
										$(this).css("background-color", "#dedbdb");
									}
									error = 0;
					        	}
					      	});
						</script>						
					<?php
					}
					?>
					<?php
					if($this->session->userdata('jenis_pengadilan')==2){
					?>
						<tr>
							<td>Berkas Dari<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='berkas_dari' name='berkas_dari' value="<?php echo (!empty($BerkasDari) ? $BerkasDari : '');?>" class="standard-input" maxlength="100" style="width:250px;">
							</td>
						</tr>
						<tr>
							<td>Tanggal Skeppera<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">							
								<input id="tgl_skeppera" name="tgl_skeppera" value="<?php echo (!empty($tglSkeppera) ? $this->tanggalhelper->convertToInputDate($tglSkeppera) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Nomor Skeppera<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='no_skeppera' name='no_skeppera' value="<?php echo (!empty($noSkeppera) ? $noSkeppera : '');?>" class="standard-input" maxlength="50" style="width:250px;">
							</td>
						</tr>
						<tr>
							<td>Pejabat Skeppera<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='pejabat_skeppera' name='pejabat_skeppera' value="<?php echo (!empty($pejabatSkeppera) ? $pejabatSkeppera : '');?>" class="standard-input" maxlength="50" style="width:250px;">
							</td>
						</tr>	
						<tr>
							<td>Penyidik Militer<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='penyidik_mil' name='penyidik_mil' value="<?php echo (!empty($penyidik_mil) ? $penyidik_mil : '');?>" class="standard-input" maxlength="100" style="width:250px;">
							</td>
						</tr>
						<tr>
							<td>Nomor BAP Penyidik Militer<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='no_bap_penyidik_mil' name='no_bap_penyidik_mil' value="<?php echo (!empty($no_bap_penyidik_mil) ? $no_bap_penyidik_mil : '');?>" class="standard-input" maxlength="100" style="width:250px;">
							</td>
						</tr>
						<tr>
							<td>Tanggal BAP Penyidik<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='tgl_penyidik_mil' name='tgl_penyidik_mil' value="<?php echo (!empty($tgl_penyidik_mil) ? $this->tanggalhelper->convertToInputDate($tgl_penyidik_mil) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<?php
							}
						?>
						<script type="text/javascript">
						$('#tgl_surat_dakwaan').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($('#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;
					        	}
					      	});
 						$('#tgl_skeppera').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($('#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;
					        	}
					      	});
 							$('#tgl_penyidik_mil').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($('#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;
					        	}
					      	});
						</script>
					
						<?php 
						$alurnya_nilai_sengketa = array(1,7,8,17);
						if (in_array($idalurperkara,$alurnya_nilai_sengketa)){?>
						<tr>
							<td>Nilai Sengketa</td>
							<td style='padding:0px;padding-left:5px;'>							
								<input data-a-sep="." data-a-dec="," id='nilai_sengketa' name='nilai_sengketa' value='<?php echo (!empty($nilai_sengketa) ? number_format($nilai_sengketa,0,",",".") : 0)?>' class='standard-input' maxlength='20' placeholder='' style='width:150px;text-align:right;'>
							</td>
						</tr>
					<?php } 
					$alurnya = array(111,112,115,116,117,118);
					if($this->session->userdata('jenis_pengadilan')==2 OR ($this->session->userdata('jenis_pengadilan')==1 && in_array($idalurperkara,$alurnya))){
					?>
						<tr>
							<td>Tanggal Surat Dakwaan<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">							
								<input id="tgl_surat_dakwaan" name="tgl_surat_dakwaan" value="<?php echo (!empty($tglSuratDakwaan) ? $this->tanggalhelper->convertToInputDate($tglSuratDakwaan) : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
							</td>
						</tr>
						<tr>
							<td>Nomor Surat Dakwaan<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<input type="text" id='no_surat_dakwaan' name='no_surat_dakwaan' value="<?php echo (!empty($noSuratDakwaan) ? $noSuratDakwaan : '');?>" class="standard-input" maxlength="50" style="width:250px;">
							</td>
						</tr>
					<?php 
					}
					if($this->session->userdata('jenis_pengadilan')==2){ ?>
						<tr>
							<td>Pasal Dakwaan<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea type="text" id='pasal_dakwaan' name='pasal_yang_didakwakan' style="width: 812px; height: 90px;resize: none; font-size:11px"><?php echo (!empty($pasal_dakwaan) ? $pasal_dakwaan : '');?></textarea>
							</td>
						</tr>
						<tr>
							<td>Tanggal Kejadian[uraian]<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">							
								
								<textarea class="standard-input" id="tgl_kejadian" name ="tgl_kejadian" style="width: 800px; height: 90px;resize: none;"><?php echo (!empty($tglKejadian) ? $tglKejadian : '');?></textarea>
							</td>
						</tr>
						<tr>
							<td>Tempat Kejadian<font color="red">*</font></td>
							<td style="padding:0px;padding-left:5px;">
								<textarea class="standard-input" id="tempat_kejadian" name ="tempat_kejadian" style="width: 800px; height: 90px;resize: none;"><?php echo (!empty($tempatKejadian) ? $tempatKejadian : '');?></textarea>
							</td>
						</tr>
					<?php 
					} 					
					if($idalurperkara<100){?>
					<tr>
						<td valign="top" style="vertical-align:top;">Posita</td>
						<td style="background:white;" id="posita_text">
							<?php echo $this->ckeditor->editor("posita",$posita);?>
						</td>
					</tr>						
					<?php } ?>
					<tr>
						<td valign="top" style="vertical-align:top;">
						<?php 
							if($idalurperkara<100){
								echo "Petitum";
							}elseif($idalurperkara==119){
								echo "Permohonan";
							}else{
								echo "Dakwaan";
							}
						?> 
						<font color="red">*</font></td>
						<td style="background:white;" id="petitum_text">
							<?php echo $this->ckeditor->editor("petitum",$petitum);?>
						</td>
					</tr>
					<?php if($this->session->userdata('jenis_pengadilan')==1 AND $idalurperkara>=111 AND $idalurperkara!=119){ ?>
					<tr>
						<td>Pasal Dakwaan<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<textarea type="text" id='pasal_dakwaan' name='pasal_yang_didakwakan' style="width: 812px; height: 90px;resize: none; font-size:13px; padding-left:10px"><?php echo (!empty($pasal_dakwaan) ? $pasal_dakwaan : '');?></textarea>
						</td>
					</tr>
					<?php } ?>				
					<tr>
						<td colspan="2" style="background:white;border:0px;" align="center">
							<input type="button" id='close_form_dataumum' value="Kembali" class="btn">
							<input type="submit" id="simpan" value="Simpan" class="btn">
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
</div>
<?php
$tmp = explode('/',$noPerkara);
if($this->session->userdata('jenis_pengadilan')==2){
	$tmp[0] = str_replace('-K', '', $tmp[0]);
	$tmp[1] = str_replace('-P', '', $tmp[0]);
}
?>;
<script type="text/javascript">
<?php
if ($this->session->userdata('jenis_pengadilan')==4){
	echo "function hide_tr(){ ";
	echo "	if($('#klasifikasi').val()=='347' || $('#klasifikasi').val()=='346'){";
	echo "		$('.cerai').show();";
	echo "	}else{
				$('.cerai').hide();
			};";
	echo "}";
	echo "hide_tr();";
}
?>
function generateNomorPerkara(){
	openLoadingDialog()
	var val = $('#klasifikasi').val();
	var enc = '<?php echo base64_encode($this->encrypt->encode($idalurperkara)); ?>';
	var urutan = '<?php echo base64_encode($this->encrypt->encode($tmp[0]));?>';
	var date = '<?php echo $this->tanggalhelper->convertToInputDate($tglPendaftaran);?>';
	<?php
		if($this->session->userdata('jenis_pengadilan')==2){
			echo "var matra = $('#matra').val();";
		}elseif ($this->session->userdata('jenis_pengadilan')==4){
			echo "hide_tr();";
		}
	?>
	
	$("#klas_perkara option[value='-1']").remove();
	$.post('<?php echo $idalurperkara<100? base_url("manageDataUmum/getFormat") : base_url("manageDataUmum/getFormat");?>', {
		enc: enc,
		val:val,
		urutan:urutan,
		<?php
		if($this->session->userdata('jenis_pengadilan')==2){
			echo "matra:matra,";
		}
		?>
		date:date
	}, function(response){
		var json = jQuery.parseJSON(response);
		if(json.st==1){
			$('#no_perkara').text(json.msg);
			$('.nomor_perkara').val(json.msg);
			if(val==346 || val==347 || val==64 || val==312 || val==248 || val==98 || val==224 || val==137 || val==65)
				$('#aktif').val('T');
			else
				$('#aktif').val('Y');
			<?php
				if($idalurperkara==118){
					echo "$('#aktif').val('T');";
				}
			?>
		}else{
			message_error_show(json.msg);
		}
		closeLoading()
	});
}
var idalurperkara="<?php echo $idalurperkara;?>";
if(idalurperkara<100){
	window.pospet_text='petitum_text,posita_text';
	window.pospet='petitum,posita';	
}else{
	window.pospet_text='petitum_text';
	window.pospet='petitum';	
}


$('#frm_data_umum').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_dataumum',
	whenStatus:1,
	isCKEdit:1,
	tdID:window.pospet_text,
	textID:window.pospet
	/*,
	upload:1,
	urlUpload:"<?php echo base_url('manageDataUmum/validatePost');?>"*/
});
$('#close_form_dataumum').closingFormWin();
$('#tgl_surat').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($('#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;
        	}
      	});
$('#tgl_surat_dakwaan').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($('#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;
        	}
      	});
$('.datepicker').ValidateDateInput();
$(document).ready(function() {
    $('#nilai_sengketa').ForceNumericOnly();
    $('#nilai_sengketa').autoNumeric('init', {mDec: '0'});

});
</script>