teddy / index.html
teddygee's picture
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>School Library Borrowing System</title> <style> body { font-family: Arial, sans-serif; background: #f2f2f2; padding: 20px; } h1 { text-align: center; color: #333; } .form-container { max-width: 600px; margin: auto; background: white; padding: 20px; box-shadow: 0 0 10px rgba(0,0,0,0.1); border-radius: 10px; } input, select, button { width: 100%; padding: 10px; margin: 8px 0; border: 1px solid #ccc; border-radius: 5px; } table { width: 90%; margin: 30px auto; border-collapse: collapse; background: white; } th, td { padding: 12px; border: 1px solid #ccc; text-align: center; } th { background-color: #4CAF50; color: white; } </style> </head> <body> <h1>School Library Borrowing System</h1> <div class="form-container"> <form id="borrowForm"> <label>Admission Number:</label> <input type="text" id="admission" required> <label>Book Number:</label> <input type="text" id="bookNumber" required> <label>Book Name:</label> <input type="text" id="bookName" required> <label>Class:</label> <select id="class" required> <option value="">Select Class</option> <option value="Form 1">Form 1</option> <option value="Form 2">Form 2</option> <option value="Form 3">Form 3</option> <option value="Form 4">Form 4</option> </select> <label>Stream:</label> <select id="stream" required> <option value="">Select Stream</option> <option value="North">North</option> <option value="South">South</option> <option value="East">East</option> <option value="West">West</option> </select> <button type="submit">Borrow Book</button> </form> </div> <table id="borrowLog"> <thead> <tr> <th>Admission #</th> <th>Book #</th> <th>Book Name</th> <th>Class</th> <th>Stream</th> </tr> </thead> <tbody> <!-- Borrowed entries will appear here --> </tbody> </table> <script> document.getElementById('borrowForm').addEventListener('submit', function(e) { e.preventDefault(); const admission = document.getElementById('admission').value; const bookNumber = document.getElementById('bookNumber').value; const bookName = document.getElementById('bookName').value; const className = document.getElementById('class').value; const stream = document.getElementById('stream').value; const table = document.getElementById('borrowLog').getElementsByTagName('tbody')[0]; const newRow = table.insertRow(); newRow.innerHTML = ` <td>${admission}</td> <td>${bookNumber}</td> <td>${bookName}</td> <td>${className}</td> <td>${stream}</td> `; // Clear form this.reset(); }); </script> </body> </html> - Initial Deployment
d2e0abb verified
Raw History Blame Contribute Delete
23.6 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>School Library Borrowing System</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>
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Poppins', sans-serif;
background-color: #f8fafc;
}
.book-card {
transition: all 0.3s ease;
}
.book-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #f1f1f1;
}
::-webkit-scrollbar-thumb {
background: #888;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
</style>
</head>
<body class="min-h-screen">
<!-- Header -->
<header class="bg-indigo-700 text-white shadow-lg">
<div class="container mx-auto px-4 py-6">
<div class="flex justify-between items-center">
<div class="flex items-center space-x-4">
<i class="fas fa-book-open text-3xl"></i>
<h1 class="text-2xl md:text-3xl font-bold">School Library System</h1>
</div>
<div class="flex items-center space-x-4">
<button id="themeToggle" class="p-2 rounded-full bg-indigo-600 hover:bg-indigo-800 transition">
<i class="fas fa-moon"></i>
</button>
<div class="relative">
<button id="userMenu" class="flex items-center space-x-2">
<img src="https://ui-avatars.com/api/?name=Librarian&background=random" alt="User" class="w-8 h-8 rounded-full">
<span class="hidden md:inline">Librarian</span>
</button>
</div>
</div>
</div>
</div>
</header>
<!-- Main Content -->
<main class="container mx-auto px-4 py-8">
<!-- Dashboard Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="bg-white rounded-lg shadow-md p-6 flex items-center justify-between">
<div>
<p class="text-gray-500">Total Books</p>
<h2 class="text-3xl font-bold text-indigo-700">1,245</h2>
</div>
<div class="bg-indigo-100 p-3 rounded-full">
<i class="fas fa-book text-indigo-700 text-xl"></i>
</div>
</div>
<div class="bg-white rounded-lg shadow-md p-6 flex items-center justify-between">
<div>
<p class="text-gray-500">Borrowed Today</p>
<h2 class="text-3xl font-bold text-green-600">28</h2>
</div>
<div class="bg-green-100 p-3 rounded-full">
<i class="fas fa-exchange-alt text-green-600 text-xl"></i>
</div>
</div>
<div class="bg-white rounded-lg shadow-md p-6 flex items-center justify-between">
<div>
<p class="text-gray-500">Overdue Books</p>
<h2 class="text-3xl font-bold text-red-600">5</h2>
</div>
<div class="bg-red-100 p-3 rounded-full">
<i class="fas fa-exclamation-triangle text-red-600 text-xl"></i>
</div>
</div>
<div class="bg-white rounded-lg shadow-md p-6 flex items-center justify-between">
<div>
<p class="text-gray-500">Available Books</p>
<h2 class="text-3xl font-bold text-blue-600">1,017</h2>
</div>
<div class="bg-blue-100 p-3 rounded-full">
<i class="fas fa-check-circle text-blue-600 text-xl"></i>
</div>
</div>
</div>
<!-- Borrow Book Form -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden mb-8">
<div class="bg-indigo-700 px-6 py-4">
<h2 class="text-xl font-semibold text-white">Borrow a Book</h2>
</div>
<div class="p-6">
<form id="borrowForm" class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Student Information -->
<div class="space-y-4">
<h3 class="text-lg font-medium text-gray-700 border-b pb-2">Student Information</h3>
<div>
<label for="admission" class="block text-sm font-medium text-gray-700 mb-1">Admission Number</label>
<div class="relative">
<input type="text" id="admission" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition"
placeholder="Enter admission number">
<div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
<i class="fas fa-id-card text-gray-400"></i>
</div>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="class" class="block text-sm font-medium text-gray-700 mb-1">Class</label>
<select id="class" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
<option value="">Select Class</option>
<option value="Form 1">Form 1</option>
<option value="Form 2">Form 2</option>
<option value="Form 3">Form 3</option>
<option value="Form 4">Form 4</option>
</select>
</div>
<div>
<label for="stream" class="block text-sm font-medium text-gray-700 mb-1">Stream</label>
<select id="stream" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
<option value="">Select Stream</option>
<option value="North">North</option>
<option value="South">South</option>
<option value="East">East</option>
<option value="West">West</option>
</select>
</div>
</div>
</div>
<!-- Book Information -->
<div class="space-y-4">
<h3 class="text-lg font-medium text-gray-700 border-b pb-2">Book Information</h3>
<div>
<label for="bookNumber" class="block text-sm font-medium text-gray-700 mb-1">Book Number</label>
<div class="relative">
<input type="text" id="bookNumber" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition"
placeholder="Enter book number">
<div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
<i class="fas fa-barcode text-gray-400"></i>
</div>
</div>
</div>
<div>
<label for="bookName" class="block text-sm font-medium text-gray-700 mb-1">Book Title</label>
<div class="relative">
<input type="text" id="bookName" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition"
placeholder="Enter book title">
<div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
<i class="fas fa-book text-gray-400"></i>
</div>
</div>
</div>
<div>
<label for="dueDate" class="block text-sm font-medium text-gray-700 mb-1">Due Date</label>
<div class="relative">
<input type="date" id="dueDate" required
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
<div class="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">
<i class="fas fa-calendar-alt text-gray-400"></i>
</div>
</div>
</div>
</div>
<div class="md:col-span-2 flex justify-end">
<button type="submit"
class="px-6 py-3 bg-indigo-600 text-white font-medium rounded-lg hover:bg-indigo-700 transition flex items-center space-x-2">
<i class="fas fa-book-medical"></i>
<span>Borrow Book</span>
</button>
</div>
</form>
</div>
</div>
<!-- Recent Borrowings -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<div class="flex justify-between items-center bg-indigo-700 px-6 py-4">
<h2 class="text-xl font-semibold text-white">Recent Borrowings</h2>
<div class="flex space-x-2">
<button class="p-2 text-white hover:bg-indigo-600 rounded-lg transition">
<i class="fas fa-filter"></i>
</button>
<button class="p-2 text-white hover:bg-indigo-600 rounded-lg transition">
<i class="fas fa-search"></i>
</button>
</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">
Admission #
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Book Details
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Class/Stream
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Date Borrowed
</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Due Date
</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">
Actions
</th>
</tr>
</thead>
<tbody id="borrowLog" class="bg-white divide-y divide-gray-200">
<!-- Sample data -->
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">STD2023001</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 bg-indigo-100 rounded-lg flex items-center justify-center">
<i class="fas fa-book text-indigo-600"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">BK-1245</div>
<div class="text-sm text-gray-500">Introduction to Biology</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">Form 2</div>
<div class="text-sm text-gray-500">North</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">15 Jun 2023</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">22 Jun 2023</div>
</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">
Active
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-indigo-600 hover:text-indigo-900 mr-3">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-900">
<i class="fas fa-trash-alt"></i>
</button>
</td>
</tr>
<!-- More entries will be added here by JavaScript -->
</tbody>
</table>
</div>
<div class="bg-gray-50 px-6 py-4 flex items-center justify-between border-t border-gray-200">
<div class="flex-1 flex justify-between sm:hidden">
<a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
Previous
</a>
<a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
Next
</a>
</div>
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
<div>
<p class="text-sm text-gray-700">
Showing <span class="font-medium">1</span> to <span class="font-medium">5</span> of <span class="font-medium">24</span> entries
</p>
</div>
<div>
<nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination">
<a href="#" class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<span class="sr-only">Previous</span>
<i class="fas fa-chevron-left"></i>
</a>
<a href="#" aria-current="page" class="z-10 bg-indigo-50 border-indigo-500 text-indigo-600 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
1
</a>
<a href="#" class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
2
</a>
<a href="#" class="bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border text-sm font-medium">
3
</a>
<a href="#" class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
<span class="sr-only">Next</span>
<i class="fas fa-chevron-right"></i>
</a>
</nav>
</div>
</div>
</div>
</div>
</main>
<!-- Footer -->
<footer class="bg-gray-800 text-white py-8 mt-12">
<div class="container mx-auto px-4">
<div class="grid grid-cols-1 md:grid-cols-3 gap-8">
<div>
<h3 class="text-xl font-semibold mb-4">School Library System</h3>
<p class="text-gray-400">Empowering students through knowledge and reading.</p>
<div class="flex space-x-4 mt-4">
<a href="#" class="text-gray-400 hover:text-white transition">
<i class="fab fa-facebook-f"></i>
</a>
<a href="#" class="text-gray-400 hover:text-white transition">
<i class="fab fa-twitter"></i>
</a>
<a href="#" class="text-gray-400 hover:text-white transition">
<i class="fab fa-instagram"></i>
</a>
</div>
</div>
<div>
<h3 class="text-xl font-semibold mb-4">Quick Links</h3>
<ul class="space-y-2">
<li><a href="#" class="text-gray-400 hover:text-white transition">Home</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Books Catalog</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Borrowing Policy</a></li>
<li><a href="#" class="text-gray-400 hover:text-white transition">Contact Us</a></li>
</ul>
</div>
<div>
<h3 class="text-xl font-semibold mb-4">Contact Information</h3>
<address class="not-italic text-gray-400">
<p class="mb-2"><i class="fas fa-map-marker-alt mr-2"></i> 123 School Street, Education City</p>
<p class="mb-2"><i class="fas fa-phone mr-2"></i> +254 712 345 678</p>
<p><i class="fas fa-envelope mr-2"></i> library@school.edu</p>
</address>
</div>
</div>
<div class="border-t border-gray-700 mt-8 pt-8 text-center text-gray-400">
<p>&copy; 2023 School Library System. All rights reserved.</p>
</div>
</div>
</footer>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Theme toggle functionality
const themeToggle = document.getElementById('themeToggle');
themeToggle.addEventListener('click', function() {
document.documentElement.classList.toggle('dark');
const icon = themeToggle.querySelector('i');
if (document.documentElement.classList.contains('dark')) {
icon.classList.replace('fa-moon', 'fa-sun');
document.body.classList.add('bg-gray-900');
document.body.classList.remove('bg-gray-50');
} else {
icon.classList.replace('fa-sun', 'fa-moon');
document.body.classList.remove('bg-gray-900');
document.body.classList.add('bg-gray-50');
}
});
// Form submission
const borrowForm = document.getElementById('borrowForm');
const borrowLog = document.getElementById('borrowLog');
borrowForm.addEventListener('submit', function(e) {
e.preventDefault();
const admission = document.getElementById('admission').value;
const bookNumber = document.getElementById('bookNumber').value;
const bookName = document.getElementById('bookName').value;
const className = document.getElementById('class').value;
const stream = document.getElementById('stream').value;
const dueDate = document.getElementById('dueDate').value;
// Format dates
const today = new Date();
const formattedToday = today.toLocaleDateString('en-US', {
day: 'numeric',
month: 'short',
year: 'numeric'
});
const dueDateObj = new Date(dueDate);
const formattedDueDate = dueDateObj.toLocaleDateString('en-US', {
day: 'numeric',
month: 'short',
year: 'numeric'
});
// Create new table row
const newRow = document.createElement('tr');
newRow.className = 'hover:bg-gray-50 transition';
newRow.innerHTML = `
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm font-medium text-gray-900">${admission}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 bg-indigo-100 rounded-lg flex items-center justify-center">
<i class="fas fa-book text-indigo-600"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">${bookNumber}</div>
<div class="text-sm text-gray-500">${bookName}</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">${className}</div>
<div class="text-sm text-gray-500">${stream}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">${formattedToday}</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">${formattedDueDate}</div>
</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">
Active
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-indigo-600 hover:text-indigo-900 mr-3">
<i class="fas fa-edit"></i>
</button>
<button class="text-red-600 hover:text-red-900">
<i class="fas fa-trash-alt"></i>
</button>
</td>
`;
// Add row to the beginning of the table
borrowLog.insertBefore(newRow, borrowLog.firstChild);
// Show success notification
showNotification('Book borrowed successfully!', 'success');
// Reset form
borrowForm.reset();
});
// Function to show notification
function showNotification(message, type) {
const notification = document.createElement('div');
notification.className = `fixed top-4 right-4 px-6 py-3 rounded-lg shadow-lg text-white font-medium flex items-center space-x-2 transition-all transform translate-x-full ${type === 'success' ? 'bg-green-500' : 'bg-red-500'}`;
notification.innerHTML = `
<i class="fas ${type === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle'}"></i>
<span>${message}</span>
`;
document.body.appendChild(notification);
// Show notification
setTimeout(() => {
notification.classList.remove('translate-x-full');
notification.classList.add('translate-x-0');
}, 10);
// Hide after 3 seconds
setTimeout(() => {
notification.classList.remove('translate-x-0');
notification.classList.add('translate-x-full');
setTimeout(() => {
notification.remove();
}, 300);
}, 3000);
}
// Set default due date to 7 days from today
const today = new Date();
const nextWeek = new Date(today);
nextWeek.setDate(nextWeek.getDate() + 7);
const formattedDate = nextWeek.toISOString().split('T')[0];
document.getElementById('dueDate').value = formattedDate;
});
</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=teddygee/teddy" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>