<script type="text/javascript" src="<?php echo base_url();?>resources/js/jquery.simplePagination.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>resources/css/simplePagination.css"/>
<div id="popup_mediator_list" class="centering" style="width:98%;margin-top: 1%;">
	<div style="border: 1px solid #ffffff;">
		<div class="detil" style="padding: 2px;background-color: white;">
		<div style="text-align:center;background-color:white;color:#5fb85c;border:2px solid #fff;margin:;font-size:20px;height:35px;"><span style="position: relative;top: 15%;transform: translateY(-15%);"><?php print $judulatas;?></span></div>
		<hr class="thick-line" style="clear:both;">
		<div id="left">
		<?php
			$attributes = array('name' => 'keyword_mediator', 'id' => 'search-box','type' => 'text','size' => '50','placeholder'=>"  Ketik kata kunci  ");
			echo form_input($attributes);
			echo "<span>  </span>";
			$attributes = array('value' => 'Search', 'class' => 'btn', 'id' => 'btn_search', 'type' => 'button');
			echo form_input($attributes);
		?>
	</div>
	<div id="right" style="margin-top: 0px;margin-right: 6px;"><input type="button" id='close_form_2nd' value="Kembali" class="del_btn"></div>
	<div id="pages" >
    	<div id="selector" style="padding: 4px 5px 5px 0;"></div>
    </div>
	<div class="cssTable">
		<table id="tablePerkaraAll">
			<col  width="5%" />
			<col  width="3%" />
			<col  width="46%" />
			<col  width="23%" />
			<col  width="23%" />
        	<tbody>
				<tr id="tampil_cari">
					<td>Proses</td>
					<td>No</td>
					<td onclick="sorting(1)">Nama</td>
					<td onclick="sorting(2)">Nomor Sertifikat</td>
					<td onclick="sorting(3)">Profesi</td>
				</tr>
					<?php
					$no=1;
					if($data_mediator!=''){
						if($data_mediator->num_rows()>0){
							foreach ($data_mediator->result() as $var){
	                           if($var->status_mediator=='N'){
	                                $status_text='Non-Hakim';
	                            }else if($var->status_mediator=='H'){
									$status_text='Hakim';
								}else if($var->status_mediator=='P'){
									$status_text='Pegawai';
	                            }else{
	                            	$status_text="-";
	                            }
								echo "<tr class='tr_body_show'>";
									echo '<td><a href="#" onclick="pilih('."'".clear_nama($var->nama)."','".$nilai_var."','".base64_encode($this->encrypt->encode($var->id))."','".$var->status_mediator."','".$var->id."'".')">Pilih</a></td>';
									echo "<td style='text-align:center; vertical-align:top;'>".$no."</td>";
									echo "<td style='text-align:left; vertical-align:top;'>".$var->nama."</td>";
									echo "<td style='text-align:left; vertical-align:top;'>".$var->no_sertifikasi."</td>";
									echo "<td style='text-align:left; vertical-align:top;'>".$status_text."</td>";
								echo "</tr>";
								$no++;
							}
						}else{
							echo "<td colspan='5'>Data tidak ditemukan</td>";
						}
					}else{
						echo "<td colspan='5'>Data tidak ditemukan</td>";
					}
					?>
			</tbody>
		</table>
	</div>
	<div id="pages_bottom" style="width:100%;padding-left:5px;padding-top:5px;">
    	<div id="selector_bottom"></div>
	</div>
		<div style="margin:bottom:5px;"></div>
	</div>
	</div>
</div>
<?php
	function clear_nama($text){
		return str_replace("'", "\'", $text);
	}
?>
<script type="text/javascript">
function pilih(nama,nilai,mediator_id,status,id){
	$('.enk_id'+nilai).val(id);
	$('#close_form_2nd').click();
	$('#mediator'+nilai).val(nama);
	$('.status'+nilai).val(status);
	$('.mediator_id'+nilai).val(mediator_id);
}
$('#close_form_2nd').<?php echo $popup==5?'closingForm5thWin':'closingForm2ndWin'; ?>();
$(function() {
    var totalPage='<?php echo $total_data; ?>';
    var page='<?php echo $page_number;?>';
    var nama='<?php echo $nama;?>';
    var id_popup='<?php echo $nilai_var;?>'
    var searchField=$('#search-box').val();
    var profesi='<?php echo $status_mediator;?>';
    $('#selector').pagination({
        items:totalPage,
        itemsOnPage:20,
        displayedPages:3,
        cssStyle:'light-theme',
        currentPage:page,
        onPageClick: function(pageNumber){
            $("#form_pop_2nd").load('<?php echo base_url('popup_mediator');?>'+'/'+pageNumber+'/'+id_popup+'/'+profesi+'/'+searchField+'');
        	sessionStorage.setItem('hal',JSON.stringify(pageNumber));
        	}
        });

  	$("#btn_search").click(function () {
		var profesi='<?php echo $status_mediator;?>';
		var searchField=$('#search-box').val();
		var nilai='<?php echo $nilai_var;?>';
		var page=sessionStorage.getItem('hal');
		$.ajax({
			type:"POST",
			url:'<?php echo base_url('popup_mediator');?>'+'/'+0+'/'+nilai+'/'+profesi+'/'+searchField+'',
			data: {
				domain:$('input[name="keyword_mediator"]').val(),
				width:$(window).width()
			},
	      	success: function(data) {
	        	$("#form_pop_2nd").html(data).show();
	      	}
		});
	})
});
</script>
