academy/resources/views/layouts/studentportalnav.blade.php

571 lines
19 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>@yield('title', 'Student Portal - Automobile Academic')</title>
<!-- Google Fonts & Font Awesome Icons & Bootstrap 5 -->
<link href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
:root {
--theme-navy: #1E233E;
--theme-footer-navy: #15182C;
--theme-red: #822424;
--theme-red-hover: #df2c3e;
--theme-yellow: #FFEA85;
--theme-bg: #F4F6F9;
--sidebar-width: 260px;
--text-dark: #1E293B;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body {
background-color: var(--theme-bg);
color: var(--text-dark);
display: flex;
min-height: 100vh;
overflow-x: hidden;
}
.sidebar {
width: var(--sidebar-width);
height: 100vh;
background: linear-gradient(180deg, #1E233E 0%, #15182C 100%);
color: #fff;
position: fixed;
top: 0;
left: 0;
padding: 24px 0;
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
z-index: 1030;
display: flex;
flex-direction: column;
box-shadow: 4px 0 20px rgba(0,0,0,0.08);
}
.sidebar .brand {
padding: 0 20px 22px;
display: flex;
align-items: center;
gap: 12px;
border-bottom: 1px solid rgba(255,255,255,.08);
margin-bottom: 20px;
}
.brand-logo-icon {
width: 42px;
height: 42px;
border-radius: 12px;
background: linear-gradient(135deg, var(--theme-red) 0%, var(--theme-red-hover) 100%);
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
box-shadow: 0 6px 16px rgba(130, 36, 36, 0.35);
}
.brand-text {
display: flex;
flex-direction: column;
line-height: 1.1;
}
.brand-text span {
font-weight: 800;
font-size: 1.25rem;
color: #ffffff;
letter-spacing: -0.5px;
}
.brand-sub {
font-size: 0.65rem;
font-weight: 700;
color: var(--theme-yellow);
letter-spacing: 1.5px;
opacity: 0.85;
margin-top: 2px;
}
.sidebar .nav {
display: flex;
flex-direction: column;
flex-grow: 1;
overflow-y: auto;
padding: 0 14px;
gap: 4px;
}
.sidebar .nav-link {
color: rgba(255, 255, 255, 0.75);
padding: 13px 18px;
font-size: 0.93rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 14px;
transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
border-radius: 14px;
text-decoration: none;
position: relative;
}
.sidebar .nav-link i {
width: 22px;
text-align: center;
font-size: 1.1rem;
transition: transform 0.25s ease, color 0.25s ease;
}
.sidebar .nav-link:hover {
background: rgba(255, 255, 255, 0.08);
color: var(--theme-yellow) !important;
transform: translateX(4px);
}
.sidebar .nav-link:hover i {
transform: scale(1.15);
color: var(--theme-yellow);
}
.sidebar .nav-link.active {
background: linear-gradient(90deg, rgba(255, 234, 133, 0.16) 0%, rgba(255, 234, 133, 0.06) 100%);
color: var(--theme-yellow) !important;
font-weight: 700;
border-left: 4px solid var(--theme-yellow);
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
border-radius: 4px 14px 14px 4px;
}
.sidebar .nav-link.active i {
color: var(--theme-yellow);
}
.sidebar-user-profile {
padding: 16px 18px;
border-top: 1px solid rgba(255,255,255,.08);
margin-top: auto;
background: rgba(0, 0, 0, 0.25);
}
.sidebar-user-profile .user-dropdown-toggle {
display: flex;
align-items: center;
gap: 12px;
color: #fff;
text-decoration: none;
transition: all 0.2s ease;
padding: 8px 10px;
border-radius: 12px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user-profile .user-dropdown-toggle:hover {
background: rgba(255, 255, 255, 0.12);
border-color: rgba(255, 234, 133, 0.3);
color: #ffffff;
}
.user-avatar-badge-sm {
width: 38px;
height: 38px;
border-radius: 50%;
background: linear-gradient(135deg, var(--theme-navy) 0%, var(--theme-footer-navy) 100%);
border: 2px solid var(--theme-yellow);
color: var(--theme-yellow);
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 0.95rem;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.user-info-text {
display: flex;
flex-direction: column;
overflow: hidden;
text-align: left;
}
.user-name-text {
font-weight: 700;
font-size: 0.88rem;
color: #ffffff;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.user-email-text {
font-size: 0.72rem;
font-style: italic;
color: rgba(255, 255, 255, 0.7);
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Dark Glassmorphic User Dropdown Popup */
.user-dropdown-menu {
background: linear-gradient(145deg, #1A1E36 0%, #111428 100%) !important;
border: 1px solid rgba(255, 255, 255, 0.12) !important;
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5) !important;
border-radius: 16px !important;
margin-bottom: 12px !important;
padding: 8px !important;
width: 220px;
backdrop-filter: blur(16px);
}
.user-dropdown-item {
display: flex;
align-items: center;
gap: 12px;
transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
color: #ffffff !important;
text-decoration: none;
padding: 10px 12px;
border-radius: 12px;
}
.user-dropdown-item:hover {
background: rgba(255, 255, 255, 0.08) !important;
transform: translateX(3px);
}
.dropdown-item-icon-blue {
width: 36px;
height: 36px;
border-radius: 10px;
background: rgba(59, 130, 246, 0.15);
color: #60A5FA;
border: 1px solid rgba(59, 130, 246, 0.3);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.95rem;
flex-shrink: 0;
}
.dropdown-item-icon-red {
width: 36px;
height: 36px;
border-radius: 10px;
background: rgba(239, 68, 68, 0.15);
color: #F87171;
border: 1px solid rgba(239, 68, 68, 0.3);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.95rem;
flex-shrink: 0;
}
.main {
margin-left: var(--sidebar-width);
width: calc(100% - var(--sidebar-width));
min-height: 100vh;
padding: 32px 40px;
background: var(--theme-bg);
transition: all 0.3s ease;
display: flex;
flex-direction: column;
align-items: center;
}
.portal-content-container {
width: 100%;
max-width: 1280px;
margin: 0 auto;
}
.mobile-header {
display: none;
background: var(--theme-navy);
color: #ffffff;
padding: 12px 20px;
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
align-items: center;
justify-content: space-between;
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1020;
}
.sidebar-toggle {
background: none;
border: none;
font-size: 1.4rem;
cursor: pointer;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
}
.sidebar-toggle:hover {
color: var(--theme-yellow);
}
.mobile-brand {
font-weight: 700;
font-size: 1.1rem;
color: #ffffff;
}
.sidebar-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
z-index: 1025;
opacity: 0;
transition: opacity 0.3s ease;
}
.sidebar-overlay.show {
display: block;
opacity: 1;
}
@media (max-width: 991px) {
.sidebar {
left: calc(-1 * var(--sidebar-width));
}
.sidebar.show {
left: 0;
}
.main {
margin-left: 0;
padding: 85px 20px 20px 20px;
width: 100%;
}
.mobile-header {
display: flex;
}
}
</style>
</head>
<body>
<!-- Mobile Top Navigation Bar -->
<header class="mobile-header">
<button class="sidebar-toggle" id="toggleBtn" aria-label="Toggle Sidebar">
<i class="fa-solid fa-bars"></i>
</button>
<div class="mobile-brand">
<i class="fa-solid fa-car-side me-1"></i> AutoEdu Portal
</div>
<div class="mobile-user-profile">
@if(session()->has('student_id'))
<div class="dropdown">
<a class="text-white text-decoration-none dropdown-toggle d-flex flex-column align-items-center justify-content-center gap-0" href="#" role="button" id="userMenuMobile" data-bs-toggle="dropdown" aria-expanded="false" style="line-height: 1.1;">
<i class="fa-solid fa-circle-user" style="font-size: 24px; color: var(--theme-yellow);"></i>
<span class="fst-italic" style="font-size: 11px;">{{ session('student_name') }}</span>
</a>
<ul class="dropdown-menu dropdown-menu-end shadow" aria-labelledby="userMenuMobile">
<li>
<a class="dropdown-item" href="{{ route('StudentProfile') }}">
<i class="fa-solid fa-user me-2"></i> Profile
</a>
</li>
<li><hr class="dropdown-divider"></li>
<li>
<button type="button" onclick="submitLogout()" class="dropdown-item text-danger w-100 text-start border-0 bg-transparent">
<i class="fa-solid fa-right-from-bracket me-2"></i> Logout
</button>
</li>
</ul>
</div>
@else
<a href="/" class="btn btn-sm btn-outline-light"><i class="fa-solid fa-right-to-bracket me-1"></i> Sign In</a>
@endif
</div>
</header>
<div class="sidebar-overlay" id="sidebarOverlay"></div>
<!-- Sidebar Navigation -->
<aside class="sidebar" id="sidebar">
<div class="brand">
<div class="brand-logo-icon">
<i class="fa-solid fa-car-side"></i>
</div>
<div class="brand-text">
<span>AutoEdu</span>
<small class="brand-sub">STUDENT ACADEMY</small>
</div>
</div>
<nav class="nav">
<a href="/student-portal" class="nav-link {{ request()->is('Dashboard*') || request()->is('student-portal*') ? 'active' : '' }}">
<i class="fa-solid fa-gauge"></i> Dashboard
</a>
<a href="/mycourse" class="nav-link {{ request()->is('mycourse*') ? 'active' : '' }}">
<i class="fa-solid fa-book"></i> My Courses
</a>
<a href="/timetable" class="nav-link {{ request()->is('timetable*') ? 'active' : '' }}">
<i class="fa-solid fa-calendar-days"></i> Class Timetable
</a>
<a href="/results" class="nav-link {{ request()->is('results*') ? 'active' : '' }}">
<i class="fa-solid fa-square-poll-vertical"></i> Exam Results
</a>
<a href="/Studentguidelines" class="nav-link {{ request()->is('Studentguidelines*') ? 'active' : '' }}">
<i class="fa-solid fa-book-open"></i> Student Guidelines
</a>
<a href="/Feedback&Complain" class="nav-link {{ request()->is('Feedback&Complain*') ? 'active' : '' }}">
<i class="fa-solid fa-comments"></i> Feedback & Complain
</a>
<a href="{{ route('StudentProfile') }}" class="nav-link {{ request()->routeIs('StudentProfile') ? 'active' : '' }}">
<i class="fa-solid fa-user"></i> Student Profile
</a>
</nav>
<div class="sidebar-user-profile">
@if(session()->has('student_id'))
<div class="dropdown dropup">
<a class="user-dropdown-toggle dropdown-toggle" href="#" role="button" id="userMenuDesktop" data-bs-toggle="dropdown" aria-expanded="false">
<div class="user-avatar-badge-sm">
{{ strtoupper(substr(session('student_name', 'S'), 0, 1)) }}
</div>
<div class="user-info-text">
<span class="user-name-text">{{ session('student_name', 'Student') }}</span>
<span class="user-email-text">Active Session</span>
</div>
</a>
<ul class="dropdown-menu user-dropdown-menu shadow-lg p-2 animate slideIn" aria-labelledby="userMenuDesktop">
<li>
<a class="dropdown-item user-dropdown-item py-2.5 px-3 rounded-3" href="{{ route('StudentProfile') }}">
<div class="dropdown-item-icon-blue">
<i class="fa-solid fa-user-gear"></i>
</div>
<div>
<span class="fw-bold d-block text-white" style="font-size: 0.88rem;">My Profile</span>
<small class="text-white-50" style="font-size: 0.72rem;">View & edit details</small>
</div>
</a>
</li>
<li><hr class="dropdown-divider border-white opacity-10 my-1"></li>
<li>
<button type="button" onclick="submitLogout()" class="dropdown-item user-dropdown-item py-2.5 px-3 rounded-3 border-0 bg-transparent w-100 text-start">
<div class="dropdown-item-icon-red">
<i class="fa-solid fa-right-from-bracket"></i>
</div>
<div>
<span class="fw-bold d-block text-danger" style="font-size: 0.88rem;">Logout</span>
<small class="text-danger-subtle opacity-75" style="font-size: 0.72rem;">Sign out of session</small>
</div>
</button>
</li>
</ul>
</div>
@else
<div class="d-flex gap-2">
<a href="/" class="btn btn-outline-light btn-sm w-100 rounded-pill">Sign In</a>
</div>
@endif
</div>
</aside>
<main class="main">
@yield('content')
</main>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Sidebar Toggle Logic
const toggleBtn = document.getElementById('toggleBtn');
const sidebar = document.getElementById('sidebar');
const overlay = document.getElementById('sidebarOverlay');
if(toggleBtn) {
toggleBtn.addEventListener('click', () => {
sidebar.classList.toggle('show');
overlay.classList.toggle('show');
});
}
if(overlay) {
overlay.addEventListener('click', () => {
sidebar.classList.remove('show');
overlay.classList.remove('show');
});
}
// Logout Logic
function submitLogout() {
const tokenEl = document.querySelector('meta[name="csrf-token"]');
const csrfToken = tokenEl ? tokenEl.getAttribute('content') : '';
if (!csrfToken) {
console.error('CSRF token meta tag not found!');
alert('Security token missing. Refreshing page...');
window.location.reload();
return;
}
fetch('/studentlogout', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-CSRF-TOKEN': csrfToken
}
})
.then(res => {
if (res.status === 419) {
alert('Session expired. Page will reload.');
window.location.reload();
return;
}
if (!res.ok) {
throw new Error(`Server returned status ${res.status}`);
}
return res.json();
})
.then(data => {
if (data && data.success) {
window.location.href = '/';
} else {
alert('Logout failed. Please try again.');
}
})
.catch(err => {
console.error('Logout Error:', err);
alert('An error occurred during logout.');
});
}
</script>
</body>
</html>