<?php
$actionName = "GlobalConfiguration";
if($this->session->userdata('is_logged_in')){
	$AuthorizationForm = $this->nativesession->get('getAuthorizationAction');
	if($this->authorization->isAuthorized($actionName,$AuthorizationForm)==FALSE){
		redirect('login');
	}
}else{
	redirect('login');
}
if($this->session->userdata('jenis_pengadilan')==1){
?>
	<hr class="thick-line" style="clear:both;">
	<div>
		<div style="padding:20px;"></div>
		<div class="cssTable" style="font-size:14px;margin-top:25px;width: 80%;margin: 0 auto;border-color: #FFFFFF;">
				<table style="font-size:14px;">
					<col width="5%">
					<col width="30%">
					<col width="35%">
					<col width="10%">
					<col width="20%">
					<tbody>
						<tr>
							<td>No</td>
							<td>Menu</td>
							<td>Keterangan</td>
							<td style='text-align:center;'>Status</td>
							<td style='text-align:center;'>Action</td>
						</tr>
						<tr>
							<td>1</td>
							<td>Kepailitan Dan PKPU</td>
							<td>Register Kepailitan Dan PKPU</td>
							<td style='text-align:center;' id="st_1"><?php echo $pkpu;?></td>
							<td style='text-align:center;'><a href="#" onClick="doActive(1)">Enable</a>|<a href="#" onClick="doDeactive(1)">Disable</a></td>
						</tr>
						<tr>
							<td>2</td>
							<td>Hak Kekayaan Intelektual</td>
							<td>Register Hak Kekayaan Intelektual</td>
							<td style='text-align:center;' id="st_2"><?php echo $hki;?></td>
							<td style='text-align:center;'><a href="#" onClick="doActive(2)">Enable</a>|<a href="#" onClick="doDeactive(2)">Disable</a></td>
						</tr>
						<tr>
							<td>3</td>
							<td>Pengadilan Hubungan Industri</td>
							<td>Register Pengadilan Hubungan Industri</td>
							<td style='text-align:center;' id="st_3"><?php echo $phi;?></td>
							<td style='text-align:center;'><a href="#" onClick="doActive(3)">Enable</a>|<a href="#" onClick="doDeactive(3)">Disable</a></td>
						</tr>
						<tr>
							<td>4</td>
							<td>Hak Asasi Manusia</td>
							<td>Register Hak Asasi Manusia</td>
							<td style='text-align:center;' id="st_4"><?php echo $ham;?></td>
							<td style='text-align:center;'><a href="#" onClick="doActive(4)">Enable</a>|<a href="#" onClick="doDeactive(4)">Disable</a></td>
						</tr>
						<tr>
							<td>5</td>
							<td>Perikanan</td>
							<td>Register Perikanan</td>
							<td style='text-align:center;' id="st_5"><?php echo $ikan;?></td>
							<td style='text-align:center;'><a href="#" onClick="doActive(5)">Enable</a>|<a href="#" onClick="doDeactive(5)">Disable</a></td>
						</tr>
						<tr>
							<td>6</td>
							<td>Tindak Pidana Korupsi</td>
							<td>Register Tindak Pidana Korupsi</td>
							<td style='text-align:center;' id="st_6"><?php echo $tipikor;?></td>
							<td style='text-align:center;'><a href="#" onClick="doActive(6)">Enable</a>|<a href="#" onClick="doDeactive(6)">Disable</a></td>
						</tr>
						<tr>
							<td>7</td>
							<td>Antrian</td>
							<td>Antrian</td>
							<td style='text-align:center;' id="st_7"><?php echo $antrian;?></td>
							<td style='text-align:center;'><a href="#" onClick="doActive(7)">Enable</a>|<a href="#" onClick="doDeactive(7)">Disable</a></td>
						</tr>
						<tr>
							<td colspan="5" style='text-align:center;'>Silahkan Logout Setelah Melakukan Perubahan Pada Menu</td>
						</tr>
					</tbody>
				</table>
		</div>
	</div>
	<script type="text/javascript">
	function doActive(id){
		$.post( "<?php echo base_url()?>menus_list/activated",{
		       id:id
		    }).done(function( response ){
		    	var json = jQuery.parseJSON(response);
		        if(json.st==1){
		        	$('#st_'+id).text('')
		        	$('#st_'+id).text('Active')
		        	message_show(json.msg)
		        }else{
		        	message_error_show_parent('Error, Please refresh your browser and clear the cache')
		        }
		    },'json');
	}

	function doDeactive(id){
		$.post( "<?php echo base_url()?>menus_list/deactivated",{
		       id:id
		    }).done(function( response ){
		    	var json = jQuery.parseJSON(response);
		        if(json.st==1){
		        	$('#st_'+id).text('')
		        	$('#st_'+id).text('Inactive')
		        	message_show(json.msg)
		        }else{
		        	message_error_show_parent('Error, Please refresh your browser and clear the cache')
		        }
		    },'json');
	}
	</script>
<?php }else{?>
	<hr class="thick-line" style="clear:both;">
	<div>
		<div style="padding:20px;"></div>
		<div id="pageTitle" style="width:100%;text-align:center;">Tidak Ada Konfigurasi Menu Pada Pengadilan Anda</div>
	</div>
<?php }?>

