<script type="text/javascript">	
$(document).ready(function() {	
	$("#tabs").tabs({selected:0});
	
	$('#form_cari_user').dialog({
		autoOpen: false,
		modal	: true,
		width: 700,
	});
		
	$('#x_userid').keyup(function(){
		$('#form_cari_user').dialog('open');
		$("#info_pengguna").load('md_dir/log_history/tampil_data_user.php');
		$("#cari_user").focus();
	});
	
	$("#cari_user").keyup(function(){
		$("#info_pengguna").show();
		var cari= $("#cari_user").val();
		
		$.ajax({
			type	: "POST",
			url		: "md_dir/log_history/tampil_data_user.php",
			data	: "cari="+cari,
			timeout	: 2000,
			beforeSend	: function(){		
				$("#info_pengguna").html("<img src='loading.gif' />");			
			},				  
			success	: function(data){
				$("#info_pengguna").html(data);
			}
		});
	});
	
	$("#cari_hp").click(function(){
		var userid	= $("#x_userid").val();
		var tglawal	= $("#x_tglawal").val();
		var tglakhir= $("#x_tglakhir").val();

		$("#tampil_data_hp").load('md_dir/log_history/tampil_data_loghist.php?userid='+userid+'&tglawal='+tglawal+'&tglakhir='+tglakhir);
	});
	
	$("#cetak_hp").click(function(){
		var userid	= $("#x_userid").val();
		var username= $("#x_username").val();
		var level   = $("#x_level").val();
		var tglawal	= $("#x_tglawal").val();
		var tglakhir= $("#x_tglakhir").val();
		
		window.location.href='modul/laporan/daftar_loghist.php?userid='+userid+'&username='+username+'&level='+level+'&tglawal='+tglawal+'&tglakhir='+tglakhir;
	});
	
	$("#tutup_hp").click(function(){
		document.location='?module=home';
	});
});
</script>


<style type="text/css">
#info {
	font-size:12px;
	font-weight:bold;
	color:#F00;
}
</style>
<?php
echo "<div id='tabs'>";
echo "<ul>	       
	   <li><a href='#data_hp'>HISTORY PENGGUNA</a></li>
    </ul>";

	echo "<div id='data_hp'>
		<div id='pencarian_hp'>
			<fieldset>
			<legend>Filter Data</legend>
			<table width='100%'>
				<tr>
					<td>Pengguna : <input type='text' id='x_userid' size='10'> <input type='text' id='x_username' size='20' readonly/></td>
					<td>Level : <input type='text' id='x_level' size='15' readonly/></td>
					<td>Tanggal : <input type='date' id='x_tglawal'> sampai dengan <input type='date' id='x_tglakhir'></td>
					<td>
						<button id='cari_hp'>Cari</button>
						<button id='cetak_hp'>Cetak</button>
						<button id='tutup_hp'>Tutup</button>
					</td>
				</tr>
			</table>
			</fieldset>
		</div><br>
		<div id='tampil_data_hp' align='center'></div>
	</div>";
	
	echo "<div id='form_cari_user' title='Pencarian Data Pengguna'>
		<table width='100%'>
			<tr>
				<td>Cari Pengguna : <input type='text' id='cari_user' size='20'></td>
			</tr>
		</table>
		<div id='info_pengguna' align='center'></div>
	</div>";
	
	echo "<div id='info' align='center'></div>";
echo "</div>";
?>