<?php
include "../include/config.php";
session_start();
if (isset($_SESSION['email'])){?>
<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Student Balance Report</title>
    <link rel="stylesheet" href="../../boostrap/1.css">
    <link rel="stylesheet" href="../../boostrap/2.css">
      <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300&family=Source+Sans+Pro:wght@300&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
   <link rel="icon" href="favicon.png" type="image/png">
   <!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<!-- Bootstrap JS -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

    <meta name="theme-color" content="#d03f4d">
      <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
      <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
      <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
      <script src='https://kit.fontawesome.com/a076d05399.js' crossorigin='anonymous'></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Signika+Negative:wght@300..700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="res/bootstrap@5.2.0.min.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Rowdies:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/font/bootstrap-icons.css" rel="stylesheet">
    <style>
      body{
        font-family: 'Nunito', sans-serif;
        background: #eceff4;
        color: #7c828c;
      }
      p{
      color: #7c828c;
      }
 .content{
  height:100vh;
   padding: 10px;
   
 }
 .content{
  margin-left: 200px;
  
}
 

 .content{
  z-index: 900;
  }
.card-body{
  padding:6px;
}
.form-control{
  height:40px;
  margin-top:10px;
  color: #7c828c;
  width:100px;
}
.btn{
  padding:10px;
  margin-top:10px;
} 
  .flex{
  justify-content: center;
  display:flex;
  flex-wrap:wrap
  
  width:100%;
}
.field{
width:150px;
}
form{
    width:49%;
    margin:5px;
}
@media only screen and (max-width:500px){

.box{
justify-content:center;
display:flex;
flex-wrap:wrap;
}
form{
    width:100%;
    margin-left:0px;
}
.flex{
display:block;
width:100%;
margin-left:0px;
}
.card{
width:100%;
margin-left:0px;
margin-top:10px;
}
}
    </style>
</head>
<body>
  <?php include "../include/nav.php";?>
<div class="content">
    <br> <br> <br>
    <?php

if (isset($_GET['delete'])) {?>
<div class="alert alert-danger" style="text-align:center;">
<p><i class="fa fa-trash">  </i> <?php echo $_GET['delete'];?></p>
</div>
<?php
}
?>
 <div class="alert " style="border-left:4px solid  #7c828c; background:white; padding:15px; margin-top:10px; margin-bottom:10px; border-radius:4px;">
 <h4 style="color: #7c828c; "> <i class="fa fa-address-card-o" style="color: #54B68F; padding:8px; "></i> Sudents ID</h4>
 
 </div>
    <div Class="">
    
    <h5 style="color:#7c828c; " >  <i class="fa fa-address-card-o"></I>Generate IDs <i style="margin-right:20px; margin-left:20px;"  class="fa fa-arrow-right"></I>  <i style="color: #54B68F;" class="fa fa-print"></I>  Print IDs</h5>
    </div>
      
    <div Class="flex">  
  <form style="background:white; border:none;padding:15px; margin-top:5px; margin-bottom:5px; border-radius:4px;" class=" bg" action="idcard" method="post">
  <h6> <I class="fa fa-edit"> </I> Filter  class  to download pupil's ID card.</h6>
  <hr>
 <div class="row">
 
<div class="col-12"  style="background:; color:; margin-top:10px"> 
<span style="margin-bottom:-5px">Select Intake </span>
<select style="margin-top:-5px;color: #7c828c;"  name="intake" id="" class="form-control">
  <?php
  $query=mysqli_query($conn,"select *from intake order by id desc");
  while($row=mysqli_fetch_array($query)){?>
  
 

<option value="<?php echo $row['intake'];?>"><?php echo $row['intake'];?></option>
<?php
  }
?>
</select> 
   </div>

<div class="col-12" style="background:; color:; margin-top:10px"> 
<span style="margin-bottom:-5px">Select Program </span>
<select style="margin-top:-5px; color: #7c828c;"  name="program" id="" class="form-control">
  <?php
  $query=mysqli_query($conn,"select *from programs order by id desc");
  while($row=mysqli_fetch_array($query)){?>
  
 

<option value="<?php echo $row['program'];?>"><?php echo $row['program'];?></option>
<?php
  }
?>
</select> 
</div>



<div class="col-6" style="background:; color:; margin-top:10px"> 

<input type="hidden" name="school" value="<?=$_SESSION['school'];?>"/>
</div>
 <div class="col-12" style="background:; color:; margin-top:10px">
<input style="border:none;background:#54B68F;padding:10px; color:white;" type="submit" name="pid" value="DOWNLOAD IDs" class="btn "> 
</div>
  
</div>
 
 </form>
<form style="background:white; border:none;padding:15px; margin-top:5px; margin-bottom:5px; border-radius:4px;">
 <h6> Total Entry: <?php 
 $school=$_SESSION['school'];
 $nrc=$_SESSION['nrc'];
  $queryp=mysqli_query($conn,"select *from students  ");
  $count=mysqli_num_rows($queryp);
  echo $count;
  ?>
  </h6>
 <hr>
 <div id="chartContainer" style="height: 200px; width: 100%;"></div>
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
 
 </form>
 
 </div>
 <?php


?>
 
<?php
 
 $nrc=$_SESSION['nrc'];
 $school=$_SESSION['school'];
  $queryp=mysqli_query($conn,"select *from students  where  gender='Female'");
  $pass=mysqli_num_rows($queryp);
  $queryf=mysqli_query($conn,"select *from students  where  gender='Male' ");
  $fail=mysqli_num_rows($queryf);
$dataPoints = array( 
	array("label"=>  "Male" , "y"=> $fail ),
	array("label"=>"Female", "y"=> $pass)
	
)
 
?>
<script>
window.onload = function() {
 
 
var chart = new CanvasJS.Chart("chartContainer", {
	theme: "light2",
	animationEnabled: true,
	title: {
		text: "Pupils"
	},
	data: [{
		type: "pie",
		indexLabel: "{y}",
		yValueFormatString: "#,##0\"\"",
		indexLabelPlacement: "outside",
		indexLabelFontColor: "#36454F",
		indexLabelFontSize: 18,
		indexLabelFontWeight: "bolder",
		showInLegend: true,
		legendText: "{label}",
		dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
	}]
});
chart.render();
 
}
</script>
 <br>
</body>
</html>
<?php
}else {
  header("location:index");
}
?>