as-booking / index.html
ASICT's picture
Add 1 files
5474b99 verified
Raw History Blame Contribute Delete
51 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aminiya School Venue Booking 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">
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: {
50: '#f0fdf4',
100: '#dcfce7',
200: '#bbf7d0',
300: '#86efac',
400: '#4ade80',
500: '#22c55e',
600: '#16a34a',
700: '#15803d',
800: '#166534',
900: '#14532d',
}
}
}
}
}
</script>
<style>
.booking-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}
.time-slot {
transition: all 0.2s ease;
}
.time-slot:hover {
transform: scale(1.05);
}
.modal {
transition: opacity 0.3s ease;
}
</style>
</head>
<body class="bg-gray-50">
<header class="bg-primary-800 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-3">
<i class="fas fa-school text-3xl"></i>
<h1 class="text-2xl font-bold">Aminiya School Venue Booking</h1>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<i class="fas fa-bell absolute left-3 top-1/2 transform -translate-y-1/2 text-primary-200"></i>
<div class="bg-primary-600 text-xs rounded-full w-5 h-5 flex items-center justify-center absolute -right-1 -top-1">3</div>
</div>
<div class="flex items-center space-x-2">
<div class="w-8 h-8 rounded-full bg-primary-600 flex items-center justify-center">
<i class="fas fa-user"></i>
</div>
<span>Admin</span>
</div>
</div>
</div>
</div>
</header>
<main class="container mx-auto px-4 py-8">
<div class="grid grid-cols-1 md:grid-cols-4 gap-6">
<!-- Sidebar -->
<div class="md:col-span-1 bg-white rounded-lg shadow p-6 h-fit">
<h2 class="text-xl font-semibold text-primary-800 mb-4">Filters</h2>
<div class="mb-6">
<h3 class="font-medium text-primary-700 mb-2">Venue Type</h3>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600" checked>
<span>All Venues</span>
</label>
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600">
<span>Classrooms</span>
</label>
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600">
<span>Special Rooms</span>
</label>
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600">
<span>Halls</span>
</label>
</div>
</div>
<div class="mb-6">
<h3 class="font-medium text-primary-700 mb-2">Availability</h3>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600" checked>
<span>Available Now</span>
</label>
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600">
<span>Booked</span>
</label>
</div>
</div>
<div>
<h3 class="font-medium text-primary-700 mb-2">Duration</h3>
<div class="space-y-2">
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600">
<span>35 minutes</span>
</label>
<label class="flex items-center space-x-2">
<input type="checkbox" class="rounded text-primary-600">
<span>90 minutes</span>
</label>
</div>
</div>
</div>
<!-- Main Content -->
<div class="md:col-span-3">
<div class="bg-white rounded-lg shadow p-6 mb-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold text-primary-800">Available Venues</h2>
<div class="flex space-x-3">
<button id="newBookingBtn" class="bg-primary-600 hover:bg-primary-700 text-white px-4 py-2 rounded-lg flex items-center space-x-2">
<i class="fas fa-plus"></i>
<span>New Booking</span>
</button>
<div class="relative">
<input type="text" placeholder="Search venues..." class="border border-gray-300 rounded-lg pl-10 pr-4 py-2 w-64 focus:outline-none focus:ring-2 focus:ring-primary-500">
<i class="fas fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<!-- AV Room -->
<div class="booking-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="bg-primary-700 p-4 text-white">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg">AV Room</h3>
<p class="text-primary-100">Capacity: 50</p>
</div>
<div class="bg-primary-800 text-xs px-2 py-1 rounded-full">Special Room</div>
</div>
</div>
<div class="p-4">
<div class="flex items-center mb-3">
<div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
<span class="text-sm font-medium">Available</span>
</div>
<p class="text-gray-600 text-sm mb-4">Equipped with projector, sound system, and video conferencing.</p>
<div class="space-y-2 mb-4">
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="AV Room" data-time="7:10 - 8:00" data-duration="50">
<span>7:10 - 8:00</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">50 min</span>
</div>
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="AV Room" data-time="9:00 - 10:30" data-duration="90">
<span>9:00 - 10:30</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">90 min</span>
</div>
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>11:00 - 12:30</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
</div>
<button class="book-venue-btn w-full bg-primary-600 hover:bg-primary-700 text-white py-2 rounded-lg text-sm font-medium" data-venue="AV Room">
Book This Venue
</button>
</div>
</div>
<!-- AV Room 2 -->
<div class="booking-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="bg-primary-700 p-4 text-white">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg">AV Room 2</h3>
<p class="text-primary-100">Capacity: 30</p>
</div>
<div class="bg-primary-800 text-xs px-2 py-1 rounded-full">Special Room</div>
</div>
</div>
<div class="p-4">
<div class="flex items-center mb-3">
<div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
<span class="text-sm font-medium">Booked until 2:00 PM</span>
</div>
<p class="text-gray-600 text-sm mb-4">Smaller AV room with basic projection and sound equipment.</p>
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-3 mb-4">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-info-circle text-yellow-400"></i>
</div>
<div class="ml-3">
<p class="text-sm text-yellow-700">
Currently booked by <span class="font-medium">Mr. Johnson</span> for <span class="font-medium">Grade 10 Science</span>
</p>
</div>
</div>
</div>
<div class="space-y-2">
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>8:00 - 9:30</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>10:00 - 11:30</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="AV Room 2" data-time="2:00 - 2:35" data-duration="35">
<span>2:00 - 2:35</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">35 min</span>
</div>
</div>
</div>
</div>
<!-- Computer Lab -->
<div class="booking-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="bg-primary-700 p-4 text-white">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg">Computer Lab</h3>
<p class="text-primary-100">Capacity: 25</p>
</div>
<div class="bg-primary-800 text-xs px-2 py-1 rounded-full">Special Room</div>
</div>
</div>
<div class="p-4">
<div class="flex items-center mb-3">
<div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
<span class="text-sm font-medium">Available</span>
</div>
<p class="text-gray-600 text-sm mb-4">25 computers with programming software and internet access.</p>
<div class="space-y-2 mb-4">
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="Computer Lab" data-time="9:00 - 10:30" data-duration="90">
<span>9:00 - 10:30</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">90 min</span>
</div>
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="Computer Lab" data-time="11:00 - 11:35" data-duration="35">
<span>11:00 - 11:35</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">35 min</span>
</div>
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="Computer Lab" data-time="4:00 - 5:30" data-duration="90">
<span>4:00 - 5:30</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">90 min</span>
</div>
</div>
<button class="book-venue-btn w-full bg-primary-600 hover:bg-primary-700 text-white py-2 rounded-lg text-sm font-medium" data-venue="Computer Lab">
Book This Venue
</button>
</div>
</div>
<!-- Activity Hall -->
<div class="booking-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="bg-primary-700 p-4 text-white">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg">Activity Hall</h3>
<p class="text-primary-100">Capacity: 100</p>
</div>
<div class="bg-primary-800 text-xs px-2 py-1 rounded-full">Hall</div>
</div>
</div>
<div class="p-4">
<div class="flex items-center mb-3">
<div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
<span class="text-sm font-medium">Available</span>
</div>
<p class="text-gray-600 text-sm mb-4">Large space for assemblies, performances, and sports activities.</p>
<div class="space-y-2 mb-4">
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="Activity Hall" data-time="7:10 - 8:00" data-duration="50">
<span>7:10 - 8:00</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">50 min</span>
</div>
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>10:00 - 11:30</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="Activity Hall" data-time="3:00 - 3:35" data-duration="35">
<span>3:00 - 3:35</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">35 min</span>
</div>
</div>
<button class="book-venue-btn w-full bg-primary-600 hover:bg-primary-700 text-white py-2 rounded-lg text-sm font-medium" data-venue="Activity Hall">
Book This Venue
</button>
</div>
</div>
<!-- Classroom 05-01 -->
<div class="booking-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="bg-primary-700 p-4 text-white">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg">Classroom 05-01</h3>
<p class="text-primary-100">Capacity: 35</p>
</div>
<div class="bg-primary-800 text-xs px-2 py-1 rounded-full">Classroom</div>
</div>
</div>
<div class="p-4">
<div class="flex items-center mb-3">
<div class="w-3 h-3 rounded-full bg-green-500 mr-2"></div>
<span class="text-sm font-medium">Available</span>
</div>
<p class="text-gray-600 text-sm mb-4">Standard classroom with whiteboard and projector.</p>
<div class="space-y-2 mb-4">
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="Classroom 05-01" data-time="7:10 - 8:00" data-duration="50">
<span>7:10 - 8:00</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">50 min</span>
</div>
<div class="time-slot bg-primary-100 text-primary-800 text-sm font-medium px-3 py-2 rounded cursor-pointer flex justify-between items-center" data-venue="Classroom 05-01" data-time="10:00 - 10:35" data-duration="35">
<span>10:00 - 10:35</span>
<span class="text-xs bg-primary-200 px-2 py-1 rounded">35 min</span>
</div>
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>11:00 - 12:30</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
</div>
<button class="book-venue-btn w-full bg-primary-600 hover:bg-primary-7 00 text-white py-2 rounded-lg text-sm font-medium" data-venue="Classroom 05-01">
Book This Venue
</button>
</div>
</div>
<!-- Classroom 05-02 -->
<div class="booking-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="bg-primary-7 00 p-4 text-white">
<div class="flex justify-between items-start">
<div>
<h3 class="font-bold text-lg">Classroom 05-02</h3>
<p class="text-primary-100">Capacity: 35</p>
</div>
<div class="bg-primary-800 text-xs px-2 py-1 rounded-full">Classroom</div>
</div>
</div>
<div class="p-4">
<div class="flex items-center mb-3">
<div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
<span class="text-sm font-medium">Booked all day</span>
</div>
<p class="text-gray-600 text-sm mb-4">Standard classroom with smart board.</p>
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-3 mb-4">
<div class="flex">
<div class="flex-shrink-0">
<i class="fas fa-info-circle text-yellow-400"></i>
</div>
<div class="ml-3">
<p class="text-sm text-yellow-700">
Reserved for <span class="font-medium">Ms. Rodriguez</span> for <span class="font-medium">Grade 12 Parent-Teacher Meetings</span>
</p>
</div>
</div>
</div>
<div class="space-y-2">
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>7:10 - 8:00</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>10:00 - 11:30</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
<div class="time-slot bg-gray-100 text-gray-500 text-sm font-medium px-3 py-2 rounded cursor-not-allowed flex justify-between items-center">
<span>3:00 - 4:30</span>
<span class="text-xs bg-gray-200 px-2 py-1 rounded">Booked</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Calendar View -->
<div class="bg-white rounded-lg shadow p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-2xl font-bold text-primary-800">Weekly Schedule</h2>
<div class="flex space-x-2">
<button id="todayBtn" class="bg-primary-100 text-primary-800 px-3 py-1 rounded-lg">Today</button>
<button id="weekBtn" class="bg-primary-600 text-white px-3 py-1 rounded-lg">Week</button>
<button id="monthBtn" class="bg-primary-100 text-primary-800 px-3 py-1 rounded-lg">Month</button>
</div>
</div>
<div class="overflow-x-auto">
<table class="w-full" id="calendarTable">
<thead>
<tr class="border-b border-gray-200">
<th class="text-left py-3 px-4 w-32">Time</th>
<th class="text-left py-3 px-4">Monday</th>
<th class="text-left py-3 px-4">Tuesday</th>
<th class="text-left py-3 px-4">Wednesday</th>
<th class="text-left py-3 px-4">Thursday</th>
<th class="text-left py-3 px-4">Friday</th>
</tr>
</thead>
<tbody id="calendarBody">
<!-- Calendar content will be generated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</main>
<!-- Booking Modal -->
<div id="bookingModal" class="modal fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 opacity-0 pointer-events-none transition-opacity duration-300">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md transform transition-all">
<div class="bg-primary-700 text-white p-4 rounded-t-lg flex justify-between items-center">
<h3 class="text-lg font-semibold">New Booking</h3>
<button id="closeModal" class="text-white hover:text-primary-200">
<i class="fas fa-times"></i>
</button>
</div>
<div class="p-6">
<div class="mb-4">
<label class="block text-gray-700 text-sm font-medium mb-2" for="venue">Venue</label>
<select id="venue" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500">
<option value="">Select a venue</option>
<option value="AV Room">AV Room</option>
<option value="AV Room 2">AV Room 2</option>
<option value="Computer Lab">Computer Lab</option>
<option value="Activity Hall">Activity Hall</option>
<option value="Classroom 05-01">Classroom 05-01</option>
<option value="Classroom 05-02">Classroom 05-02</option>
<option value="Classroom 05-03">Classroom 05-03</option>
</select>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-medium mb-2" for="date">Date</label>
<input type="date" id="date" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500">
</div>
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-gray-700 text-sm font-medium mb-2" for="startTime">Start Time</label>
<select id="startTime" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500">
<option value="">Select</option>
<option value="7:10">7:10 AM</option>
<option value="8:00">8:00 AM</option>
<option value="9:00">9:00 AM</option>
<option value="10:00">10:00 AM</option>
<option value="11:00">11:00 AM</option>
<option value="12:00">12:00 PM</option>
<option value="1:00">1:00 PM</option>
<option value="2:00">2:00 PM</option>
<option value="3:00">3:00 PM</option>
<option value="4:00">4:00 PM</option>
<option value="5:00">5:00 PM</option>
</select>
</div>
<div>
<label class="block text-gray-700 text-sm font-medium mb-2" for="duration">Duration</label>
<select id="duration" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500">
<option value="35">35 minutes</option>
<option value="90">90 minutes</option>
</select>
</div>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-medium mb-2" for="bookedBy">Booked By</label>
<input type="text" id="bookedBy" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500" placeholder="Teacher's name">
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-medium mb-2" for="purpose">Purpose/Class</label>
<input type="text" id="purpose" class="w-full border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-primary-500" placeholder="Grade/Subject/Activity">
</div>
<div class="flex justify-end space-x-3">
<button id="cancelBooking" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">Cancel</button>
<button id="confirmBooking" class="px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700">Confirm Booking</button>
</div>
</div>
</div>
</div>
<footer class="bg-primary-900 text-white py-8 mt-12">
<div class="container mx-auto px-4">
<div class="grid grid-cols-1 md:grid-cols-4 gap-8">
<div>
<h3 class="text-lg font-semibold mb-4">Aminiya School</h3>
<p class="text-primary-200 text-sm">Providing quality education since 1975. Our venue booking system helps manage school resources efficiently.</p>
</div>
<div>
<h3 class="text-lg font-semibold mb-4">Quick Links</h3>
<ul class="space-y-2 text-sm text-primary-200">
<li><a href="#" class="hover:text-white">Home</a></li>
<li><a href="#" class="hover:text-white">Book a Venue</a></li>
<li><a href="#" class="hover:text-white">Calendar</a></li>
<li><a href="#" class="hover:text-white">My Bookings</a></li>
</ul>
</div>
<div>
<h3 class="text-lg font-semibold mb-4">Contact</h3>
<ul class="space-y-2 text-sm text-primary-200">
<li class="flex items-center space-x-2">
<i class="fas fa-map-marker-alt"></i>
<span>123 School Road, Aminiya</span>
</li>
<li class="flex items-center space-x-2">
<i class="fas fa-phone"></i>
<span>(123) 456-7890</span>
</li>
<li class="flex items-center space-x-2">
<i class="fas fa-envelope"></i>
<span>bookings@aminiya.edu</span>
</li>
</ul>
</div>
<div>
<h3 class="text-lg font-semibold mb-4">Help</h3>
<ul class="space-y-2 text-sm text-primary-200">
<li><a href="#" class="hover:text-white">FAQs</a></li>
<li><a href="#" class="hover:text-white">Booking Guidelines</a></li>
<li><a href="#" class="hover:text-white">System Requirements</a></li>
<li><a href="#" class="hover:text-white">Report an Issue</a></li>
</ul>
</div>
</div>
<div class="border-t border-primary-800 mt-8 pt-6 text-sm text-primary-300 text-center">
<p>© 2023 Aminiya School. All rights reserved.</p>
</div>
</div>
</footer>
<script>
// Store all bookings
let bookings = [
// Monday
{ venue: "AV Room", day: "Monday", time: "7:10 - 7:45", purpose: "Morning Assembly", bookedBy: "Admin" },
{ venue: "Activity Hall", day: "Monday", time: "9:00 - 10:30", purpose: "Assembly", bookedBy: "Principal" },
{ venue: "Activity Hall", day: "Monday", time: "4:00 - 5:30", purpose: "Sports Practice", bookedBy: "Coach Smith" },
// Tuesday
{ venue: "AV Room 2", day: "Tuesday", time: "9:00 - 10:30", purpose: "Film Studies", bookedBy: "Mr. Johnson" },
{ venue: "Computer Lab", day: "Tuesday", time: "11:00 - 11:35", purpose: "Programming", bookedBy: "Ms. Davis" },
// Wednesday
{ venue: "Activity Hall", day: "Wednesday", time: "7:10 - 7:45", purpose: "Yoga Class", bookedBy: "Ms. Taylor" },
{ venue: "AV Room", day: "Wednesday", time: "11:00 - 11:35", purpose: "Guest Lecture", bookedBy: "Dr. Wilson" },
{ venue: "AV Room 2", day: "Wednesday", time: "4:00 - 5:30", purpose: "Teacher Meeting", bookedBy: "Principal" },
// Thursday
{ venue: "Classroom 05-03", day: "Thursday", time: "9:00 - 10:30", purpose: "Debate Prep", bookedBy: "Mr. Brown" },
{ venue: "Classroom 05-01", day: "Thursday", time: "4:00 - 5:30", purpose: "Math Olympiad", bookedBy: "Ms. Rodriguez" },
// Friday
{ venue: "Classroom 05-01", day: "Friday", time: "7:10 - 7:45", purpose: "Math Club", bookedBy: "Ms. Rodriguez" },
{ venue: "Classroom 05-02", day: "Friday", time: "11:00 - 11:35", purpose: "Study Group", bookedBy: "Mr. Lee" }
];
// Modal functionality
const modal = document.getElementById('bookingModal');
const newBookingBtn = document.getElementById('newBookingBtn');
const closeModal = document.getElementById('closeModal');
const cancelBooking = document.getElementById('cancelBooking');
const confirmBooking = document.getElementById('confirmBooking');
// Calendar view buttons
const todayBtn = document.getElementById('todayBtn');
const weekBtn = document.getElementById('weekBtn');
const monthBtn = document.getElementById('monthBtn');
// Calendar elements
const calendarBody = document.getElementById('calendarBody');
// Time slots for the calendar
const timeSlots = [
"7:10 - 7:45",
"9:00 - 10:30",
"11:00 - 11:35",
"4:00 - 5:30"
];
// Days of the week
const days = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"];
// Initialize the calendar
function initCalendar() {
calendarBody.innerHTML = '';
timeSlots.forEach(timeSlot => {
const row = document.createElement('tr');
row.className = 'border-b border-gray-100';
// Add time cell
const timeCell = document.createElement('td');
timeCell.className = 'py-3 px-4 text-sm font-medium';
timeCell.textContent = timeSlot;
row.appendChild(timeCell);
// Add day cells
days.forEach(day => {
const dayCell = document.createElement('td');
dayCell.className = 'py-3 px-4';
// Find bookings for this day and time slot
const dayBookings = bookings.filter(booking =>
booking.day === day && booking.time === timeSlot
);
if (dayBookings.length > 0) {
dayBookings.forEach(booking => {
const bookingDiv = document.createElement('div');
bookingDiv.className = 'bg-primary-100 text-primary-800 text-xs p-2 rounded mb-1';
bookingDiv.innerHTML = `${booking.venue}<br>${booking.purpose}`;
dayCell.appendChild(bookingDiv);
});
}
row.appendChild(dayCell);
});
calendarBody.appendChild(row);
});
}
// Function to show modal
function showModal(venue = '', time = '', duration = '35') {
// Set default values if provided
if (venue) {
document.getElementById('venue').value = venue;
}
if (time) {
document.getElementById('startTime').value = time.split(':')[0] + ':' + time.split(':')[1];
}
document.getElementById('duration').value = duration;
// Set default date to today
const today = new Date();
const formattedDate = today.toISOString().split('T')[0];
document.getElementById('date').value = formattedDate;
// Show modal
modal.classList.remove('opacity-0', 'pointer-events-none');
modal.classList.add('opacity-100');
}
// Function to hide modal
function hideModal() {
modal.classList.remove('opacity-100');
modal.classList.add('opacity-0', 'pointer-events-none');
}
// Event listeners for opening modal
newBookingBtn.addEventListener('click', () => showModal());
// Event listeners for book venue buttons
document.querySelectorAll('.book-venue-btn').forEach(button => {
button.addEventListener('click', function() {
const venue = this.getAttribute('data-venue');
showModal(venue);
});
});
// Event listeners for time slots
document.querySelectorAll('.time-slot').forEach(slot => {
if (!slot.classList.contains('cursor-not-allowed')) {
slot.addEventListener('click', function() {
const venue = this.getAttribute('data-venue');
const time = this.getAttribute('data-time').split(' - ')[0];
const duration = this.getAttribute('data-duration');
// Highlight selected time slot
document.querySelectorAll('.time-slot').forEach(s => {
s.classList.remove('bg-primary-500', 'text-white');
s.classList.add('bg-primary-100', 'text-primary-800');
});
this.classList.remove('bg-primary-100', 'text-primary-800');
this.classList.add('bg-primary-500', 'text-white');
showModal(venue, time, duration);
});
}
});
// Event listeners for closing modal
closeModal.addEventListener('click', hideModal);
cancelBooking.addEventListener('click', hideModal);
// Confirm booking
confirmBooking.addEventListener('click', function() {
const venue = document.getElementById('venue').value;
const date = document.getElementById('date').value;
const startTime = document.getElementById('startTime').value;
const duration = document.getElementById('duration').value;
const bookedBy = document.getElementById('bookedBy').value;
const purpose = document.getElementById('purpose').value;
if (venue && date && startTime && bookedBy && purpose) {
// Calculate end time
const [hours, minutes] = startTime.split(':').map(Number);
const durationMinutes = parseInt(duration);
const endTime = new Date(0, 0, 0, hours, minutes + durationMinutes);
const endTimeStr = `${endTime.getHours()}:${endTime.getMinutes().toString().padStart(2, '0')}`;
// Format time slot for display
const timeSlot = `${startTime} - ${endTimeStr}`;
// Get day of week from date
const dateObj = new Date(date);
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const day = days[dateObj.getDay()];
// Add to bookings
bookings.push({
venue,
day,
time: timeSlot,
purpose,
bookedBy
});
alert(`Booking confirmed!\n\nVenue: ${venue}\nDate: ${date} (${day})\nTime: ${timeSlot}\nBooked by: ${bookedBy}\nPurpose: ${purpose}`);
// Update calendar
initCalendar();
hideModal();
// Reset form
document.getElementById('venue').value = '';
document.getElementById('date').value = '';
document.getElementById('startTime').value = '';
document.getElementById('bookedBy').value = '';
document.getElementById('purpose').value = '';
} else {
alert('Please fill in all fields');
}
});
// Calendar view buttons functionality
todayBtn.addEventListener('click', function() {
todayBtn.classList.remove('bg-primary-100', 'text-primary-800');
todayBtn.classList.add('bg-primary-600', 'text-white');
weekBtn.classList.remove('bg-primary-600', 'text-white');
weekBtn.classList.add('bg-primary-100', 'text-primary-800');
monthBtn.classList.remove('bg-primary-600', 'text-white');
monthBtn.classList.add('bg-primary-100', 'text-primary-800');
// Filter bookings for today
const today = new Date();
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const todayName = days[today.getDay()];
// Update calendar to show only today's bookings
updateCalendarForDay(todayName);
});
weekBtn.addEventListener('click', function() {
weekBtn.classList.remove('bg-primary-100', 'text-primary-800');
weekBtn.classList.add('bg-primary-600', 'text-white');
todayBtn.classList.remove('bg-primary-600', 'text-white');
todayBtn.classList.add('bg-primary-100', 'text-primary-800');
monthBtn.classList.remove('bg-primary-600', 'text-white');
monthBtn.classList.add('bg-primary-100', 'text-primary-800');
// Show full week view
initCalendar();
});
monthBtn.addEventListener('click', function() {
monthBtn.classList.remove('bg-primary-100', 'text-primary-800');
monthBtn.classList.add('bg-primary-600', 'text-white');
todayBtn.classList.remove('bg-primary-600', 'text-white');
todayBtn.classList.add('bg-primary-100', 'text-primary-800');
weekBtn.classList.remove('bg-primary-600', 'text-white');
weekBtn.classList.add('bg-primary-100', 'text-primary-800');
// Show monthly view (simplified for this example)
alert("Monthly view would show all bookings for the current month. For this demo, we're showing the weekly view.");
initCalendar();
});
// Function to update calendar for a specific day
function updateCalendarForDay(dayName) {
calendarBody.innerHTML = '';
timeSlots.forEach(timeSlot => {
const row = document.createElement('tr');
row.className = 'border-b border-gray-100';
// Add time cell
const timeCell = document.createElement('td');
timeCell.className = 'py-3 px-4 text-sm font-medium';
timeCell.textContent = timeSlot;
row.appendChild(timeCell);
// Add day cell (only showing the selected day)
const dayCell = document.createElement('td');
dayCell.className = 'py-3 px-4';
// Find bookings for this day and time slot
const dayBookings = bookings.filter(booking =>
booking.day === dayName && booking.time === timeSlot
);
if (dayBookings.length > 0) {
dayBookings.forEach(booking => {
const bookingDiv = document.createElement('div');
bookingDiv.className = 'bg-primary-100 text-primary-800 text-xs p-2 rounded mb-1';
bookingDiv.innerHTML = `${booking.venue}<br>${booking.purpose}`;
dayCell.appendChild(bookingDiv);
});
}
// Add empty cells for other days (since we're showing just one day)
for (let i = 0; i < 4; i++) {
const emptyCell = document.createElement('td');
emptyCell.className = 'py-3 px-4';
row.appendChild(emptyCell);
}
// Insert the day cell in the correct position based on dayName
const dayIndex = days.indexOf(dayName);
if (dayIndex !== -1) {
row.insertBefore(dayCell, row.children[dayIndex + 1]);
} else {
row.appendChild(dayCell);
}
calendarBody.appendChild(row);
});
}
// Initialize the calendar on page load
document.addEventListener('DOMContentLoaded', initCalendar);
</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=ASICT/as-booking" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>