File size: 32,668 Bytes
42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a 81efbcd 42c349a | 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 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 | <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gestion des Espaces - Établissement</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>
.room-card {
transition: all 0.3s ease;
}
.room-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.occupied {
background-color: #fee2e2;
border-left: 4px solid #ef4444;
}
.available {
background-color: #dcfce7;
border-left: 4px solid #22c55e;
}
.special-event {
background-color: #e0e7ff;
border-left: 4px solid #6366f1;
}
.time-slot {
transition: all 0.2s ease;
}
.time-slot:hover {
transform: scale(1.03);
}
.tab-active {
border-bottom: 3px solid #4f46e5;
font-weight: 600;
color: #4f46e5;
}
.uape-slot {
background-color: #fef3c7;
border-left: 4px solid #f59e0b;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-8">
<header class="mb-10 text-center">
<h1 class="text-4xl font-bold text-indigo-700 mb-2">Gestion des Espaces</h1>
<p class="text-lg text-gray-600">Visualisez et gérez l'occupation de vos salles en temps réel</p>
<div class="mt-6">
<div class="inline-flex rounded-md shadow-sm" role="group">
<button onclick="showDay('lundi')" class="day-tab px-4 py-2 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 rounded-l-lg">Lundi</button>
<button onclick="showDay('mardi')" class="day-tab px-4 py-2 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Mardi</button>
<button onclick="showDay('mercredi')" class="day-tab px-4 py-2 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Mercredi</button>
<button onclick="showDay('jeudi')" class="day-tab px-4 py-2 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50">Jeudi</button>
<button onclick="showDay('vendredi')" class="day-tab px-4 py-2 text-sm font-medium text-gray-700 bg-white hover:bg-gray-50 rounded-r-lg">Vendredi</button>
</div>
</div>
</header>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" id="rooms-container">
<!-- Les salles seront générées dynamiquement -->
</div>
</div>
<!-- Modal de réservation -->
<div id="reservation-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md">
<div class="p-6">
<h3 class="text-xl font-semibold text-gray-800 mb-4">Nouvelle Réservation</h3>
<form id="reservation-form">
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="room">
Espace
</label>
<select id="room" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required>
<option value="">Sélectionnez un espace</option>
<option value="salle1">Salle de Classe 1</option>
<option value="salle2">Salle de Classe 2</option>
<option value="salle3">Salle de Classe 3</option>
<option value="cafeteria">Cafétéria</option>
<option value="bibliotheque">Bibliothèque</option>
</select>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="day">
Jour
</label>
<select id="day" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required>
<option value="">Sélectionnez un jour</option>
<option value="lundi">Lundi</option>
<option value="mardi">Mardi</option>
<option value="mercredi">Mercredi</option>
<option value="jeudi">Jeudi</option>
<option value="vendredi">Vendredi</option>
</select>
</div>
<div class="grid grid-cols-2 gap-4 mb-4">
<div>
<label class="block text-gray-700 text-sm font-bold mb-2" for="start-time">
Heure de début
</label>
<input type="time" id="start-time" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required>
</div>
<div>
<label class="block text-gray-700 text-sm font-bold mb-2" for="end-time">
Heure de fin
</label>
<input type="time" id="end-time" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" required>
</div>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="event">
Événement/Activité
</label>
<input type="text" id="event" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" placeholder="Description de l'activité" required>
</div>
<div class="mb-4">
<label class="block text-gray-700 text-sm font-bold mb-2" for="niveau">
Niveau (pour cours)
</label>
<select id="niveau" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
<option value="">Non applicable</option>
<option value="alpha">Alpha</option>
<option value="a1">A1</option>
<option value="a2">A2</option>
<option value="b1">B1</option>
</select>
</div>
<div class="flex justify-end space-x-3">
<button type="button" onclick="closeModal()" class="px-4 py-2 bg-gray-300 text-gray-700 rounded hover:bg-gray-400">Annuler</button>
<button type="submit" class="px-4 py-2 bg-indigo-600 text-white rounded hover:bg-indigo-700">Confirmer</button>
</div>
</form>
</div>
</div>
</div>
<script>
// Données initiales
const roomsData = {
salle1: {
name: "Salle de Classe 1",
color: "indigo",
icon: "fa-chalkboard-teacher",
schedule: {
lundi: [
{ time: "9:00 - 10:30", event: "Cours de Mathématiques", type: "occupied", niveau: "alpha" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Physique", type: "occupied", niveau: "a1" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "b1" }
],
mardi: [
{ time: "9:00 - 10:30", event: "Cours de Chimie", type: "occupied", niveau: "a2" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Biologie", type: "occupied", niveau: "alpha" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "a1" }
],
mercredi: [
{ time: "9:00 - 10:30", event: "Cours de Français", type: "occupied", niveau: "b1" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Pas de cours (Mercredi après-midi)", type: "available" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "a2" }
],
jeudi: [
{ time: "9:00 - 10:30", event: "Cours d'Histoire", type: "occupied", niveau: "alpha" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Géographie", type: "occupied", niveau: "b1" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "a1" }
],
vendredi: [
{ time: "8:00 - 10:30", event: "Disponible", type: "available" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Disponible", type: "available" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Disponible", type: "available" }
]
}
},
salle2: {
name: "Salle de Classe 2",
color: "indigo",
icon: "fa-chalkboard-teacher",
schedule: {
lundi: [
{ time: "9:00 - 10:30", event: "Cours d'Anglais", type: "occupied", niveau: "a1" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours d'Espagnol", type: "occupied", niveau: "a2" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "b1" }
],
mardi: [
{ time: "9:00 - 10:30", event: "Cours d'Informatique", type: "occupied", niveau: "alpha" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Programmation", type: "occupied", niveau: "a1" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "a2" }
],
mercredi: [
{ time: "9:00 - 10:30", event: "Cours de Philosophie", type: "occupied", niveau: "b1" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Pas de cours (Mercredi après-midi)", type: "available" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "alpha" }
],
jeudi: [
{ time: "9:00 - 10:30", event: "Cours d'Arts", type: "occupied", niveau: "a1" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Musique", type: "occupied", niveau: "a2" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "b1" }
],
vendredi: [
{ time: "8:00 - 10:30", event: "Disponible", type: "available" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Disponible", type: "available" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Disponible", type: "available" }
]
}
},
salle3: {
name: "Salle de Classe 3",
color: "indigo",
icon: "fa-chalkboard-teacher",
schedule: {
lundi: [
{ time: "9:00 - 10:30", event: "Cours d'Economie", type: "occupied", niveau: "a2" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Droit", type: "occupied", niveau: "b1" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "alpha" }
],
mardi: [
{ time: "9:00 - 10:30", event: "Cours de Marketing", type: "occupied", niveau: "a1" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Gestion", type: "occupied", niveau: "a2" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "b1" }
],
mercredi: [
{ time: "9:00 - 10:30", event: "Cours de Communication", type: "occupied", niveau: "alpha" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Pas de cours (Mercredi après-midi)", type: "available" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "a1" }
],
jeudi: [
{ time: "9:00 - 10:30", event: "Cours de Psychologie", type: "occupied", niveau: "a2" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Cours de Sociologie", type: "occupied", niveau: "b1" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Cours du soir", type: "occupied", niveau: "alpha" }
],
vendredi: [
{ time: "8:00 - 10:30", event: "Disponible", type: "available" },
{ time: "10:30 - 14:00", event: "Disponible", type: "available" },
{ time: "14:00 - 15:30", event: "Disponible", type: "available" },
{ time: "15:30 - 18:30", event: "Disponible", type: "available" },
{ time: "18:30 - 21:00", event: "Disponible", type: "available" }
]
}
},
cafeteria: {
name: "Cafétéria",
color: "amber",
icon: "fa-utensils",
schedule: {
lundi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Service déjeuner (UAPE)", type: "uape-slot" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Service dîner", type: "available" }
],
mardi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Service déjeuner (UAPE)", type: "uape-slot" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Service dîner", type: "available" }
],
mercredi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Service déjeuner", type: "available" },
{ time: "15:00 - 17:00", event: "Mercredi-famille", type: "special-event" },
{ time: "17:00 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Service dîner", type: "available" }
],
jeudi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Service déjeuner (UAPE)", type: "uape-slot" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Service dîner", type: "available" }
],
vendredi: [
{ time: "8:00 - 10:30", event: "Blabla café", type: "special-event" },
{ time: "10:30 - 14:00", event: "Service déjeuner (UAPE)", type: "uape-slot" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Fermée", type: "available" }
]
}
},
bibliotheque: {
name: "Bibliothèque",
color: "emerald",
icon: "fa-book",
schedule: {
lundi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Ouverte", type: "available" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Ouverte", type: "available" }
],
mardi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Ouverte", type: "available" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Ouverte", type: "available" }
],
mercredi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Ouverte", type: "available" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Ouverte", type: "available" }
],
jeudi: [
{ time: "9:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Ouverte", type: "available" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Ouverte", type: "available" }
],
vendredi: [
{ time: "8:00 - 10:30", event: "Ouverte", type: "available" },
{ time: "10:30 - 14:00", event: "Ouverte", type: "available" },
{ time: "14:00 - 15:30", event: "Ouverte", type: "available" },
{ time: "15:30 - 18:30", event: "Ouverte", type: "available" },
{ time: "18:30 - 21:00", event: "Fermée", type: "available" }
]
}
}
};
// Générer les cartes de salle
function generateRoomCards() {
const container = document.getElementById('rooms-container');
container.innerHTML = '';
for (const roomId in roomsData) {
const room = roomsData[roomId];
let cardHTML = `
<div class="room-card bg-white rounded-lg shadow-md overflow-hidden">
<div class="bg-${room.color}-600 p-4 text-white">
<h2 class="text-xl font-semibold flex items-center">
<i class="fas ${room.icon} mr-2"></i> ${room.name}
</h2>
</div>
<div class="p-4">
`;
for (const day in room.schedule) {
const isActive = day === 'lundi' ? '' : 'hidden';
cardHTML += `<div id="${day}-${roomId}" class="day-schedule ${isActive}">`;
cardHTML += `<h3 class="font-medium text-gray-700 mb-2">${day.charAt(0).toUpperCase() + day.slice(1)}</h3>`;
room.schedule[day].forEach(slot => {
let niveauText = slot.niveau ? ` (${slot.niveau.toUpperCase()})` : '';
cardHTML += `
<div class="time-slot ${slot.type} mb-2 p-2 rounded">
<span class="font-medium">${slot.time}</span>: ${slot.event}${niveauText}
</div>
`;
});
cardHTML += `</div>`;
}
cardHTML += `
</div>
<div class="px-4 py-3 bg-gray-50 text-right">
<button onclick="openModal('${roomId}')" class="text-${room.color}-600 hover:text-${room.color}-800 font-medium">Réserver</button>
</div>
</div>
`;
container.innerHTML += cardHTML;
}
// Ajouter le résumé hebdomadaire
container.innerHTML += `
<div class="room-card bg-white rounded-lg shadow-md overflow-hidden col-span-1 md:col-span-2 lg:col-span-1">
<div class="bg-purple-600 p-4 text-white">
<h2 class="text-xl font-semibold flex items-center">
<i class="fas fa-calendar-alt mr-2"></i> Résumé Hebdomadaire
</h2>
</div>
<div class="p-4">
<div class="mb-4">
<h3 class="font-medium text-gray-700 mb-2">Événements Spéciaux</h3>
<ul class="space-y-2">
<li class="flex items-start">
<span class="inline-block bg-indigo-100 text-indigo-800 text-xs px-2 py-1 rounded-full mr-2">Mercredi</span>
<span>15:00 - 17:00: Mercredi-famille à la cafétéria</span>
</li>
<li class="flex items-start">
<span class="inline-block bg-indigo-100 text-indigo-800 text-xs px-2 py-1 rounded-full mr-2">Vendredi</span>
<span>8:00 - 10:30: Blabla café à la cafétéria</span>
</li>
</ul>
</div>
<div>
<h3 class="font-medium text-gray-700 mb-2">Disponibilités Générales</h3>
<ul class="space-y-2">
<li class="flex items-center">
<i class="fas fa-check-circle text-green-500 mr-2"></i>
<span>Bibliothèque ouverte tous les jours sauf vendredi soir</span>
</li>
<li class="flex items-center">
<i class="fas fa-check-circle text-green-500 mr-2"></i>
<span>Cafétéria ouverte tous les jours sauf vendredi soir</span>
</li>
<li class="flex items-center">
<i class="fas fa-info-circle text-blue-500 mr-2"></i>
<span>Pas de cours le mercredi après-midi</span>
</li>
<li class="flex items-center">
<i class="fas fa-utensils text-amber-500 mr-2"></i>
<span>UAPE utilise la cafétéria pour les repas (Lun, Mar, Jeu, Ven)</span>
</li>
</ul>
</div>
</div>
<div class="px-4 py-3 bg-gray-50 text-right">
<button onclick="exportPlanning()" class="text-purple-600 hover:text-purple-800 font-medium">Exporter le planning</button>
</div>
</div>
`;
}
// Afficher le jour sélectionné
function showDay(day) {
// Mettre à jour les onglets
document.querySelectorAll('.day-tab').forEach(tab => {
tab.classList.remove('bg-indigo-100', 'text-indigo-700');
});
event.target.classList.add('bg-indigo-100', 'text-indigo-700');
// Afficher le planning correspondant au jour sélectionné pour chaque salle
document.querySelectorAll('.day-schedule').forEach(schedule => {
schedule.classList.add('hidden');
});
// Afficher les plannings du jour sélectionné
for (const roomId in roomsData) {
document.getElementById(`${day}-${roomId}`).classList.remove('hidden');
}
}
// Gestion de la modal de réservation
let currentRoomId = null;
function openModal(roomId) {
currentRoomId = roomId;
document.getElementById('reservation-modal').classList.remove('hidden');
document.getElementById('room').value = roomId;
}
function closeModal() {
document.getElementById('reservation-modal').classList.add('hidden');
document.getElementById('reservation-form').reset();
currentRoomId = null;
}
function submitReservation(event) {
event.preventDefault();
const roomId = document.getElementById('room').value;
const day = document.getElementById('day').value;
const startTime = document.getElementById('start-time').value;
const endTime = document.getElementById('end-time').value;
const eventName = document.getElementById('event').value;
const niveau = document.getElementById('niveau').value;
// Formatage de l'heure pour l'affichage
const formattedStart = formatTime(startTime);
const formattedEnd = formatTime(endTime);
const timeSlot = `${formattedStart} - ${formattedEnd}`;
// Création du nouveau créneau
const newSlot = {
time: timeSlot,
event: eventName,
type: "occupied"
};
if (niveau) {
newSlot.niveau = niveau;
}
// Ajout du créneau dans les données
roomsData[roomId].schedule[day].push(newSlot);
// Tri des créneaux par heure de début
roomsData[roomId].schedule[day].sort((a, b) => {
return a.time.split(' - ')[0].localeCompare(b.time.split(' - ')[0]);
});
// Regénération des cartes
generateRoomCards();
// Réafficher le jour actuel
showDay(day);
alert('Réservation confirmée!');
closeModal();
}
function formatTime(timeString) {
const [hours, minutes] = timeString.split(':');
return `${hours}:${minutes}`;
}
function exportPlanning() {
alert('Export du planning en cours... (fonctionnalité à implémenter)');
}
// Initialisation
document.addEventListener('DOMContentLoaded', function() {
generateRoomCards();
// Activer l'onglet du lundi par défaut
document.querySelector('.day-tab').click();
// Gestion du formulaire
document.getElementById('reservation-form').addEventListener('submit', submitReservation);
});
</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=masterseb/mdm" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p><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=Masterseb/mdm" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |