cbv / index.html
kevoh's picture
Add 2 files
0b8edb5 verified
Raw History Blame Contribute Delete
41.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Teacher's Homework Portal</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* Custom CSS for file upload styling */
.file-upload {
position: relative;
display: inline-block;
}
.file-upload input[type="file"] {
position: absolute;
left: 0;
top: 0;
opacity: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
/* Animation for notifications */
@keyframes slideIn {
from { transform: translateX(100%); }
to { transform: translateX(0); }
}
.notification {
animation: slideIn 0.3s ease-out;
}
</style>
</head>
<body class="bg-gray-50 font-sans">
<!-- Navigation -->
<nav class="bg-indigo-700 text-white shadow-lg">
<div class="container mx-auto px-4 py-3 flex justify-between items-center">
<div class="flex items-center space-x-2">
<i class="fas fa-chalkboard-teacher text-2xl"></i>
<span class="text-xl font-bold">Teacher Portal</span>
</div>
<div class="hidden md:flex space-x-6">
<a href="#dashboard" class="hover:text-indigo-200 transition">Dashboard</a>
<a href="#homework" class="hover:text-indigo-200 transition">Homework</a>
<a href="#students" class="hover:text-indigo-200 transition">Students</a>
<a href="#messages" class="hover:text-indigo-200 transition">Messages</a>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<i class="fas fa-bell text-xl cursor-pointer"></i>
<span class="absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center">3</span>
</div>
<div class="flex items-center space-x-2">
<img src="https://randomuser.me/api/portraits/women/65.jpg" alt="Profile" class="w-8 h-8 rounded-full">
<span class="hidden md:inline">Ms. Johnson</span>
</div>
</div>
</div>
</nav>
<!-- Mobile Menu -->
<div class="md:hidden bg-indigo-600 text-white p-2 text-center">
<div class="flex justify-around">
<a href="#dashboard" class="p-2"><i class="fas fa-home"></i></a>
<a href="#homework" class="p-2"><i class="fas fa-book"></i></a>
<a href="#students" class="p-2"><i class="fas fa-users"></i></a>
<a href="#messages" class="p-2"><i class="fas fa-envelope"></i></a>
</div>
</div>
<!-- Main Content -->
<div class="container mx-auto px-4 py-6">
<!-- Dashboard Overview -->
<section id="dashboard" class="mb-8">
<h1 class="text-2xl font-bold text-gray-800 mb-4">Dashboard Overview</h1>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<!-- Stats Cards -->
<div class="bg-white rounded-lg shadow p-4">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-500">Pending Assignments</p>
<h3 class="text-2xl font-bold text-indigo-600">12</h3>
</div>
<i class="fas fa-clock text-indigo-500 text-3xl"></i>
</div>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-500">Completed Assignments</p>
<h3 class="text-2xl font-bold text-green-600">24</h3>
</div>
<i class="fas fa-check-circle text-green-500 text-3xl"></i>
</div>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex items-center justify-between">
<div>
<p class="text-gray-500">Total Students</p>
<h3 class="text-2xl font-bold text-blue-600">32</h3>
</div>
<i class="fas fa-user-graduate text-blue-500 text-3xl"></i>
</div>
</div>
</div>
</section>
<!-- Homework Section -->
<section id="homework" class="mb-8">
<div class="flex justify-between items-center mb-4">
<h1 class="text-2xl font-bold text-gray-800">Homework Assignments</h1>
<button id="newAssignmentBtn" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg flex items-center space-x-2 transition">
<i class="fas fa-plus"></i>
<span>New Assignment</span>
</button>
</div>
<!-- New Assignment Modal (hidden by default) -->
<div id="assignmentModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg shadow-xl w-full max-w-2xl">
<div class="flex justify-between items-center border-b p-4">
<h3 class="text-xl font-bold text-gray-800">Create New Assignment</h3>
<button id="closeModalBtn" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-4">
<form id="assignmentForm">
<div class="mb-4">
<label class="block text-gray-700 mb-2" for="assignmentTitle">Assignment Title</label>
<input type="text" id="assignmentTitle" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Enter assignment title" required>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2" for="assignmentClass">Class</label>
<select id="assignmentClass" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" required>
<option value="">Select a class</option>
<option value="math">Mathematics</option>
<option value="science">Science</option>
<option value="english">English</option>
<option value="history">History</option>
</select>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2" for="dueDate">Due Date</label>
<input type="datetime-local" id="dueDate" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" required>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2" for="assignmentDescription">Description</label>
<textarea id="assignmentDescription" rows="4" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Enter assignment details and instructions..." required></textarea>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2">Attachments</label>
<div class="file-upload bg-gray-100 hover:bg-gray-200 rounded-lg p-4 text-center cursor-pointer transition">
<i class="fas fa-cloud-upload-alt text-3xl text-gray-400 mb-2"></i>
<p class="text-gray-600">Click to upload files</p>
<p class="text-xs text-gray-500">PDF, DOCX, PPT, JPG, PNG (Max 10MB)</p>
<input type="file" id="assignmentFiles" class="hidden" multiple>
</div>
<div id="fileList" class="mt-2 text-sm text-gray-600"></div>
</div>
<div class="flex justify-end space-x-3 pt-4 border-t">
<button type="button" id="cancelAssignmentBtn" class="px-4 py-2 border rounded-lg text-gray-700 hover:bg-gray-100 transition">Cancel</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition">Post Assignment</button>
</div>
</form>
</div>
</div>
</div>
<!-- Assignment Tabs -->
<div class="mb-4 border-b border-gray-200">
<ul class="flex flex-wrap -mb-px" id="assignmentTabs" role="tablist">
<li class="mr-2" role="presentation">
<button class="inline-block p-4 border-b-2 border-indigo-600 text-indigo-600" id="active-tab" data-tab="active">Active Assignments</button>
</li>
<li class="mr-2" role="presentation">
<button class="inline-block p-4 border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300" id="completed-tab" data-tab="completed">Completed</button>
</li>
<li class="mr-2" role="presentation">
<button class="inline-block p-4 border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300" id="graded-tab" data-tab="graded">Graded</button>
</li>
</ul>
</div>
<!-- Assignment Cards -->
<div id="activeAssignments" class="tab-content grid grid-cols-1 gap-4">
<!-- Sample Active Assignment -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="p-4 border-b">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg text-gray-800">Math: Quadratic Equations Practice</h3>
<p class="text-sm text-gray-500">Due: May 15, 2023 at 11:59 PM</p>
</div>
<span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full">Active</span>
</div>
</div>
<div class="p-4">
<p class="text-gray-700 mb-3">Solve the quadratic equations on page 42 of your textbook. Show all your work and submit as a PDF or photo of your work.</p>
<div class="flex items-center text-sm text-gray-500 mb-3">
<i class="fas fa-paperclip mr-1"></i>
<span>quadratic_equations.pdf</span>
</div>
<div class="flex justify-between items-center">
<div class="text-sm">
<span class="text-green-600">12</span> submitted •
<span class="text-gray-600">20</span> pending
</div>
<div class="flex space-x-2">
<button class="text-indigo-600 hover:text-indigo-800 text-sm font-medium">View Submissions</button>
<button class="text-gray-500 hover:text-gray-700 text-sm font-medium">Edit</button>
</div>
</div>
</div>
</div>
<!-- Another Active Assignment -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="p-4 border-b">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg text-gray-800">Science: Solar System Project</h3>
<p class="text-sm text-gray-500">Due: May 20, 2023 at 11:59 PM</p>
</div>
<span class="bg-yellow-100 text-yellow-800 text-xs px-2 py-1 rounded-full">Active</span>
</div>
</div>
<div class="p-4">
<p class="text-gray-700 mb-3">Create a presentation about any planet in our solar system. Include at least 5 interesting facts and 3 images.</p>
<div class="flex items-center text-sm text-gray-500 mb-3">
<i class="fas fa-paperclip mr-1"></i>
<span>solar_system_guidelines.pdf</span>
</div>
<div class="flex justify-between items-center">
<div class="text-sm">
<span class="text-green-600">8</span> submitted •
<span class="text-gray-600">24</span> pending
</div>
<div class="flex space-x-2">
<button class="text-indigo-600 hover:text-indigo-800 text-sm font-medium">View Submissions</button>
<button class="text-gray-500 hover:text-gray-700 text-sm font-medium">Edit</button>
</div>
</div>
</div>
</div>
</div>
<!-- Completed Assignments (hidden by default) -->
<div id="completedAssignments" class="tab-content grid grid-cols-1 gap-4 hidden">
<!-- Sample Completed Assignment -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="p-4 border-b">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg text-gray-800">English: Book Report</h3>
<p class="text-sm text-gray-500">Due: May 5, 2023 at 11:59 PM</p>
</div>
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded-full">Submitted</span>
</div>
</div>
<div class="p-4">
<p class="text-gray-700 mb-3">Write a 2-page report on the book you read this month. Include your thoughts on the characters and plot.</p>
<div class="flex justify-between items-center">
<div class="text-sm">
<span class="text-green-600">28</span> submitted •
<span class="text-gray-600">4</span> missing
</div>
<div class="flex space-x-2">
<button class="text-indigo-600 hover:text-indigo-800 text-sm font-medium">Grade Now</button>
</div>
</div>
</div>
</div>
</div>
<!-- Graded Assignments (hidden by default) -->
<div id="gradedAssignments" class="tab-content grid grid-cols-1 gap-4 hidden">
<!-- Sample Graded Assignment -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="p-4 border-b">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg text-gray-800">History: Civil War Essay</h3>
<p class="text-sm text-gray-500">Due: April 28, 2023 at 11:59 PM</p>
</div>
<span class="bg-green-100 text-green-800 text-xs px-2 py-1 rounded-full">Graded</span>
</div>
</div>
<div class="p-4">
<p class="text-gray-700 mb-3">Write a 3-page essay on the causes of the Civil War, citing at least 3 sources.</p>
<div class="flex justify-between items-center">
<div class="text-sm">
<span class="text-green-600">30</span> graded •
<span class="text-gray-600">2</span> missing
</div>
<div class="flex space-x-2">
<button class="text-indigo-600 hover:text-indigo-800 text-sm font-medium">View Grades</button>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Submissions Modal (hidden by default) -->
<div id="submissionsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg shadow-xl w-full max-w-4xl max-h-[90vh] overflow-y-auto">
<div class="flex justify-between items-center border-b p-4 sticky top-0 bg-white z-10">
<h3 class="text-xl font-bold text-gray-800">Submissions for "Math: Quadratic Equations Practice"</h3>
<button id="closeSubmissionsBtn" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-4">
<!-- Submission List -->
<div class="mb-6">
<div class="flex justify-between items-center mb-2">
<h4 class="font-medium text-gray-800">Student Submissions (12/32)</h4>
<div class="relative">
<input type="text" placeholder="Search students..." class="pl-8 pr-3 py-2 border rounded-lg text-sm focus:outline-none focus:ring-1 focus:ring-indigo-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Student</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Submission</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Submitted</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<!-- Sample Submission 1 -->
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="https://randomuser.me/api/portraits/men/32.jpg" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Michael Johnson</div>
<div class="text-sm text-gray-500">Grade 8</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900 flex items-center">
<i class="fas fa-file-pdf text-red-500 mr-2"></i>
michael_quadratic.pdf
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
May 14, 2023 3:24 PM
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
Submitted
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-indigo-600 hover:text-indigo-900 grade-btn" data-student="Michael Johnson">Grade</button>
</td>
</tr>
<!-- Sample Submission 2 -->
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="https://randomuser.me/api/portraits/women/44.jpg" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Sarah Williams</div>
<div class="text-sm text-gray-500">Grade 8</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900 flex items-center">
<i class="fas fa-file-image text-blue-500 mr-2"></i>
sarah_quadratic.jpg
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
May 13, 2023 9:15 AM
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">
Submitted
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-indigo-600 hover:text-indigo-900 grade-btn" data-student="Sarah Williams">Grade</button>
</td>
</tr>
<!-- Sample Submission 3 (not submitted yet) -->
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10">
<img class="h-10 w-10 rounded-full" src="https://randomuser.me/api/portraits/men/75.jpg" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">David Brown</div>
<div class="text-sm text-gray-500">Grade 8</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
Not submitted
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
-
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
Pending
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-gray-400 cursor-not-allowed" disabled>Grade</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!-- Grading Modal (hidden by default) -->
<div id="gradingModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-lg shadow-xl w-full max-w-3xl max-h-[90vh] overflow-y-auto">
<div class="flex justify-between items-center border-b p-4 sticky top-0 bg-white z-10">
<h3 class="text-xl font-bold text-gray-800">Grade Assignment for <span id="studentName">Michael Johnson</span></h3>
<button id="closeGradingBtn" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-4">
<div class="mb-6 border-b pb-4">
<h4 class="font-medium text-gray-800 mb-2">Submitted Work</h4>
<div class="bg-gray-50 p-4 rounded-lg">
<div class="flex items-center mb-2">
<i class="fas fa-file-pdf text-red-500 mr-2 text-xl"></i>
<span class="font-medium">michael_quadratic.pdf</span>
</div>
<iframe src="https://example.com/preview.pdf" class="w-full h-64 border rounded-lg" frameborder="0"></iframe>
<div class="mt-2 text-sm text-gray-500">
Submitted: May 14, 2023 3:24 PM
</div>
</div>
</div>
<form id="gradingForm">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div>
<label class="block text-gray-700 mb-2" for="grade">Grade (out of 100)</label>
<input type="number" id="grade" min="0" max="100" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Enter grade" required>
</div>
<div>
<label class="block text-gray-700 mb-2" for="status">Status</label>
<select id="status" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" required>
<option value="graded">Graded</option>
<option value="resubmit">Needs Resubmission</option>
<option value="incomplete">Incomplete</option>
</select>
</div>
</div>
<div class="mb-6">
<label class="block text-gray-700 mb-2" for="feedback">Feedback</label>
<textarea id="feedback" rows="4" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-indigo-500" placeholder="Provide detailed feedback for the student..." required></textarea>
</div>
<div class="mb-4">
<label class="block text-gray-700 mb-2">Attach Feedback Files (optional)</label>
<div class="file-upload bg-gray-100 hover:bg-gray-200 rounded-lg p-4 text-center cursor-pointer transition">
<i class="fas fa-cloud-upload-alt text-3xl text-gray-400 mb-2"></i>
<p class="text-gray-600">Click to upload feedback files</p>
<p class="text-xs text-gray-500">PDF, DOCX, JPG, PNG (Max 5MB)</p>
<input type="file" id="feedbackFiles" class="hidden">
</div>
</div>
<div class="flex justify-end space-x-3 pt-4 border-t">
<button type="button" id="cancelGradingBtn" class="px-4 py-2 border rounded-lg text-gray-700 hover:bg-gray-100 transition">Cancel</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition">Submit Grade</button>
</div>
</form>
</div>
</div>
</div>
<!-- Notification Toast (hidden by default) -->
<div id="notificationToast" class="fixed bottom-4 right-4 hidden">
<div class="notification bg-green-500 text-white px-6 py-3 rounded-lg shadow-lg flex items-center">
<i class="fas fa-check-circle mr-2"></i>
<span id="notificationMessage">Assignment posted successfully!</span>
<button id="closeNotificationBtn" class="ml-4">
<i class="fas fa-times"></i>
</button>
</div>
</div>
</div>
<script>
// DOM Elements
const newAssignmentBtn = document.getElementById('newAssignmentBtn');
const assignmentModal = document.getElementById('assignmentModal');
const closeModalBtn = document.getElementById('closeModalBtn');
const cancelAssignmentBtn = document.getElementById('cancelAssignmentBtn');
const assignmentForm = document.getElementById('assignmentForm');
const assignmentFiles = document.getElementById('assignmentFiles');
const fileList = document.getElementById('fileList');
const tabButtons = document.querySelectorAll('[data-tab]');
const tabContents = document.querySelectorAll('.tab-content');
const viewSubmissionsBtns = document.querySelectorAll('[class*="View Submissions"]');
const submissionsModal = document.getElementById('submissionsModal');
const closeSubmissionsBtn = document.getElementById('closeSubmissionsBtn');
const gradeBtns = document.querySelectorAll('.grade-btn');
const gradingModal = document.getElementById('gradingModal');
const closeGradingBtn = document.getElementById('closeGradingBtn');
const cancelGradingBtn = document.getElementById('cancelGradingBtn');
const gradingForm = document.getElementById('gradingForm');
const notificationToast = document.getElementById('notificationToast');
const closeNotificationBtn = document.getElementById('closeNotificationBtn');
const notificationMessage = document.getElementById('notificationMessage');
// Show new assignment modal
newAssignmentBtn.addEventListener('click', () => {
assignmentModal.classList.remove('hidden');
});
// Close modals
const closeModals = () => {
assignmentModal.classList.add('hidden');
submissionsModal.classList.add('hidden');
gradingModal.classList.add('hidden');
};
closeModalBtn.addEventListener('click', closeModals);
cancelAssignmentBtn.addEventListener('click', closeModals);
closeSubmissionsBtn.addEventListener('click', closeModals);
closeGradingBtn.addEventListener('click', closeModals);
cancelGradingBtn.addEventListener('click', closeModals);
// Handle file upload display
assignmentFiles.addEventListener('change', (e) => {
fileList.innerHTML = '';
if (e.target.files.length > 0) {
const list = document.createElement('ul');
list.className = 'space-y-1';
Array.from(e.target.files).forEach(file => {
const item = document.createElement('li');
item.className = 'flex items-center';
item.innerHTML = `
<i class="fas fa-file text-gray-400 mr-2"></i>
<span>${file.name}</span>
<span class="text-xs text-gray-500 ml-2">(${(file.size / 1024 / 1024).toFixed(2)} MB)</span>
`;
list.appendChild(item);
});
fileList.appendChild(list);
}
});
// Handle form submission
assignmentForm.addEventListener('submit', (e) => {
e.preventDefault();
// In a real app, you would send this data to your server
console.log('Assignment submitted:', {
title: document.getElementById('assignmentTitle').value,
class: document.getElementById('assignmentClass').value,
dueDate: document.getElementById('dueDate').value,
description: document.getElementById('assignmentDescription').value,
files: assignmentFiles.files
});
// Show success notification
notificationMessage.textContent = 'Assignment posted successfully!';
notificationToast.classList.remove('hidden');
notificationToast.classList.add('notification');
// Close modal and reset form
closeModals();
assignmentForm.reset();
fileList.innerHTML = '';
// Hide notification after 5 seconds
setTimeout(() => {
notificationToast.classList.add('hidden');
}, 5000);
});
// Handle tab switching
tabButtons.forEach(button => {
button.addEventListener('click', () => {
// Update active tab styling
tabButtons.forEach(btn => {
btn.classList.remove('border-indigo-600', 'text-indigo-600');
btn.classList.add('border-transparent', 'hover:text-gray-600', 'hover:border-gray-300');
});
button.classList.add('border-indigo-600', 'text-indigo-600');
button.classList.remove('border-transparent', 'hover:text-gray-600', 'hover:border-gray-300');
// Show the corresponding content
const tabId = button.getAttribute('data-tab');
tabContents.forEach(content => {
content.classList.add('hidden');
if (content.id === `${tabId}Assignments`) {
content.classList.remove('hidden');
}
});
});
});
// Handle view submissions (sample - in a real app you'd have dynamic data)
document.addEventListener('click', (e) => {
if (e.target.classList.contains('grade-btn')) {
const studentName = e.target.getAttribute('data-student');
document.getElementById('studentName').textContent = studentName;
gradingModal.classList.remove('hidden');
submissionsModal.classList.add('hidden');
}
if (e.target.textContent === 'View Submissions' ||
e.target.parentElement.textContent === 'View Submissions') {
submissionsModal.classList.remove('hidden');
}
});
// Handle grading form submission
gradingForm.addEventListener('submit', (e) => {
e.preventDefault();
// In a real app, you would send this data to your server
console.log('Grade submitted:', {
grade: document.getElementById('grade').value,
status: document.getElementById('status').value,
feedback: document.getElementById('feedback').value,
files: document.getElementById('feedbackFiles').files
});
// Show success notification
notificationMessage.textContent = 'Grade submitted successfully!';
notificationToast.classList.remove('hidden');
notificationToast.classList.add('notification');
// Close modal and reset form
closeModals();
gradingForm.reset();
// Hide notification after 5 seconds
setTimeout(() => {
notificationToast.classList.add('hidden');
}, 5000);
});
// Close notification
closeNotificationBtn.addEventListener('click', () => {
notificationToast.classList.add('hidden');
});
// Close modals when clicking outside
window.addEventListener('click', (e) => {
if (e.target === assignmentModal) closeModals();
if (e.target === submissionsModal) closeModals();
if (e.target === gradingModal) closeModals();
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=kevoh/cbv" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>