<div class="centering" style="width:450px;margin-top: 1%;">
	<div id='pihak_pilih' style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
		<form id="frm_user" style="background:white;margin:0;" method="post" action="<?php echo base_url().'addPihak/validateInput';?>">
			<table id="tableDetilPerkara" style="font-size:14px;">
				<col width="41%">
				<col width="59%">
				<tbody>
					<tr>
						<td colspan="2" style='text-align:center;background:white;border:0px;font-size: 20px;color: #648C03;'><?php echo $title; ?></td>
					</tr>
					<tr>
						<td>No Urut<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='no_urut' name='no_urut' value="<?php echo $urutan;?>" class="standard-input" maxlength="10" readonly="readonly" style="width:50px;">
						</td>
					</tr>
					<?php if($pihak_ke==13){ ?>
					<tr>
						<td>Yang Menghadirkan<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald">
								<select name="saksi_pihak_ke" id="saksi_pihak_ke" class="custom-dropdown__select custom-dropdown__select--white" style="width:200px;">
								<option value="1" <?php if(!empty($saksi_pihak_ke)&&$saksi_pihak_ke==1){echo "selected";}?>><?php echo $this->nativesession->getStatusPihak(10,$idalurperkara,1);?></option>
								<option value="2" <?php if(!empty($saksi_pihak_ke)&&$saksi_pihak_ke==2){echo "selected";}?>><?php echo $this->nativesession->getStatusPihak(10,$idalurperkara,2);?></option>
								<?php if($idalurperkara<100 AND $idalurperkara!=8 AND $idalurperkara!=17){ ?>
								<option value="3" <?php if(!empty($saksi_pihak_ke)&&$saksi_pihak_ke==3){echo "selected";}?>><?php echo $this->nativesession->getStatusPihak(10,$idalurperkara,3);?>ccc</option>
								<?php } ?>
							</span>
						</td>
					</tr>
					<tr>
						<td>Jenis Saksi<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald">
								<select name="jenis_saksi" id="jenis_saksi" class="custom-dropdown__select custom-dropdown__select--white" style="width:200px;">
									<?php 
										if($this->session->userdata('jenis_pengadilan')==1 AND ($idalurperkara>100)){
											$dewasa = 'Saksi Dewasa';
										}else{
											$dewasa = 'Saksi';
										}
									?>
									<option value="1" <?php echo ($jenis_saksi==1)? 'selected': '';?>><?php echo $dewasa; ?></option>
									<?php if($this->session->userdata('jenis_pengadilan')==1 AND ($idalurperkara>100)){?>
									<option value="3" <?php echo ($jenis_saksi==3)? 'selected': '';?>>Saksi Anak</option>
									<?php } ?>
									<option value="2" <?php echo ($jenis_saksi==2)? 'selected': '';?>>Ahli</option>
							</span>
						</td>
					</tr>
					<?php } ?>
					<tr style="display:none;">
						<td>Pihak <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='pihak' name='pihak' value="<?php echo $pihak_ke_text;?>" class="standard-input" maxlength="10" readonly="readonly" style="width:100px;">
							<input type="hidden" id='pihak_ke' name="pihak_ke" value="<?php echo $pihak_ke;?>">
						</td>
					</tr>
					<tr <?php echo ($this->session->userdata('jenis_pengadilan')==2)? 'hidden':''; ?> >
						<td>Jenis Pihak<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='jenis_pihak' name='jenis_pihak' value="<?php echo (!empty($jenisPihak) ? $jenisPihak : '');?>" class="standard-input" maxlength="2" readonly="readonly" style="width:100px;" readonly="readonly">
						</td>
					</tr>
					<?php
					if($this->session->userdata('jenis_pengadilan')==2){
					?>
					<tr class="iftni">
						<td>NRP</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='nrp' name='nrp' value="<?php echo (!empty($nrp) ? $nrp : '');?>" class="standard-input" maxlength="50">
						</td>
					</tr>
					<tr class="iftni">
						<td>Pangkat</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='pangkat' name='pangkat' value="<?php echo (!empty($pangkat) ? $pangkat : '');?>" class="standard-input" maxlength="100">
						</td>
					</tr>
					<tr class="iftni">
						<td>Jabatan</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='jabatan' name='jabatan' value="<?php echo (!empty($jabatan) ? $jabatan : '');?>" class="standard-input" maxlength="100">
						</td>
					</tr>
					<tr class="iftni">
						<td>Kesatuan</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='kesatuan' name='kesatuan' value="<?php echo (!empty($kesatuan) ? $kesatuan : '');?>" class="standard-input" maxlength="100">
						</td>
					</tr>
					<?php
					}					
					?>
					<tr>
						<td>Nama <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<?php $url = base_url('pihak_list/');?>
							<input type="text" id='fullname' name='fullname' value="<?php echo (!empty($nama) ? $nama : '');?>" class="standard-input" maxlength="255" style="width:150px;" readonly="readonly">
							<input type="button" onClick="<?php echo $popup==5?'popup_form5th':'popup_form2nd'; ?>('<?php echo $url;?>')" value="Cari" style="padding: 7px 0;color:white;background: #7f8c8d;border: 0 none;  -webkit-border-radius: 0 0 0 0;width: 90px;">
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Tempat Lahir <?php echo ($pihak_ke==1 && ($this->session->userdata('jenis_pengadilan')!=3))? '<font color="red">*</font>':'';?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='tempat_lahir' name='tempat_lahir' value="<?php echo (!empty($tempatLahir) ? $tempatLahir : '');?>" class="standard-input" maxlength="255" readonly="readonly"> </td>
					</tr>
										
					<tr class="tr_perorangan">
						<td>Tanggal Lahir <?php echo ($pihak_ke==1 && ($this->session->userdata('jenis_pengadilan')!=3))? '<font color="red">*</font>':'';?></td>
						<td style="padding:0px;padding-left:5px;">
							<input id="tgl_lahir" name="tgl_lahir" value="<?php echo (!empty($tglLahir) ? $tglLahir : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun" readonly="readonly">
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Umur <?php echo ($pihak_ke==1 && ($this->session->userdata('jenis_pengadilan')!=3))? '<font color="red">*</font>':'';?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='umur' name='umur' value="<?php echo (!empty($umur) ? $umur : '');?>" class="standard-input" maxlength="2" readonly="readonly" style="width:50px;" readonly="readonly">
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Jenis Kelamin <?php echo ($pihak_ke==1 && ($this->session->userdata('jenis_pengadilan')!=3))? '<font color="red">*</font>':'';?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='jenis_kelamin' name='jenis_kelamin' value="<?php echo (!empty($sex) ? $sex : '');?>" class="standard-input" maxlength="255" readonly="readonly">
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Warga Negara<font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='warga_negara' name='warga_negara' value="<?php echo (!empty($wargaNegara) ? $wargaNegara : '');?>" class="standard-input" maxlength="255" readonly="readonly">
						</td>
					</tr>
					<tr>
						<td>Alamat <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<textarea class="standard-input" id="alamat" name = "alamat" maxlength="500" style="width: 245px; height: 70px;resize: none;" readonly><?php echo (!empty($alamat) ? $alamat : '');?></textarea>
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Pekerjaan <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='pekerjaan' name='pekerjaan' value="<?php echo (!empty($pekerjaan) ? $pekerjaan : '');?>" class="standard-input" maxlength="255" readonly="readonly">
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Status Kawin <?php echo ($pihak_ke==1 && ($this->session->userdata('jenis_pengadilan')!=3))? '<font color="red">*</font>':'';?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='statusKawin' name='statusKawin' value="<?php echo (!empty($kawin) ? $kawin : '');?>" class="standard-input" maxlength="255" readonly="readonly">
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Pendidikan <?php echo ($pihak_ke==1 && ($this->session->userdata('jenis_pengadilan')!=3))? '<font color="red">*</font>':'';?></td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='pendidikan' name='pendidikan' value="<?php echo (!empty($pendidikan) ? $pendidikan : '');?>" class="standard-input" maxlength="255" readonly="readonly">
						</td>
					</tr>
					<tr class="tr_perorangan">
						<td>Berkebutuhan Khusus</td>
						<td style="padding:0px;padding-left:5px;">
							<input type="text" id='difabel' name='difabel' value="<?php echo (!empty($difabel) ? $difabel : '');?>" class="standard-input" maxlength="255" readonly="readonly">
						</td>
					</tr>
					<?php
					if($pihak_ke==3){ 
					?>
					<tr>
						<td>Tergabung Ke Pihak <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
								<select name="tergabung_ke" id="tergabung_ke" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
									<option value="-1">Pilih Tergabung</option>
									<option value="1" <?php echo ($tergabung_ke==1)? 'selected': '';?>>Penggugat</option>
									<option value="2" <?php echo ($tergabung_ke==2)? 'selected': '';?>>Tergugat</option>
									<option value="3" <?php echo ($tergabung_ke==3)? 'selected': '';?>>Sendiri</option>
								</select>
							</span>
						</td>
					</tr>
					<?php if($this->session->userdata('jenis_pengadilan')==1 OR $this->session->userdata('jenis_pengadilan')==4){ ?>
					<tr>
						<td>Jenis Intervensi <font color="red">*</font></td>
						<td style="padding:0px;padding-left:5px;">
							<span class="custom-dropdown custom-dropdown--emerald" style='width:180px;'>
								<select name="jenis_intervensi" id="jenis_intervensi" style='width:180px;' class="custom-dropdown__select custom-dropdown__select--white">
									<option value="-1">Pilih Jenis Intervensi</option>
									<option value="2" <?php echo ($id_intervensi==2)? 'selected': '';?>>Tussenkomst</option>
									<option value="1" <?php echo ($id_intervensi==1)? 'selected': '';?>>Voeging</option>
									<option value="3" <?php echo ($id_intervensi==3)? 'selected': '';?>>Vrijwaring</option>
								</select>
							</span>
						</td>
					</tr>
					<?php } ?>					
					<tr>
						<td>Tanggal Izin Intervensi<font color="red">*</font> </td>
						<td style="padding:0px;padding-left:5px;">
							<input id="pihak_tgl_intervensi" name="pihak_tgl_intervensi" value="<?php echo (!empty($tgl_intervensi)? $tgl_intervensi:'');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
						</td>
						<input type="hidden" id="curr_date" value="<?php echo $current_date;?>">
					</tr>					
					<script type="text/javascript">
						$('#pihak_tgl_intervensi').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_show(message);
										$(this).css("background-color", "red");
									}else{
										$(this).css("background-color", "#dedbdb");
									}
									error = 0;
					        	}
					      	});
						$('#pihak_tgl_pengajuan').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
									}
									if(error==1){
										message_show(message);
										$(this).css("background-color", "red");
									}else{
										$(this).css("background-color", "#dedbdb");
									}
									error = 0;
					        	}
					      });
						$('.datepicker').ValidateDateInput(); 
					</script>
					<?php
					}
					?>
					
					<tr>
						<td>Keterangan</td>
						<td style="padding:0px;padding-left:5px;border:0px;">
							<textarea class="standard-input" id="keterangan" name ="keterangan" style="width: 245px; height: 70px;resize: none;"><?php echo (!empty($keterangan) ? $keterangan : '');?></textarea>
						</td>
						<input type="hidden" id='enc_pihak' name="enc_pihak" value="<?php echo (!empty($enc_pihak) ? $enc_pihak : '');?>">
						<input type="hidden" id='enc' name="enc" value="<?php echo $enc;?>">
						<input type="hidden" id='act' name="act" value="<?php echo $enc_act;?>">
						<input type="hidden" id='enc_id' name="enc_id" value="<?php echo $enc_id;?>">
						<input type="hidden" name="safs1" value="<?php echo $alurperkaraid;?>">
					</tr>
					<tr>
						<td colspan="2" style="background:white;border:0px;" align="center">
							<input type="button" id='close_form_add_pihak' value="Kembali" class="btn">
							<?php
							$usergroup = $this->session->userdata('idgroup');
							if ($this->authorization->HasRuleEditPendaftaran($idalurperkara, $idperkara) OR $usergroup==20 OR $usergroup==30 OR $usergroup==410 OR $usergroup==420 OR $usergroup==430 OR $usergroup==440 OR $usergroup==450 
								OR $usergroup==460 OR $usergroup==470 OR $usergroup==480 OR $usergroup==1000 OR $usergroup==1010 OR $usergroup==1020 OR $usergroup==1030 OR $usergroup==500){
								$act = $this->encrypt->decode(base64_decode($enc_act));
								if($act=="edit"){
									echo '<input type="submit" id="hapus" value="Hapus" class="btn btn-danger" onclick="return false;">';
								}
								echo '<input style="margin-left:3px" type="submit" id="simpan" value="Simpan" class="btn">';
							}
							?>
						</td>
						<input type="hidden" id="refresh" class='detil_perkara_refresh' value="0">
					</tr>
				</tbody>
			</table>
		</form>
		</div>
	</div>
</div>
<script type="text/javascript">
$('#close_form_add_pihak').<?php echo $popup==5?'closingForm4thWin':'closingFormWin'; ?>();
$(".detil #refresh").change(function(){
	refreshPihakList()
});
function refreshPihakList(){
	$("#popup_form_2nd").remove();
	popup_form2nd('<?php echo base_url("pihak_list");?>');
}

$('#frm_user').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_add_pihak',
	whenStatus:1,
	next_step:1
});

$('#hapus').ButtonClickHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#konten',
	clicked:1,
	btnClicked:'#close_form_add_pihak',
	whenStatus:1,
	actions:'<?php echo base_url()?>addPihak/validateDelete',
	formName:'#frm_user',
	actionName:'Hapus Data'
});
</script>