<div class="centering" style="width:1024px;margin-top: 3%;">
	<div id='ortu' style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
			<form id="frm_ortu" style="background:white;margin:0;" method="post" action="<?php echo base_url().'addPengacara/validateInput';?>">
				<table id="infoPerkara" style="font-size:14px;width:100%">
					<tbody>
						<tr>
							<td style='text-align:center;background:white;border:0px;font-size: 20px;color: #648C03;' align="center">TAMBAH / EDIT DATA ORANG TUA / WALI</td>
						</tr>
						<tr>
							<td>
								<div class="cssTable" style="margin:0px;border:0px;">
								<?php
								if($list_anak!=''){
									if($list_anak->num_rows>0){
								?>
									<table id="tableinfo" style="margin:0px;padding:0px;">
										<col width="5%">
										<col width="35%">
										<col width="35%">
										<col width="15%">
										<col width="10%">
										<tbody>
											<tr>
												<td>No</td>
												<td>Nama Anak</td>
												<td>Orang Tua/Wali</td>
												<td colspan="2">Pilih</td>
											</tr>
									<?php
									$i=1;
									foreach ($list_anak->result() as $row) {
										echo "<tr>";
											echo "<td>".$i."</td>";
											echo "<td>".$row->nama."</td>";
											echo "<td>".$row->wali."</td>";
											$idpihak = base64_encode($this->encrypt->encode($row->pihak_id));
											$enc_id = base64_encode($this->encrypt->encode($row->id));
											if($jenis_data==24){
												echo '<td align="center"> [<a href="#" style="cursor:pointer;" onClick="popup_form2nd(\''.base_url('get_list_pihak/'.$enc.'/ortudiversi/'.$idpihak.'/'.$jenis_pihak).'\')">Tambah/Edit<?a>]</td>';	
												echo '<td align="center"> [<a href="#" style="cursor:pointer;" onClick="delOrtu(\''.$enc.'\',\''.$idpihak.'\')">Hapus</a>]</td>';
											}else if($jenis_data==25){
												echo '<td align="center"> [<a href="#" style="cursor:pointer;" onClick="popup_form2nd(\''.base_url('get_list_pihak/'.$enc.'/ortudiversi_korban/'.$idpihak.'/'.$jenis_pihak).'\')">Tambah/Edit<?a>]</td>';																
												echo '<td align="center"> [<a href="#" style="cursor:pointer;" onClick="delOrtu(\''.$enc.'\',\''.$idpihak.'\')">Hapus</a>]</td>';
											}																					
										echo "</tr>";
										$i++;
									}?>
										</tbody>
									</table>
								<?php
									}
								}
								?>
								</div>
							</td>
							<input type="hidden" id='jenis_pihak_anak' value="<?php echo $jenis_pihak;?>">
						</tr>
						<tr>
							<td colspan="1" style="background:white;border:0px;" align="center">
								<input type="button" id='close_form_add_ortu' onClick="goback()" value="Kembali" class="btn">
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>
</div>
<script type="text/javascript">
function goback(){
	$('#popup_form').fadeOut();
    $("#popup_form").remove();
    $(".detil_perkara_refresh").val(1).trigger('change');
    location.reload();
    closeLoading();
}
$('#close_form_add_ortu').closingFormWin();

function delOrtu(enc,enc_anak){
	var jenis_pihak = '<?php echo $jenis_pihak;?>'
	var jenis_data = '<?php echo $jenis_data;?>'
	if(enc == ''){
		message_show('Error. Please Refresh');
		return;
	}
	if(enc_anak == ''){
		message_show('Error. Please Refresh');
		return;
	}
	openLoadingDialog();
	var status = 1;
	$.post('<?php echo base_url()?>addOrtuDiversi/validateDelete/'+jenis_data, {
		enc:enc,
		enc_anak:enc_anak
		}, function(response){
			var json = jQuery.parseJSON(response);
			closeLoading()
			message_show(json.msg);
			status = json.st;
			return;
		});
	if(status==0){
		return;
	}
	refreshOrtuList(jenis_pihak);
}


</script>