<?php SESSION_START();
if(!isset($_SESSION['admin_id'])){
	header("location: ../index.php");
}
?>
<?php /*
* Reports
*/?>
<?php include("../config/config.php");?>
<?php include("head.php"); ?>
<body>
<div class="wrapper">
<header>
<?php include("navigation.php"); 

?>
</header>

<div class="col-main">
<content>
<div class="report">

<div class="formSection">
	<select class="report">
		<option value="">--Select--</option>
		<option value="magazine">Magazine</option>
		<option value="filipiniana">Filipiniana</option>
		<option value="feasibility">Feasibility</option>
		<option value="circulation">Circulation</option>				
		<option value="references">References</option>	
	</select>
	<button class="all">View all</button>
	<div class="print_wrapper">
</div>
</div>
<div class="result">
</div>
</div>

<script>
$(document).ready( function() {
	$('.report').change( function() {
		var report = $(this).val()
		if(report){
		$.ajax({
		type: "POST",
		data: ({report: report}),
		url: "data_report.php",
		cache: false,
		success: function(response){
		if(response == 0){
		$('.result').fadeIn().html("There is no data matching your Selection!")
		}else{
		$('.result').fadeIn().html(response) 
		$('.print_wrapper').fadeIn().html("<button class='print_data btn'>print</button>")
				
				$('.print_data').click( function() {
				$('.result').printElement({ 
				overrideElementCSS:['css/print.css',	{ href:'css/print.css',media:'print'}],
				printMode:'popup'	
				});
				})

		}
		}
		});
		
		}
		
	})
	$('.all').click( function() {
		$.ajax({
		type: "POST",
		url: "all_report.php",
		cache: false,
		success: function(response){
		if(response == 0){
		$('.result').fadeIn().html("There is no data matching your Selection!")
		
		}else{
		$('.result').fadeIn().html(response) 
		$('.print_wrapper').fadeIn().html("<button class='print_data btn'>print</button>")
	
			$('.print_data').click( function() {
			$('.result').printElement({ 
			overrideElementCSS:['css/print.css',	{ href:'css/print.css',media:'print'}],
			printMode:'popup'	
			});
			})
		
		
		}
		}
		});
	})
	
	
})

</script>

</content>


</div>

<?php include("left.php"); ?>
<?php include("footer.php"); ?>


</div>
</body>
</html>