File size: 34,494 Bytes
f176ce8 0a183a5 f176ce8 0a183a5 411f088 0a183a5 f176ce8 0a183a5 411f088 0a183a5 411f088 0a183a5 411f088 0a183a5 411f088 0a183a5 | 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 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | <!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EduManage - Gestion des Établissements Scolaires</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 src="https://cdn.jsdelivr.net/npm/socket.io-client@4.7.2/dist/socket.io.min.js"></script>
<style>
.dashboard-grid {
display: grid;
grid-template-columns: 250px 1fr;
min-height: 100vh;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1rem;
}
.iframe-container {
position: relative;
overflow: hidden;
padding-top: 56.25%;
}
.iframe-container iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
@media (max-width: 768px) {
.dashboard-grid {
grid-template-columns: 1fr;
}
.sidebar {
display: none;
}
.mobile-menu-button {
display: block;
}
}
.sidebar {
transition: all 0.3s ease;
}
.sidebar-mobile {
transform: translateX(-100%);
}
.sidebar-visible {
transform: translateX(0);
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<!-- Mobile Menu Button -->
<div class="md:hidden bg-blue-800 p-4 flex justify-between items-center">
<h1 class="text-white font-bold text-xl">EduManage</h1>
<button id="mobileMenuButton" class="text-white focus:outline-none">
<i class="fas fa-bars text-2xl"></i>
</button>
</div>
<!-- Dashboard Layout -->
<div class="dashboard-grid">
<!-- Sidebar -->
<div id="sidebar" class="sidebar bg-blue-800 text-white sidebar-mobile md:sidebar-visible">
<div class="p-4 hidden md:block">
<h1 class="text-2xl font-bold">EduManage</h1>
<p class="text-blue-200 text-sm">Gestion scolaire intelligente</p>
</div>
<nav class="mt-6">
<div class="px-4 py-2 text-blue-200 uppercase text-xs font-semibold">Navigation</div>
<a href="#" class="block px-4 py-3 text-white bg-blue-700 hover:bg-blue-600 transition">
<i class="fas fa-home mr-2"></i> Tableau de bord
</a>
<a href="#" class="block px-4 py-3 text-white hover:bg-blue-600 transition">
<i class="fas fa-school mr-2"></i> Établissements
</a>
<a href="#" class="block px-4 py-3 text-white hover:bg-blue-600 transition">
<i class="fas fa-users mr-2"></i> Élèves
</a>
<a href="#" class="block px-4 py-3 text-white hover:bg-blue-600 transition">
<i class="fas fa-chalkboard-teacher mr-2"></i> Enseignants
</a>
<a href="#" class="block px-4 py-3 text-white hover:bg-blue-600 transition">
<i class="fas fa-calendar-alt mr-2"></i> Emploi du temps
</a>
<a href="#" class="block px-4 py-3 text-white hover:bg-blue-600 transition">
<i class="fas fa-graduation-cap mr-2"></i> Résultats
</a>
<div class="px-4 py-2 text-blue-200 uppercase text-xs font-semibold mt-4">Administration</div>
<a href="#" class="block px-4 py-3 text-white hover:bg-blue-600 transition">
<i class="fas fa-cog mr-2"></i> Paramètres
</a>
<a href="#" class="block px-4 py-3 text-white hover:bg-blue-600 transition">
<i class="fas fa-globe mr-2"></i> Site Officiel
</a>
</nav>
<div class="absolute bottom-0 left-0 right-0 p-4 bg-blue-900">
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/65.jpg" alt="Profile" class="w-10 h-10 rounded-full">
<div class="ml-3">
<p class="text-white font-medium">Admin User</p>
<p class="text-blue-300 text-xs">Administrateur</p>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="p-4 md:p-8">
<header class="mb-8">
<div class="flex justify-between items-start">
<div>
<h2 class="text-2xl font-bold text-gray-800">Tableau de bord</h2>
<p class="text-gray-600">Bienvenue dans le système de gestion des établissements scolaires</p>
</div>
<div class="flex items-center">
<div id="connectionStatus" class="flex items-center mr-4">
<span class="relative flex h-3 w-3 mr-2">
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-gray-400 opacity-75"></span>
<span class="relative inline-flex rounded-full h-3 w-3 bg-gray-500"></span>
</span>
<span class="text-sm text-gray-600">Connexion...</span>
</div>
<div id="notificationBell" class="relative cursor-pointer text-gray-500 hover:text-blue-600">
<i class="fas fa-bell text-xl"></i>
<span id="notificationCount" class="absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full h-5 w-5 flex items-center justify-center hidden">0</span>
</div>
</div>
</div>
</header>
<!-- Stats Cards -->
<div class="stats-grid mb-8">
<div class="bg-white p-4 rounded-lg shadow">
<div class="flex items-center">
<div class="p-3 rounded-full bg-blue-100 text-blue-600">
<i class="fas fa-school text-xl"></i>
</div>
<div class="ml-4">
<p class="text-gray-500">Établissements</p>
<h3 class="text-2xl font-bold">24</h3>
</div>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow">
<div class="flex items-center">
<div class="p-3 rounded-full bg-green-100 text-green-600">
<i class="fas fa-users text-xl"></i>
</div>
<div class="ml-4">
<p class="text-gray-500">Élèves</p>
<h3 class="text-2xl font-bold">1,245</h3>
</div>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow">
<div class="flex items-center">
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
<i class="fas fa-chalkboard-teacher text-xl"></i>
</div>
<div class="ml-4">
<p class="text-gray-500">Enseignants</p>
<h3 class="text-2xl font-bold">98</h3>
</div>
</div>
</div>
<div class="bg-white p-4 rounded-lg shadow">
<div class="flex items-center">
<div class="p-3 rounded-full bg-yellow-100 text-yellow-600">
<i class="fas fa-calendar-check text-xl"></i>
</div>
<div class="ml-4">
<p class="text-gray-500">Activités</p>
<h3 class="text-2xl font-bold">15</h3>
</div>
</div>
</div>
</div>
<!-- Main Content Grid -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-8">
<!-- Recent Activities -->
<div class="bg-white p-6 rounded-lg shadow lg:col-span-2">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">Activités récentes</h3>
<a href="#" class="text-blue-600 text-sm">Voir tout</a>
</div>
<div class="space-y-4">
<div class="flex items-start">
<div class="p-2 bg-blue-100 rounded-full text-blue-600 mr-3">
<i class="fas fa-user-plus"></i>
</div>
<div>
<p class="font-medium">Nouvel élève inscrit</p>
<p class="text-gray-500 text-sm">Jean Dupont a été inscrit en classe de 5ème</p>
<p class="text-gray-400 text-xs mt-1">Il y a 2 heures</p>
</div>
</div>
<div class="flex items-start">
<div class="p-2 bg-green-100 rounded-full text-green-600 mr-3">
<i class="fas fa-check-circle"></i>
</div>
<div>
<p class="font-medium">Résultats publiés</p>
<p class="text-gray-500 text-sm">Les résultats du 2ème trimestre ont été publiés</p>
<p class="text-gray-400 text-xs mt-1">Il y a 1 jour</p>
</div>
</div>
<div class="flex items-start">
<div class="p-2 bg-purple-100 rounded-full text-purple-600 mr-3">
<i class="fas fa-calendar-alt"></i>
</div>
<div>
<p class="font-medium">Nouvel événement</p>
<p class="text-gray-500 text-sm">Journée portes ouvertes prévue le 15 juin</p>
<p class="text-gray-400 text-xs mt-1">Il y a 2 jours</p>
</div>
</div>
</div>
</div>
<!-- Quick Actions -->
<div class="bg-white p-6 rounded-lg shadow">
<h3 class="text-lg font-semibold mb-4">Actions rapides</h3>
<div class="grid grid-cols-2 gap-3">
<a href="#" class="p-4 bg-blue-50 rounded-lg text-center hover:bg-blue-100 transition">
<i class="fas fa-user-plus text-blue-600 text-xl mb-2"></i>
<p class="text-sm font-medium">Ajouter élève</p>
</a>
<a href="#" class="p-4 bg-green-50 rounded-lg text-center hover:bg-green-100 transition">
<i class="fas fa-chalkboard-teacher text-green-600 text-xl mb-2"></i>
<p class="text-sm font-medium">Ajouter enseignant</p>
</a>
<a href="#" class="p-4 bg-purple-50 rounded-lg text-center hover:bg-purple-100 transition">
<i class="fas fa-file-alt text-purple-600 text-xl mb-2"></i>
<p class="text-sm font-medium">Générer rapport</p>
</a>
<a href="#" class="p-4 bg-yellow-50 rounded-lg text-center hover:bg-yellow-100 transition">
<i class="fas fa-bell text-yellow-600 text-xl mb-2"></i>
<p class="text-sm font-medium">Envoyer notification</p>
</a>
</div>
</div>
</div>
<!-- School Website Section -->
<div class="bg-white p-6 rounded-lg shadow mb-8">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">Site Officiel de l'Établissement</h3>
<div class="flex space-x-2">
<button class="px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700 transition">
<i class="fas fa-sync-alt mr-1"></i> Actualiser
</button>
<button class="px-3 py-1 bg-gray-200 text-gray-700 rounded hover:bg-gray-300 transition">
<i class="fas fa-expand mr-1"></i> Plein écran
</button>
</div>
</div>
<div class="iframe-container">
<iframe src="https://www.education.gouv.fr/" allowfullscreen></iframe>
</div>
<div class="mt-4 flex justify-between items-center">
<div class="text-sm text-gray-500">
<i class="fas fa-info-circle mr-1"></i> Site officiel du ministère de l'éducation
</div>
<div class="flex space-x-2">
<button class="text-blue-600 hover:text-blue-800">
<i class="fas fa-edit mr-1"></i> Modifier
</button>
<button class="text-blue-600 hover:text-blue-800">
<i class="fas fa-cog mr-1"></i> Paramètres
</button>
</div>
</div>
</div>
<!-- School List -->
<div class="bg-white p-6 rounded-lg shadow">
<div class="flex flex-col md:flex-row md:justify-between md:items-center mb-4 gap-4">
<h3 class="text-lg font-semibold">Établissements secondaires</h3>
<div class="flex flex-col sm:flex-row gap-3 w-full md:w-auto">
<div class="relative flex-grow">
<input type="text" id="schoolSearch" placeholder="Rechercher un établissement..." class="w-full pl-10 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
</div>
<select id="schoolTypeFilter" class="border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="all">Tous les types</option>
<option value="lycee">Lycée</option>
<option value="college">Collège</option>
<option value="lycee_pro">Lycée Professionnel</option>
</select>
<button id="addSchoolBtn" class="px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition whitespace-nowrap">
<i class="fas fa-plus mr-1"></i> Ajouter
</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 class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Localisation</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Élèves</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Statut</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 bg-blue-100 rounded-full flex items-center justify-center text-blue-600">
<i class="fas fa-school"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Lycée Victor Hugo</div>
<div class="text-sm text-gray-500">Code: LVH123</div>
</div>
</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-blue-100 text-blue-800">
Lycée
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Paris, 75016</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">856</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">
Actif
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-yellow-600 hover:text-yellow-900 mr-3"><i class="fas fa-edit"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 bg-green-100 rounded-full flex items-center justify-center text-green-600">
<i class="fas fa-school"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Collège Marie Curie</div>
<div class="text-sm text-gray-500">Code: CMC456</div>
</div>
</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">
Collège
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Lyon, 69002</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">623</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">
Actif
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-yellow-600 hover:text-yellow-900 mr-3"><i class="fas fa-edit"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 bg-purple-100 rounded-full flex items-center justify-center text-purple-600">
<i class="fas fa-school"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">École Primaire Jules Ferry</div>
<div class="text-sm text-gray-500">Code: EPJF789</div>
</div>
</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-purple-100 text-purple-800">
Primaire
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Marseille, 13001</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">312</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">
Maintenance
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a href="#" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></a>
<a href="#" class="text-yellow-600 hover:text-yellow-900 mr-3"><i class="fas fa-edit"></i></a>
<a href="#" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
// Connexion WebSocket
const socket = io('https://votre-serveur-socket.io', {
reconnectionAttempts: 5,
reconnectionDelay: 1000,
transports: ['websocket']
});
// Gestion de la connexion temps réel
socket.on('connect', () => {
updateConnectionStatus('connected', 'Connecté en temps réel');
});
socket.on('disconnect', () => {
updateConnectionStatus('disconnected', 'Déconnecté - Tentative de reconnexion...');
});
socket.on('connect_error', () => {
updateConnectionStatus('error', 'Erreur de connexion');
});
function updateConnectionStatus(status, message) {
const statusElement = document.getElementById('connectionStatus');
const dot = statusElement.querySelector('span:first-child span:last-child');
statusElement.querySelector('span:last-child').textContent = message;
dot.className = 'relative inline-flex rounded-full h-3 w-3 ' +
(status === 'connected' ? 'bg-green-500' :
status === 'disconnected' ? 'bg-yellow-500' : 'bg-red-500');
}
// Écoute des mises à jour des établissements
socket.on('schoolUpdate', (data) => {
showNotification(`Mise à jour: ${data.message}`, 'info');
refreshSchoolList();
});
// Mobile menu toggle
const mobileMenuButton = document.getElementById('mobileMenuButton');
const sidebar = document.getElementById('sidebar');
mobileMenuButton.addEventListener('click', () => {
sidebar.classList.toggle('sidebar-visible');
});
// Simulate loading data
document.addEventListener('DOMContentLoaded', () => {
// You could add AJAX calls here to load real data
console.log('Dashboard loaded');
});
// Gestion des établissements
async function refreshSchoolList() {
try {
const response = await fetch('/api/schools');
const schools = await response.json();
renderSchoolList(schools);
} catch (error) {
console.error('Erreur lors du chargement des établissements:', error);
showNotification('Erreur de chargement des établissements', 'error');
}
}
function renderSchoolList(schools) {
const tableBody = document.querySelector('tbody');
tableBody.innerHTML = schools.map(school => `
<tr data-school-id="${school.id}" data-type="${school.type}">
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<div class="flex-shrink-0 h-10 w-10 ${getSchoolColorClass(school.type)} rounded-full flex items-center justify-center">
<i class="fas fa-school"></i>
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">${school.name}</div>
<div class="text-sm text-gray-500">Code: ${school.code}</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getSchoolBadgeClass(school.type)}">
${getSchoolTypeLabel(school.type)}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${school.location}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${school.studentsCount}</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getStatusClass(school.status)}">
${school.status}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button onclick="viewSchool('${school.id}')" class="text-blue-600 hover:text-blue-900 mr-3"><i class="fas fa-eye"></i></button>
<button onclick="editSchool('${school.id}')" class="text-yellow-600 hover:text-yellow-900 mr-3"><i class="fas fa-edit"></i></button>
<button onclick="deleteSchool('${school.id}')" class="text-red-600 hover:text-red-900"><i class="fas fa-trash"></i></button>
</td>
</tr>
`).join('');
}
function getSchoolColorClass(type) {
return {
'lycee': 'bg-blue-100 text-blue-600',
'college': 'bg-green-100 text-green-600',
'lycee_pro': 'bg-purple-100 text-purple-600'
}[type] || 'bg-gray-100 text-gray-600';
}
function getSchoolBadgeClass(type) {
return {
'lycee': 'bg-blue-100 text-blue-800',
'college': 'bg-green-100 text-green-800',
'lycee_pro': 'bg-purple-100 text-purple-800'
}[type] || 'bg-gray-100 text-gray-800';
}
function getSchoolTypeLabel(type) {
return {
'lycee': 'Lycée',
'college': 'Collège',
'lycee_pro': 'Lycée Pro'
}[type] || type;
}
function getStatusClass(status) {
return {
'Actif': 'bg-green-100 text-green-800',
'Maintenance': 'bg-yellow-100 text-yellow-800',
'Inactif': 'bg-red-100 text-red-800'
}[status] || 'bg-gray-100 text-gray-800';
}
// Fonctions de gestion
function viewSchool(id) {
console.log('Voir établissement:', id);
// Implémentez la logique d'affichage
}
function editSchool(id) {
console.log('Modifier établissement:', id);
// Implémentez la logique d'édition
}
async function deleteSchool(id) {
if (confirm('Êtes-vous sûr de vouloir supprimer cet établissement ?')) {
try {
const response = await fetch(`/api/schools/${id}`, { method: 'DELETE' });
if (response.ok) {
showNotification('Établissement supprimé avec succès', 'success');
refreshSchoolList();
}
} catch (error) {
console.error('Erreur lors de la suppression:', error);
showNotification('Erreur lors de la suppression', 'error');
}
}
}
// Initialisation
document.addEventListener('DOMContentLoaded', () => {
refreshSchoolList();
// Filtre de recherche
document.getElementById('schoolSearch').addEventListener('input', (e) => {
const searchTerm = e.target.value.toLowerCase();
document.querySelectorAll('tbody tr').forEach(row => {
const schoolName = row.querySelector('td:first-child div:first-child div:first-child').textContent.toLowerCase();
row.style.display = schoolName.includes(searchTerm) ? '' : 'none';
});
});
// Filtre par type
document.getElementById('schoolTypeFilter').addEventListener('change', (e) => {
const type = e.target.value;
document.querySelectorAll('tbody tr').forEach(row => {
if (type === 'all') {
row.style.display = '';
} else {
row.style.display = row.dataset.type === type ? '' : 'none';
}
});
});
});
// Sample function to show a notification
function showNotification(message, type = 'info') {
const colors = {
info: 'blue',
success: 'green',
warning: 'yellow',
error: 'red'
};
const notification = document.createElement('div');
notification.className = `fixed bottom-4 right-4 p-4 rounded-lg shadow-lg bg-${colors[type]}-100 border-l-4 border-${colors[type]}-500 text-${colors[type]}-700`;
notification.innerHTML = `
<div class="flex items-center">
<i class="fas fa-info-circle mr-2"></i>
<span>${message}</span>
</div>
`;
document.body.appendChild(notification);
setTimeout(() => {
notification.remove();
}, 3000);
}
// Example usage:
// showNotification('Bienvenue dans EduManage!', 'success');
</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=Decodeur/https-cdn-tailwindcss-com" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |