<div class="centering" style="width:500px;margin-top: 1%;">
		<div id='pihak_pilih' style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
		<form id="frm_pihak" style="background:white;margin:0;">
			<table id="tableDetilPerkara" class="table_pihak_pilih" style="font-size:14px;">
				<col width="30%">
				<col width="50%">
				<tbody>
					<tr>
						<td colspan="2" style='text-align:center;background:#fff;color:#5fb85c;border:2px solid #fff;margin-bottom:10px;font-size: 20px;'>Pilih Pihak</td>
					</tr>
					<tr>
						<td>Penggugat</font></td>
						<td style="padding:0px;padding-left:5px;">
							<?php
							if($pihak1!=''){
								if($pihak1->num_rows>0){
									foreach ($pihak1->result() as $row) {
										//$chck = ($act=='edit')? 'checked':'';
										echo '<input type="checkbox" name="chk_para_pihak" value="'.$row->pihak_id.'"> '.$row->nama.'<br>';
									}
								}
							}
							?>
						</td>
					</tr>
					<tr>
						<td>Tergugat </td>
						<td style="padding:0px;padding-left:5px;">
							<?php
							if($pihak2!=''){
								if($pihak2->num_rows>0){
									foreach ($pihak2->result() as $row) {
										//$chck = ($act=='edit')? 'checked':'';
										echo '<input type="checkbox" name="chk_para_pihak" value="'.$row->pihak_id.'"> '.$row->nama.'<br>';
									}
								}
							}
							?>
						</td>
					</tr>
					<tr>
						<td>Pengacara </td>
						<td style="padding:0px;padding-left:5px;">
							<?php
							if($pihak4!=''){
								if($pihak4->num_rows>0){
									foreach ($pihak4->result() as $row) {
										//$chck = ($act=='edit')? 'checked':'';
										echo '<input type="checkbox" name="chk_para_pihak" value="'.$row->pihak_id.'"> '.$row->nama.'<br>';
									}
								}
							}
							?>
						</td>
					</tr>
					<tr>
						<td>Intervensi </td>
						<td style="padding:0px;padding-left:5px;">
							<?php
							if($pihak3!=''){
								if($pihak3->num_rows>0){
									foreach ($pihak3->result() as $row) {
										//$chck = ($act=='edit')? 'checked':'';
										echo '<input type="checkbox" name="chk_para_pihak" value="'.$row->pihak_id.'"> '.$row->nama.'<br>';
									}
								}
							}
							?>
						</td>
					</tr>
					<tr>
						<td>Turut Tergugat </td>
						<td style="padding:0px;padding-left:5px;">
							<?php
							if($pihak4!=''){
								if($pihak4->num_rows>0){
									foreach ($pihak4->result() as $row) {
										//$chck = ($act=='edit')? 'checked':'';
										echo '<input type="checkbox" name="chk_para_pihak" value="'.$row->pihak_id.'"> '.$row->nama.'<br>';
									}
								}
							}
							?>
						</td>
					</tr>
					
					<tr>
						<td colspan="2" style="background:white;border:0px;" align="center">
							<input type="button" id='close_form_pihak' value="Kembali" class="btn">
							<input type="button" id="simpan_pihak" value="Simpan" class="btn">
						</td>
					</tr>
					</tr>
				</tbody>
			</table>
		</form>
</div>
<script type="text/javascript">
$('#close_form_pihak').closingFormWin();

$("#simpan_pihak").click(function() {	
	var checkboxes = document.querySelectorAll('input[name="chk_para_pihak"]:checked'), values = [];
    Array.prototype.forEach.call(checkboxes, function(el) {
        values.push(el.value);
    });
    var val=values;

	openLoadingDialog();
	$.post('<?php echo base_url()?>add_delegasi/fetchPihak', {
		val
	}, function(response){
		var json = jQuery.parseJSON(response);
		closeLoading()
		if(json.st==1){
			$('#idparapihak').val(json.idparapihak);
			$('#parapihaknama').val(json.parapihaknama);
		}else if(json.st==0){
			message_error_show_parent(json.msg);
			return
		}
	});
});

</script>