-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent-availability.html
More file actions
386 lines (350 loc) · 24.7 KB
/
student-availability.html
File metadata and controls
386 lines (350 loc) · 24.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>KU Campus - Student Availability</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');
body { font-family: 'Inter', sans-serif; background-color: #f8fafc; height: 100vh; }
.text-ku-purple { color: #4338ca; }
.focus\:ring-ku-purple:focus { --tw-ring-color: #4338ca; }
.focus\:border-ku-purple:focus { --tw-border-color: #4338ca; }
.hover\:text-ku-purple:hover { color: #4338ca; }
.bg-ku-purple-light { background-color: #ede9fe; }
.bg-ku-purple-new { background-color: #824aef; }
.hover\:bg-ku-purple-new-hover:hover { background-color: #713de6; }
.bg-powerbi-yellow { background-color: #F2C811; }
.hover\:bg-powerbi-yellow-hover:hover { background-color: #e0b80f; }
</style>
</head>
<body class="antialiased flex flex-col">
<!-- Header -->
<header class="h-16 bg-white border-b border-gray-200 px-6 flex items-center justify-between shadow-sm sticky top-0 z-30 flex-shrink-0">
<div class="flex items-center">
<svg class="w-6 h-6 mr-3 text-ku-purple" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path></svg>
<span class="text-xl font-bold text-ku-purple tracking-wide">KU Campus</span>
</div>
<div class="flex items-center space-x-3">
<button class="text-gray-500 hover:text-ku-purple">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-2.81A3 3 0 0018 10V8a6 6 0 10-12 0v2c0 1.5.54 2.92 1.405 4.19L4 17h5m6 0v1a3 3 0 01-6 0v-1m6 0H9"></path></svg>
</button>
<div class="flex items-center space-x-2 cursor-pointer">
<span class="text-sm font-medium text-gray-700 hidden sm:block">Alparslan O.</span>
<img class="h-8 w-8 rounded-full object-cover" src="https://placehold.co/32x32/14b8a6/FFFFFF?text=AO" alt="User Avatar">
<svg class="w-4 h-4 text-gray-500" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path></svg>
</div>
</div>
</header>
<div class="flex flex-1 overflow-hidden">
<!-- Sidebar -->
<aside class="w-16 sm:w-64 bg-slate-800 flex-shrink-0 overflow-y-auto">
<div class="p-4 text-white">
<p class="hidden sm:block text-xs font-medium uppercase tracking-wider mb-4 text-indigo-400">Navigation Menu</p>
<ul class="space-y-3 text-sm">
<li class="group">
<a href="index.html" class="flex items-center p-2 rounded-lg text-gray-400 hover:bg-slate-700 hover:text-white transition duration-150">
<svg class="w-6 h-6 sm:mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"></path></svg>
<span class="hidden sm:block">Home</span>
</a>
</li>
<li class="group">
<a href="search-reserve.html" class="flex items-center p-2 rounded-lg text-gray-400 hover:bg-slate-700 hover:text-white transition duration-150">
<svg class="w-6 h-6 sm:mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
<span class="hidden sm:block">Search & Reserve</span>
</a>
</li>
<li class="group">
<a href="my-reservations.html" class="flex items-center p-2 rounded-lg text-gray-400 hover:bg-slate-700 hover:text-white transition duration-150">
<svg class="w-6 h-6 sm:mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg>
<span class="hidden sm:block">My Reservations</span>
</a>
</li>
<li class="group">
<a href="manage-reservations.html" class="flex items-center p-2 rounded-lg text-gray-400 hover:bg-slate-700 hover:text-white transition duration-150">
<svg class="w-6 h-6 sm:mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"></path></svg>
<span class="hidden sm:block">Manage Reservations</span>
</a>
</li>
<li class="group">
<a href="student-availability.html" class="flex items-center p-2 rounded-lg bg-slate-700 text-white transition duration-150">
<svg class="w-6 h-6 sm:mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"></path></svg>
<span class="hidden sm:block">Student Availability</span>
</a>
</li>
<li class="group">
<a href="manage-facilities.html" class="flex items-center p-2 rounded-lg text-gray-400 hover:bg-slate-700 hover:text-white transition duration-150">
<svg class="w-6 h-6 sm:mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7h18M3 12h18M3 17h18"></path></svg>
<span class="hidden sm:block">Manage Facilities</span>
</a>
</li>
<li>
<a href="powerbi-reports.html" class="flex items-center p-2 rounded-lg text-gray-400 hover:bg-slate-700 hover:text-white transition duration-150">
<svg class="w-6 h-6 sm:mr-3" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4 3a1 1 0 0 0-1 1v16a1 1 0 0 0 2 0V4a1 1 0 0 0-1-1Zm5 4a1 1 0 0 0-1 1v12a1 1 0 0 0 2 0V8a1 1 0 0 0-1-1Zm5 3a1 1 0 0 0-1 1v9a1 1 0 0 0 2 0v-9a1 1 0 0 0-1-1Zm5-4a1 1 0 0 0-1 1v13a1 1 0 0 0 2 0V7a1 1 0 0 0-1-1Z"/></svg>
<span class="hidden sm:block">Power BI Reports</span>
</a>
</li>
</ul>
</div>
</aside>
<!-- Main Content Area -->
<div class="flex-1 overflow-y-auto flex flex-col">
<main class="flex-grow p-6 pb-20">
<div class="mb-6">
<nav class="text-xs sm:text-sm text-gray-500 mb-4">
<span class="text-gray-400">Home / Facility Reservations /</span>
<span class="font-semibold text-ku-purple">Student Availability</span>
</nav>
<h1 class="text-2xl font-bold text-gray-800">Check Student Availability</h1>
<p class="text-gray-500">Search for student availability for facility bookings.</p>
</div>
<!-- Search Card -->
<div class="bg-white rounded-xl shadow-lg p-8 mb-8">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Class Search</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="courseId" class="block text-sm font-medium text-gray-700 mb-2">Course ID</label>
<input type="text" id="courseId" class="w-full border border-gray-300 rounded-lg p-2.5 focus:ring-ku-purple focus:border-ku-purple transition duration-150" placeholder="e.g., 003999">
</div>
<div>
<label for="subjectArea" class="block text-sm font-medium text-gray-700 mb-2">Subject Area</label>
<input type="text" id="subjectArea" class="w-full border border-gray-300 rounded-lg p-2.5 focus:ring-ku-purple focus:border-ku-purple transition duration-150" placeholder="e.g., MATH">
</div>
<div>
<label for="catalogNumber" class="block text-sm font-medium text-gray-700 mb-2">Catalog Number</label>
<input type="text" id="catalogNumber" class="w-full border border-gray-300 rounded-lg p-2.5 focus:ring-ku-purple focus:border-ku-purple transition duration-150" placeholder="e.g., 398">
</div>
<div>
<label for="term" class="block text-sm font-medium text-gray-700 mb-2">Term</label>
<select id="term" class="w-full border border-gray-300 rounded-lg p-2.5 bg-white focus:ring-ku-purple focus:border-ku-purple">
<option value="">Select Term</option>
<option value="2025F">2025 Fall</option>
<option value="2025S">2025 Spring</option>
<option value="2024F">2024 Fall</option>
</select>
</div>
</div>
<div class="mt-6 flex justify-end">
<button id="classSearchBtn" class="bg-ku-purple-new hover:bg-ku-purple-new-hover text-white font-semibold py-2 px-8 rounded-xl shadow-md transition duration-150">
<svg class="w-5 h-5 inline mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path></svg>
Search
</button>
</div>
</div>
<!-- Results Card -->
<div class="bg-white rounded-xl shadow-lg p-8">
<h2 class="text-xl font-semibold text-gray-800 mb-6 border-b pb-4">Class Details & Availability</h2>
<!-- Class Details -->
<div class="mb-6 bg-gray-50 p-6 rounded-lg" id="classDetails">
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
<div>
<p class="text-sm text-gray-500">Course ID</p>
<p id="cdCourseId" class="text-base font-medium text-gray-900">—</p>
</div>
<div>
<p class="text-sm text-gray-500">Subject Area</p>
<p id="cdSubjectArea" class="text-base font-medium text-gray-900">—</p>
</div>
<div>
<p class="text-sm text-gray-500">Catalog Number</p>
<p id="cdCatalogNumber" class="text-base font-medium text-gray-900">—</p>
</div>
<div>
<p class="text-sm text-gray-500">Term</p>
<p id="cdTerm" class="text-base font-medium text-gray-900">—</p>
</div>
</div>
</div>
<!-- Student Availability Calendar -->
<div class="mb-2 flex items-center justify-between">
<h3 class="text-lg font-semibold text-gray-700">Student Availability</h3>
<div class="flex items-center gap-2">
<button type="button" id="saPrevWeekBtn" title="Previous week" aria-label="Previous week" class="px-3 py-1.5 rounded-lg border text-gray-700 hover:bg-gray-100">Prev</button>
<span id="saCalendarRangeLabel" class="text-sm font-medium text-gray-600">Week</span>
<button type="button" id="saNextWeekBtn" title="Next week" aria-label="Next week" class="px-3 py-1.5 rounded-lg border text-gray-700 hover:bg-gray-100">Next</button>
</div>
</div>
<div class="bg-gray-50 p-4 rounded-lg">
<div id="studentAvailabilityCalendar" class="space-y-2" aria-live="polite">
<div class="text-sm text-gray-500">Loading availability…</div>
</div>
<div class="mt-3 text-xs text-gray-500">Darker green = more students available (08:00–20:00)</div>
</div>
</div>
</main>
</div>
</div>
<!-- Footer -->
<footer class="w-full bg-slate-800 text-white text-xs p-3 flex justify-end items-center z-40 sticky bottom-0 flex-shrink-0">
<div class="flex items-center space-x-4">
<span>Copyright © 2025 Koç University Version 9.1.12</span>
<a href="#" class="hover:text-indigo-400">Privacy Policy</a>
<a href="#" class="hover:text-indigo-400">Cookie Policy</a>
</div>
</footer>
<script>
// Student Availability - Weekly Calendar Renderer
(function() {
const hourStart = 8; // 08:00
const hourEnd = 20; // 20:00
const totalMinutes = (hourEnd - hourStart) * 60;
const pxPerMinute = 1; // 1px per minute => 12h = 720px
const calendarHeight = totalMinutes * pxPerMinute;
function startOfWeek(date) {
const d = new Date(date);
const day = (d.getDay() + 6) % 7; // Monday=0
d.setHours(0,0,0,0);
d.setDate(d.getDate() - day);
return d;
}
function addDays(date, n) { const d = new Date(date); d.setDate(d.getDate() + n); return d; }
function sameDay(a, b) { return a.getFullYear()===b.getFullYear() && a.getMonth()===b.getMonth() && a.getDate()===b.getDate(); }
function minutesFromStart(date) { return (date.getHours() - hourStart) * 60 + date.getMinutes(); }
function clamp(v, min, max) { return Math.max(min, Math.min(max, v)); }
// Placeholder availability data (counts are number of available students)
let availabilitySlots = [];
function generateSampleData(weekStart) {
const base = [];
// create a variety of slots over the week
const samples = [
{ day: 0, start: '10:00', end: '11:30', count: 12 },
{ day: 0, start: '14:00', end: '15:30', count: 28 },
{ day: 1, start: '09:30', end: '10:45', count: 6 },
{ day: 1, start: '16:00', end: '18:00', count: 22 },
{ day: 2, start: '11:15', end: '13:00', count: 18 },
{ day: 2, start: '15:00', end: '17:00', count: 35 },
{ day: 3, start: '08:30', end: '10:00', count: 9 },
{ day: 3, start: '12:30', end: '14:00', count: 26 },
{ day: 4, start: '13:00', end: '14:30', count: 16 },
{ day: 5, start: '17:00', end: '19:00', count: 14 }
];
samples.forEach(s => {
const d = addDays(weekStart, s.day);
const [sh, sm] = s.start.split(':').map(Number);
const [eh, em] = s.end.split(':').map(Number);
const start = new Date(d.getFullYear(), d.getMonth(), d.getDate(), sh, sm, 0);
const end = new Date(d.getFullYear(), d.getMonth(), d.getDate(), eh, em, 0);
base.push({ start, end, count: s.count });
});
return base;
}
function colorForCount(count) {
if (count >= 30) return { box: 'bg-green-600 text-white', border: 'border-green-700' };
if (count >= 20) return { box: 'bg-green-500 text-white', border: 'border-green-600' };
if (count >= 12) return { box: 'bg-green-400 text-gray-900', border: 'border-green-500' };
if (count >= 6) return { box: 'bg-green-300 text-gray-900', border: 'border-green-400' };
return { box: 'bg-green-200 text-gray-900', border: 'border-green-300' };
}
let currentWeekStart = startOfWeek(new Date());
function renderCalendar() {
const container = document.getElementById('studentAvailabilityCalendar');
if (!container) return;
container.innerHTML = '';
// Header with day names
const header = document.createElement('div');
header.className = 'grid grid-cols-8 text-xs font-medium text-gray-600 mb-2';
header.style.gridTemplateColumns = '96px repeat(7, minmax(0, 1fr))';
const timeTitle = document.createElement('div');
timeTitle.className = 'text-left';
timeTitle.textContent = 'Time';
header.appendChild(timeTitle);
for (let i = 0; i < 7; i++) {
const d = addDays(currentWeekStart, i);
const cell = document.createElement('div');
cell.className = 'text-center';
cell.textContent = d.toLocaleDateString(undefined, { weekday: 'short', month: 'short', day: 'numeric' });
header.appendChild(cell);
}
container.appendChild(header);
// Body grid
const body = document.createElement('div');
body.className = 'grid grid-cols-8 gap-2';
body.style.gridTemplateColumns = '96px repeat(7, minmax(0, 1fr))';
// Time scale
const timeCol = document.createElement('div');
timeCol.className = 'relative bg-white border rounded';
timeCol.style.height = calendarHeight + 'px';
for (let h = hourStart; h <= hourEnd; h++) {
const top = (h - hourStart) * 60 * pxPerMinute;
const line = document.createElement('div');
line.className = 'absolute left-0 right-0 border-t border-gray-200';
line.style.top = top + 'px';
timeCol.appendChild(line);
const label = document.createElement('div');
label.className = 'absolute -translate-y-1/2 left-2 text-xs text-gray-600 bg-white/70 px-1';
label.style.top = top + 'px';
label.textContent = String(h).padStart(2, '0') + ':00';
timeCol.appendChild(label);
}
body.appendChild(timeCol);
// Day columns
for (let i = 0; i < 7; i++) {
const dayCol = document.createElement('div');
dayCol.className = 'relative bg-white border rounded overflow-hidden';
dayCol.style.height = calendarHeight + 'px';
for (let h = hourStart; h <= hourEnd; h++) {
const top = (h - hourStart) * 60 * pxPerMinute;
const line = document.createElement('div');
line.className = 'absolute left-0 right-0 border-t border-gray-200';
line.style.top = top + 'px';
dayCol.appendChild(line);
}
const dayDate = addDays(currentWeekStart, i);
const todays = availabilitySlots.filter(r => sameDay(r.start, dayDate));
todays.forEach(r => {
let startMin = minutesFromStart(r.start);
let endMin = minutesFromStart(r.end);
startMin = clamp(startMin, 0, totalMinutes);
endMin = clamp(endMin, 0, totalMinutes);
const top = startMin * pxPerMinute;
const height = Math.max(10, (endMin - startMin) * pxPerMinute);
const { box, border } = colorForCount(r.count);
const block = document.createElement('div');
block.className = `absolute left-1 right-1 rounded-md ${box} border ${border} text-xs px-2 py-1 shadow`;
block.style.top = top + 'px';
block.style.height = height + 'px';
block.textContent = `${r.count} students`;
dayCol.appendChild(block);
});
body.appendChild(dayCol);
}
container.appendChild(body);
// Update week label
const rangeLabel = document.getElementById('saCalendarRangeLabel');
const endOfWeek = addDays(currentWeekStart, 6);
rangeLabel.textContent = `${currentWeekStart.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })} - ${endOfWeek.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' })}`;
}
document.addEventListener('DOMContentLoaded', function() {
// Initialize with sample data
availabilitySlots = generateSampleData(currentWeekStart);
const prev = document.getElementById('saPrevWeekBtn');
const next = document.getElementById('saNextWeekBtn');
if (prev && next) {
prev.addEventListener('click', () => { currentWeekStart = addDays(currentWeekStart, -7); availabilitySlots = generateSampleData(currentWeekStart); renderCalendar(); });
next.addEventListener('click', () => { currentWeekStart = addDays(currentWeekStart, 7); availabilitySlots = generateSampleData(currentWeekStart); renderCalendar(); });
}
// Search button populates details and re-renders (simulated)
const btn = document.getElementById('classSearchBtn');
if (btn) {
btn.addEventListener('click', () => {
const cid = (document.getElementById('courseId').value || '003999').trim();
const sa = (document.getElementById('subjectArea').value || 'MATH').trim();
const cat = (document.getElementById('catalogNumber').value || '398').trim();
const termSel = document.getElementById('term');
const termVal = termSel && termSel.value ? termSel.options[termSel.selectedIndex].text : '2025 Fall';
document.getElementById('cdCourseId').textContent = cid;
document.getElementById('cdSubjectArea').textContent = sa;
document.getElementById('cdCatalogNumber').textContent = cat;
document.getElementById('cdTerm').textContent = termVal;
// regenerate sample data to simulate new query
availabilitySlots = generateSampleData(currentWeekStart);
renderCalendar();
});
}
renderCalendar();
});
})();
</script>
</body>
</html>