<!-- sidebar.php -->
<style>

.sideNav{
	background: #1B263B
}
.the-logo{
	background: #1B263B
}
.nav-links a{
	color: #fff;
}

</style>
<?php ob_start();?>
<?php
if (isset($_SESSION['adminNo'])) {
	$adminNo = $_SESSION['adminNo']; // username = email

	// Get staff Id
	$getstf = "SELECT * FROM student WHERE adminNo = ? ";
	$stmt = $pdo->prepare($getstf);
	$stmt->execute([$adminNo]);
	$row = $stmt->fetch(PDO::FETCH_ASSOC);
	$stdId = $row['studId'];
	$adminNo = $row['adminNo'];
	$surName = $row['surname'];
	$otherName = $row['otherNames'];
	$gender = $row['gender'];
	$current_class = $row['class'];
	$password = $row['password'];

}else{
	header('Location:login.php');
}

// Get the current academic session
$session_status = 'active';
$acaSession = "SELECT session_year FROM sessions WHERE status = ? ";
$sespdo = $pdo->prepare($acaSession);
$sespdo->execute([$session_status]);
$sessionRow = $sespdo->fetch(PDO::FETCH_ASSOC);
$current_session = $sessionRow['session_year'];

// Get the current term
$term_status = 'active';
$get_term = "SELECT term_title FROM terms WHERE status = ?";
$termpdo = $pdo->prepare($get_term);
$termpdo->execute([$term_status]);
$termRow = $termpdo->fetch(PDO::FETCH_ASSOC);
$current_term = $termRow['term_title'];

?>
<div class="sideNav" id="dropdown">
	<div class="the-links" style="margin-top: ;">
		<div class="the-logo" onclick="ShowNav()">
			<img src="logo/goodness.jpg">
			<span>Select Menu <i class=" fa fa-arrow-down"></i></span>
		</div>
		<div class="nav-links" id="dropLink">

			<a href="index.php" >
				<div class="side-inner">
					<i class="fa fa-rss"></i> Dashboard
				</div>
			</a>
			<a href="my_results.php" onclick="openStd()">
				<div class="side-inner">
					<i class="fa fa-graduation-cap"></i> My Result
				</div>
			</a>
			
			
		    <a href="result_history.php">
		    	<div class="side-inner">
		    		<i class="fa fa-history"></i> Result History
		    	</div>
		    </a>

		    <a href="my-subjects.php" >
			   	<div class="side-inner">
			   		<i class="fa fa-book"></i> My Subjects
			   	</div>
		   	</a>

		   <a href="notifications.php" >
			   	<div class="side-inner">
			   		<i class="fa fa-bell"></i> Notifications
			   	</div>
		   </a>

		   <a href="profile.php" >
			   	<div class="side-inner">
			   		<i class="fa fa-user"></i> Profile
			   	</div>
		   </a>

		   <a href="pay.php">
		   	<div class="side-inner">
		   		<i class="fa fa-money-bill-wave"></i> Payment
		   	</div>
		   </a>

			<a href="logout.php" >
				<div class="side-inner">
					<i class="fa fa-user-circle"></i> Logout
				</div>
			</a>
		</div>
	</div>
    
</div>

<style>
	.dsp-std{
		width: 100%;
		height: 0;
		background: #1F282F;
		overflow: hidden;
		transition: height 0.4s ease;
		box-shadow: 0 2px 4px rgba(0,0,0,0.3);
	}
	.dsp-std.expanded{
		
	}
	.inner-links{
		display: flex;
		flex-direction: column;
		/*padding: 10px;*/
		padding-left: 10px;
		padding-right: 10px;
	}
	.inner-links a{
		color: #fff;
		font-size: 15px;

	}
</style>

<script>
	function openStd() {
		const content = document.getElementById('openStud');

			if (content.classList.contains('expanded')) {
				// Get the current height before collapsing
				content.style.height = content.scrollHeight + 'px';

				// Force reflow to make sure browser registers the height
				content.offsetHeight; // This line is very important

				// Now collapse
				content.style.height = '0';
				content.classList.remove('expanded');
			} else {
				// Expand
				content.style.height = content.scrollHeight + 'px';
				content.classList.add('expanded');

				// After transition, reset to auto so resizing works naturally
				content.addEventListener('transitionend', function removeHeight() {
					if (content.classList.contains('expanded')) {
						content.style.height = 'auto';
					}
					content.removeEventListener('transitionend', removeHeight);
				});
			}
			
	}
	// function DropClick(){
	//     const dropSidebar = document.getElementById('dropdown');
	//     dropSidebar.classList.toggle('active');   
	// }

	function DropClick() {
	  if (window.innerWidth <= 992) {
	    document.getElementById('dropdown').classList.toggle('active');
	  }
	}

	function ShowNav(){
		let dropLinks = document.getElementById('dropLink');
		dropLinks.classList.toggle('active');
	}

	function flexing(){
		const myDrops = document.getElementById('myDrop');
		myDrops.classList.toggle('active');
	}

</script>
<?php



?>