<div style="padding:10px;"></div>
<div class="detil" style="padding: 4px;font-size:14px;margin-top:25px;width: 45%;margin: 0 auto;border-color: #FFFFFF;">
	<form id="frm_parapihak_pk" style="padding: 4px;background:white;margin:0;" method="post" action="<?php echo base_url().'saveparapihakpk/validateInput';?>">
		<table id="tableDetilPerkara" style="font-size:14px;">
			<col width="30%">
			<col width="50%">
			<col width="20%">
			<?php
				if($infopihak!=''){
					if($infopihak->num_rows>0){
						foreach ($infopihak->result() as $row) {
							$diwakili = ($row->pihak_diwakili=='Y')? 1:0;
							$namapihak = $row->pihak_nama;
							$statusasal = $row->pihak_asal_text;
							$statuspk = $row->status_pihak_text;
							$noperkarapn = $row->nomor_perkara_pn;
							$tglpermohonan = $this->tanggalhelper->convertDayDate($row->permohonan_pk);
							$idpihak = base64_encode($this->encrypt->encode($row->pihak_id));
							$pemohon = $row->pemohon_nama;
							$pemohonalamat = $row->pemohon_alamat;
							$pemohonpekerjaan = $row->pemohon_pekerjaan;
							$noSurat = $row->pemohon_nomor_surat;
							$tglSurat = $this->tanggalhelper->convertToInputDate($row->pemohon_tanggal_surat);
						}
					}
				}else{
					show_404();
				}
			?>
			<tbody>
				<tr id="tr_pihak">
					<input type="hidden" id="refresh" value="0">
					<input type="hidden" id="enc_id" name="enc_id" value="<?php echo $enc_id;?>">
					<input type="hidden" id="enc_pihak" name="enc_pihak" value="<?php echo (!empty($idpihak) ? $idpihak : '');?>">
					<td colspan="3" class="divider">EDIT DATA KUASA DARI PIHAK PEMOHON</td>
				</tr>
				<tr>
					<td>Nomor Perkara<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2"><?php echo (!empty($noperkarapn) ? $noperkarapn : '');?></td>
				</tr>
				<tr>
					<td>Tanggal Permohonan<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2"><?php echo (!empty($tglpermohonan) ? $tglpermohonan : '');?></td>
				</tr>
				<tr>
					<td>Status Pihak<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2"><?php echo (!empty($statuspk) ? $statuspk : '');?></td>
				</tr>
				<tr>
					<td>Status Asal<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2"><?php echo (!empty($statusasal) ? $statusasal : '');?></td>
				</tr>
				<tr>
					<td>Nama Pihak<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2"><?php echo (!empty($namapihak) ? $namapihak : '');?></td>
				</tr>
				<tr>
					<td >Pihak Diwakili<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2">
						<span class="custom-dropdown custom-dropdown--emerald" style='width:80px;'>
							<select name="diwakilkan" id="diwakilkan" style="width:80px;" class="custom-dropdown__select custom-dropdown__select--white">
								<option value="2" <?php if($diwakili==0){echo 'selected';}?> >Tidak</option>
								<option value="1" <?php if($diwakili==1){echo 'selected';}?>>Ya</option>
							</select>
						</span>
					</td>
				</tr>
				<tr class ="tr_pemohon">
					<td colspan="3" class="divider">PEMOHON PK</td>
				</tr>
				<tr class ="tr_pemohon">
					<td>Nama Pemohon<font color="red">*</font></td>
					<td style="padding:0px;padding-left:5px;" colspan="2">
						<input type="text" id='fullname' name='fullname' value="<?php echo (!empty($pemohon) ? $pemohon : '');?>" class="standard-input" maxlength="255" style="width:250px;" readonly="readonly">
						<input type="button" onClick="popup_form2nd('<?php echo base_url('pihak_list');?>')" 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_pemohon">
					<td>Pekerjaan Pemohon</td>
					<td style="padding:0px;padding-left:5px;" colspan="2">
						<input type="text" id='pekerjaan' name='pekerjaan' value="<?php echo (!empty($pemohonpekerjaan) ? $pemohonpekerjaan : '');?>" class="standard-input" maxlength="255" style="width:250px;" readonly="readonly">
					</td>
				</tr>
				<tr class ="tr_pemohon">
					<td>Alamat Pemohon</td>
					<td style="padding:0px;padding-left:5px;" colspan="2">
						<textarea class="standard-input" id="alamat" name = "alamat"  style="width: 250px; height: 90px;resize: none;" readonly><?php echo (!empty($pemohonalamat) ? $pemohonalamat : '');?></textarea>
					</td>
				</tr>
				<tr id="tr_tgl_kuasa" class ="tr_pemohon">
					<td>Tanggal Surat Kuasa</td>
					<td style="padding:0px;padding-left:5px;" colspan="2">
						<input id="tgl_surat_kuasa" name="tgl_surat_kuasa" value="<?php echo (!empty($tglSurat) ? $tglSurat : '');?>" class="datepicker" maxlength="10" placeholder="tgl/bln/tahun">
					</td>
				</tr>
				<tr class ="tr_pemohon">
					<td>Nomor Surat Kuasa</td>
					<td style="padding:0px;padding-left:5px;" colspan="2">
						<input type="text" id='no_kuasa' name='no_kuasa' value="<?php echo (!empty($noSurat) ? $noSurat : '');?>" style="width:250px;" class="standard-input" maxlength="255">
					</td>
				</tr>
				<tr>
					<td colspan="2" style="background:white;border:0px;" align="center">
						<input type="button" id='close_form_parapihak' value="Kembali" class="btn">
						<input type="submit" id="simpan" value="Simpan" class="btn">
					</td>
				</tr>
			</tbody>
		</table>
	</form>
</div>
<script type="text/javascript">
function refreshPihakList(){
    $("#popup_form2nd").remove();
    popup_form2nd('<?php echo base_url("pihak_list");?>');
}

$('#close_form_parapihak').closingFormWin();
var diwakili = '<?php echo $diwakili;?>';
$( document ).ready(function() {
	if(diwakili==1){
		$('.tr_pemohon').show();
	}else{
		$('.tr_pemohon').hide();
	}

	$('#frm_parapihak_pk').on('change', '#diwakilkan', function(){
		if($(this).val()==1){
			$('.tr_pemohon').show();
		}else{
			$('.tr_pemohon').hide();
		}
	});
	$('.datepicker').ValidateDateInput();
	$('#tgl_surat_kuasa').datepicker({
            inline: true,
            showOtherMonths: true,
            dateFormat: 'dd/mm/yy',
            dayNamesMin: ['Ming', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab'],
            onSelect: function(dateText, inst) {
            	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");
				}
        	}
      	});

});

$('#frm_parapihak_pk').SubmitHandling({
	refresh:'1',
	setRefresh:1,
	divRef:'#frm_parapihak_pk',
	clicked:1,
	btnClicked:'.close_form',
	whenStatus:1
});
</script>