File size: 44,058 Bytes
65428bf | 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 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Computron LMS</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>
.sidebar {
transition: all 0.3s ease;
}
.sidebar.collapsed {
width: 70px;
}
.sidebar.collapsed .sidebar-text {
display: none;
}
.sidebar.collapsed .logo-text {
display: none;
}
.sidebar.collapsed .expand-icon {
transform: rotate(180deg);
}
.main-content {
transition: all 0.3s ease;
}
.sidebar.collapsed + .main-content {
margin-left: 70px;
}
.course-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
.progress-ring {
transform: rotate(-90deg);
}
.progress-ring-circle {
transition: stroke-dashoffset 0.5s ease;
}
.tab-content {
display: none;
}
.tab-content.active {
display: block;
animation: fadeIn 0.5s ease;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.dropdown-content {
display: none;
position: absolute;
right: 0;
min-width: 200px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
.mobile-menu {
display: none;
}
@media (max-width: 768px) {
.sidebar {
position: fixed;
z-index: 50;
left: -100%;
}
.sidebar.active {
left: 0;
}
.main-content {
margin-left: 0 !important;
}
.mobile-menu {
display: block;
}
}
</style>
</head>
<body class="bg-gray-50">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-indigo-800 text-white w-64 flex-shrink-0 flex flex-col h-full">
<div class="p-4 flex items-center justify-between border-b border-indigo-700">
<div class="flex items-center">
<i class="fas fa-laptop-code text-2xl mr-3"></i>
<span class="logo-text font-bold text-xl">Computron LMS</span>
</div>
<button id="toggleSidebar" class="text-white focus:outline-none">
<i class="fas fa-chevron-left expand-icon"></i>
</button>
</div>
<div class="p-4 border-b border-indigo-700 flex items-center">
<div class="relative">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="User" class="w-10 h-10 rounded-full border-2 border-white">
<span class="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white"></span>
</div>
<div class="ml-3 sidebar-text">
<div class="font-medium">John Doe</div>
<div class="text-xs text-indigo-200">Admin</div>
</div>
</div>
<nav class="flex-1 overflow-y-auto">
<div class="p-2">
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-tachometer-alt mr-3"></i>
<span class="sidebar-text">Dashboard</span>
</a>
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-book mr-3"></i>
<span class="sidebar-text">Courses</span>
</a>
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-users mr-3"></i>
<span class="sidebar-text">Students</span>
</a>
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-chalkboard-teacher mr-3"></i>
<span class="sidebar-text">Instructors</span>
</a>
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-calendar-alt mr-3"></i>
<span class="sidebar-text">Batches</span>
</a>
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-video mr-3"></i>
<span class="sidebar-text">Sessions</span>
</a>
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-file-invoice-dollar mr-3"></i>
<span class="sidebar-text">Payments</span>
</a>
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-cog mr-3"></i>
<span class="sidebar-text">Settings</span>
</a>
</div>
</nav>
<div class="p-4 border-t border-indigo-700">
<a href="#" class="flex items-center p-2 rounded hover:bg-indigo-700 text-white">
<i class="fas fa-sign-out-alt mr-3"></i>
<span class="sidebar-text">Logout</span>
</a>
</div>
</div>
<!-- Main Content -->
<div class="main-content flex-1 flex flex-col overflow-hidden">
<!-- Top Navigation -->
<header class="bg-white shadow-sm">
<div class="px-4 py-3 flex items-center justify-between">
<div class="flex items-center">
<button id="mobileMenuToggle" class="mobile-menu mr-4 text-gray-600 focus:outline-none">
<i class="fas fa-bars text-xl"></i>
</button>
<h1 class="text-xl font-semibold text-gray-800">Dashboard</h1>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<button class="text-gray-600 focus:outline-none">
<i class="fas fa-bell text-xl"></i>
<span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span>
</button>
</div>
<div class="dropdown relative">
<button class="flex items-center focus:outline-none">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="User" class="w-8 h-8 rounded-full">
<span class="ml-2 hidden md:inline">John Doe</span>
<i class="fas fa-chevron-down ml-1 text-xs hidden md:inline"></i>
</button>
<div class="dropdown-content mt-2 bg-white rounded shadow-lg py-2">
<a href="#" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">Profile</a>
<a href="#" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">Settings</a>
<a href="#" class="block px-4 py-2 text-gray-800 hover:bg-gray-100">Logout</a>
</div>
</div>
</div>
</div>
</header>
<!-- Main Content Area -->
<main class="flex-1 overflow-y-auto p-4 md:p-6 relative">
<!-- Loader -->
<div id="loader" class="hidden absolute inset-0 bg-white bg-opacity-75 flex items-center justify-center z-50">
<div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-indigo-500"></div>
</div>
<!-- Error Container -->
<div id="error-container" class="hidden fixed top-4 right-4 bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded z-50"></div>
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 mb-6">
<div class="bg-white rounded-lg shadow p-4">
<div class="flex items-center">
<div class="p-3 rounded-full bg-indigo-100 text-indigo-600">
<i class="fas fa-users text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Total Students</p>
<p class="text-2xl font-semibold text-gray-800" data-stat="students">0</p>
</div>
</div>
<div class="mt-4">
<span class="text-green-500 text-sm font-medium">+12.5%</span>
<span class="text-gray-500 text-sm ml-2">from last month</span>
</div>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex items-center">
<div class="p-3 rounded-full bg-blue-100 text-blue-600">
<i class="fas fa-chalkboard-teacher text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Active Instructors</p>
<p class="text-2xl font-semibold text-gray-800" data-stat="instructors">0</p>
</div>
</div>
<div class="mt-4">
<span class="text-green-500 text-sm font-medium">+3.2%</span>
<span class="text-gray-500 text-sm ml-2">from last month</span>
</div>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex items-center">
<div class="p-3 rounded-full bg-green-100 text-green-600">
<i class="fas fa-book text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Courses</p>
<p class="text-2xl font-semibold text-gray-800" data-stat="courses">0</p>
</div>
</div>
<div class="mt-4">
<span class="text-green-500 text-sm font-medium">+5.7%</span>
<span class="text-gray-500 text-sm ml-2">from last month</span>
</div>
</div>
<div class="bg-white rounded-lg shadow p-4">
<div class="flex items-center">
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
<i class="fas fa-dollar-sign text-xl"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Revenue</p>
<p class="text-2xl font-semibold text-gray-800" data-stat="revenue">$0</p>
</div>
</div>
<div class="mt-4">
<span class="text-green-500 text-sm font-medium">+8.1%</span>
<span class="text-gray-500 text-sm ml-2">from last month</span>
</div>
</div>
</div>
<!-- Recent Activity and Progress -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<div class="lg:col-span-2 bg-white rounded-lg shadow p-6">
<div class="flex justify-between items-center mb-4">
<h2 class="text-lg font-semibold text-gray-800">Recent Activity</h2>
<a href="#" class="text-sm text-indigo-600 hover:text-indigo-800">View All</a>
</div>
<div class="space-y-4">
<div class="flex items-start">
<div class="p-2 rounded-full bg-indigo-100 text-indigo-600">
<i class="fas fa-user-plus"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">New student registered</p>
<p class="text-xs text-gray-500">Sarah Johnson enrolled in "Advanced JavaScript"</p>
<p class="text-xs text-gray-400 mt-1">10 minutes ago</p>
</div>
</div>
<div class="flex items-start">
<div class="p-2 rounded-full bg-blue-100 text-blue-600">
<i class="fas fa-video"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">New session uploaded</p>
<p class="text-xs text-gray-500">Prof. Smith uploaded "React Hooks Deep Dive" for Batch #42</p>
<p class="text-xs text-gray-400 mt-1">2 hours ago</p>
</div>
</div>
<div class="flex items-start">
<div class="p-2 rounded-full bg-green-100 text-green-600">
<i class="fas fa-check-circle"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">Payment received</p>
<p class="text-xs text-gray-500">Michael Brown completed payment for "Full Stack Development"</p>
<p class="text-xs text-gray-400 mt-1">5 hours ago</p>
</div>
</div>
<div class="flex items-start">
<div class="p-2 rounded-full bg-purple-100 text-purple-600">
<i class="fas fa-comment"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">New feedback received</p>
<p class="text-xs text-gray-500">Lisa Wong rated "Python for Beginners" 5 stars</p>
<p class="text-xs text-gray-400 mt-1">1 day ago</p>
</div>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<h2 class="text-lg font-semibold text-gray-800 mb-4">Course Completion</h2>
<div class="flex justify-center mb-6">
<div class="relative w-32 h-32">
<svg class="progress-ring w-full h-full" viewBox="0 0 100 100">
<circle class="progress-ring-circle stroke-indigo-100" stroke-width="8" fill="transparent" r="40" cx="50" cy="50"></circle>
<circle class="progress-ring-circle stroke-indigo-600" stroke-width="8" stroke-dasharray="251.2" stroke-dashoffset="75.36" stroke-linecap="round" fill="transparent" r="40" cx="50" cy="50"></circle>
</svg>
<div class="absolute inset-0 flex items-center justify-center">
<span class="text-2xl font-bold text-indigo-600">70%</span>
</div>
</div>
</div>
<div class="space-y-3">
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Web Development</span>
<span class="text-sm text-gray-500">85%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-600 h-2 rounded-full" style="width: 85%"></div>
</div>
</div>
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Data Science</span>
<span class="text-sm text-gray-500">65%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-600 h-2 rounded-full" style="width: 65%"></div>
</div>
</div>
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">DevOps</span>
<span class="text-sm text-gray-500">45%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-purple-600 h-2 rounded-full" style="width: 45%"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Courses Section -->
<div class="bg-white rounded-lg shadow p-6 mb-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-lg font-semibold text-gray-800">Popular Courses</h2>
<div class="flex space-x-1">
<button class="px-3 py-1 text-sm rounded-md bg-indigo-600 text-white">All</button>
<button class="px-3 py-1 text-sm rounded-md bg-gray-200 text-gray-700 hover:bg-gray-300">Individual</button>
<button class="px-3 py-1 text-sm rounded-md bg-gray-200 text-gray-700 hover:bg-gray-300">Bundles</button>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div class="course-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="relative">
<img src="https://images.unsplash.com/photo-1555066931-4365d14bab8c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Course" class="w-full h-40 object-cover">
<div class="absolute top-2 right-2 bg-indigo-600 text-white text-xs px-2 py-1 rounded">NEW</div>
</div>
<div class="p-4">
<div class="flex justify-between items-start">
<div>
<h3 class="font-semibold text-gray-800 mb-1">Full Stack Development</h3>
<p class="text-sm text-gray-600">Learn MERN stack from scratch</p>
</div>
<span class="bg-indigo-100 text-indigo-800 text-xs px-2 py-1 rounded">Bundle</span>
</div>
<div class="mt-4 flex justify-between items-center">
<div class="flex items-center">
<i class="fas fa-star text-yellow-400 mr-1"></i>
<span class="text-sm text-gray-700">4.8</span>
<span class="text-sm text-gray-500 mx-1">•</span>
<span class="text-sm text-gray-500">256 students</span>
</div>
<span class="font-semibold text-gray-800">$199</span>
</div>
</div>
</div>
<div class="course-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="relative">
<img src="https://images.unsplash.com/photo-1547658719-da2b51169166?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1528&q=80" alt="Course" class="w-full h-40 object-cover">
</div>
<div class="p-4">
<div class="flex justify-between items-start">
<div>
<h3 class="font-semibold text-gray-800 mb-1">Advanced JavaScript</h3>
<p class="text-sm text-gray-600">Master modern JavaScript concepts</p>
</div>
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Individual</span>
</div>
<div class="mt-4 flex justify-between items-center">
<div class="flex items-center">
<i class="fas fa-star text-yellow-400 mr-1"></i>
<span class="text-sm text-gray-700">4.9</span>
<span class="text-sm text-gray-500 mx-1">•</span>
<span class="text-sm text-gray-500">189 students</span>
</div>
<span class="font-semibold text-gray-800">$89</span>
</div>
</div>
</div>
<div class="course-card bg-white border border-gray-200 rounded-lg overflow-hidden transition duration-300">
<div class="relative">
<img src="https://images.unsplash.com/photo-1551288049-bebda4e38f71?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80" alt="Course" class="w-full h-40 object-cover">
<div class="absolute top-2 right-2 bg-green-600 text-white text-xs px-2 py-1 rounded">BESTSELLER</div>
</div>
<div class="p-4">
<div class="flex justify-between items-start">
<div>
<h3 class="font-semibold text-gray-800 mb-1">Python for Data Science</h3>
<p class="text-sm text-gray-600">Data analysis with Pandas & NumPy</p>
</div>
<span class="bg-blue-100 text-blue-800 text-xs px-2 py-1 rounded">Individual</span>
</div>
<div class="mt-4 flex justify-between items-center">
<div class="flex items-center">
<i class="fas fa-star text-yellow-400 mr-1"></i>
<span class="text-sm text-gray-700">4.7</span>
<span class="text-sm text-gray-500 mx-1">•</span>
<span class="text-sm text-gray-500">312 students</span>
</div>
<span class="font-semibold text-gray-800">$129</span>
</div>
</div>
</div>
</div>
<div class="mt-6 text-center">
<button class="px-4 py-2 border border-indigo-600 text-indigo-600 rounded-md hover:bg-indigo-50 transition duration-300">
View All Courses
</button>
</div>
</div>
<!-- Upcoming Batches -->
<div class="bg-white rounded-lg shadow p-6">
<div class="flex justify-between items-center mb-6">
<h2 class="text-lg font-semibold text-gray-800">Upcoming Batches</h2>
<a href="#" class="text-sm text-indigo-600 hover:text-indigo-800">View All</a>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Batch</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Course</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Instructor</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Start Date</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Students</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="font-medium text-gray-900">Batch #42</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">Full Stack Development</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/men/41.jpg" alt="Instructor" class="w-8 h-8 rounded-full mr-2">
<span>Prof. Smith</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-500">15 Jun 2023</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">24/30</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800">Upcoming</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-indigo-600 hover:text-indigo-900">Manage</button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="font-medium text-gray-900">Batch #43</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">Advanced JavaScript</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/women/44.jpg" alt="Instructor" class="w-8 h-8 rounded-full mr-2">
<span>Dr. Johnson</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-500">20 Jun 2023</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">18/25</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800">Upcoming</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-indigo-600 hover:text-indigo-900">Manage</button>
</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap">
<div class="font-medium text-gray-900">Batch #44</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">Python for Data Science</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex items-center">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="Instructor" class="w-8 h-8 rounded-full mr-2">
<span>Prof. Williams</span>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-500">25 Jun 2023</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="text-sm text-gray-900">15/20</div>
</td>
<td class="px-6 py-4 whitespace-nowrap">
<span class="px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800">Upcoming</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
<button class="text-indigo-600 hover:text-indigo-900">Manage</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
</div>
</div>
<script>
// Enhanced API Service with error handling
const apiService = {
async request(method, url, data = null) {
const config = {
method,
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${localStorage.getItem('token')}`
}
};
if (data) {
config.body = JSON.stringify(data);
}
const response = await fetch(`/api${url}`, config);
if (!response.ok) {
const error = await response.json();
throw new Error(error.message || 'Request failed');
}
return await response.json();
},
get(url) {
return this.request('GET', url);
},
post(url, data) {
return this.request('POST', url, data);
},
put(url, data) {
return this.request('PUT', url, data);
},
delete(url) {
return this.request('DELETE', url);
}
};
// Toggle sidebar
const toggleSidebar = document.getElementById('toggleSidebar');
const sidebar = document.querySelector('.sidebar');
const mainContent = document.querySelector('.main-content');
toggleSidebar.addEventListener('click', () => {
sidebar.classList.toggle('collapsed');
});
// Mobile menu toggle
const mobileMenuToggle = document.getElementById('mobileMenuToggle');
mobileMenuToggle.addEventListener('click', () => {
sidebar.classList.toggle('active');
});
// Tab functionality
const tabs = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');
tabs.forEach(tab => {
tab.addEventListener('click', () => {
// Remove active class from all tabs and contents
tabs.forEach(t => t.classList.remove('active'));
tabContents.forEach(c => c.classList.remove('active'));
// Add active class to clicked tab and corresponding content
tab.classList.add('active');
const tabId = tab.getAttribute('data-tab');
document.getElementById(tabId).classList.add('active');
});
});
// Authentication handling
function checkAuth() {
const token = localStorage.getItem('token');
if (!token) {
window.location.href = '/login';
}
}
// Logout functionality
document.querySelector('.logout-btn').addEventListener('click', () => {
localStorage.removeItem('token');
window.location.href = '/login';
});
// Initialize first tab as active
if (tabs.length > 0) {
tabs[0].classList.add('active');
const firstTabId = tabs[0].getAttribute('data-tab');
document.getElementById(firstTabId).classList.add('active');
}
// Course card hover effect
const courseCards = document.querySelectorAll('.course-card');
courseCards.forEach(card => {
card.addEventListener('mouseenter', () => {
card.classList.add('hover:shadow-lg');
});
card.addEventListener('mouseleave', () => {
card.classList.remove('hover:shadow-lg');
});
});
// Load real data from APIs with loading states
async function loadDashboardData() {
try {
showLoading(true);
// Get user data first
const [userData, stats, activity, courses, batches] = await Promise.all([
apiService.get('/auth/me'),
apiService.get('/admin/dashboard/stats'),
apiService.get('/admin/activity?limit=4'),
apiService.get('/courses?sort=popularity&limit=3'),
apiService.get('/batches?status=UPCOMING&limit=3')
]);
// Update user info in sidebar
document.querySelector('.user-avatar').src = userData.avatar || 'https://randomuser.me/api/portraits/men/32.jpg';
document.querySelector('.user-name').textContent = userData.name;
document.querySelector('.user-role').textContent = userData.role;
updateStats(stats);
updateActivity(activity);
updateCourses(courses);
updateBatches(batches);
} catch (error) {
showError('Failed to load dashboard data: ' + error.message);
} finally {
showLoading(false);
}
}
function showLoading(loading) {
const loader = document.getElementById('loader');
if (loading) {
loader.classList.remove('hidden');
} else {
loader.classList.add('hidden');
}
}
function showError(message) {
const errorContainer = document.getElementById('error-container');
errorContainer.textContent = message;
errorContainer.classList.remove('hidden');
setTimeout(() => errorContainer.classList.add('hidden'), 5000);
}
// Update stats with proper formatting
function updateStats(stats) {
document.querySelector('[data-stat="students"]').textContent = stats.totalStudents.toLocaleString();
document.querySelector('[data-stat="instructors"]').textContent = stats.activeInstructors.toLocaleString();
document.querySelector('[data-stat="courses"]').textContent = stats.totalCourses.toLocaleString();
document.querySelector('[data-stat="revenue"]').textContent =
new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(stats.revenue);
// Update percentage changes
updatePercentageChange('students-change', stats.studentsChange);
updatePercentageChange('instructors-change', stats.instructorsChange);
updatePercentageChange('courses-change', stats.coursesChange);
updatePercentageChange('revenue-change', stats.revenueChange);
}
function updatePercentageChange(elementClass, change) {
const element = document.querySelector(`.${elementClass}`);
if (!element) return;
element.textContent = `${change > 0 ? '+' : ''}${change.toFixed(1)}%`;
element.className = `${elementClass} text-sm font-medium ${change >= 0 ? 'text-green-500' : 'text-red-500'}`;
}
function updateActivity(activities) {
const activityContainer = document.querySelector('.activity-container');
if (!activities || activities.length === 0) {
activityContainer.innerHTML = `
<div class="text-center py-4 text-gray-500">
No recent activity found
</div>
`;
return;
}
activityContainer.innerHTML = activities.map(activity => {
const { icon, color } = getActivityMeta(activity.type);
const formattedTime = formatTime(activity.timestamp);
return `
<div class="flex items-start">
<div class="p-2 rounded-full ${color}">
<i class="${icon}"></i>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-gray-800">${activity.title}</p>
<p class="text-xs text-gray-500">${activity.details}</p>
<p class="text-xs text-gray-400 mt-1">${formattedTime}</p>
</div>
</div>
`;
}).join('');
}
function getActivityMeta(type) {
const types = {
'enrollment': { icon: 'fas fa-user-plus', color: 'bg-indigo-100 text-indigo-600' },
'payment': { icon: 'fas fa-dollar-sign', color: 'bg-green-100 text-green-600' },
'session': { icon: 'fas fa-video', color: 'bg-blue-100 text-blue-600' },
'feedback': { icon: 'fas fa-comment', color: 'bg-purple-100 text-purple-600' },
'default': { icon: 'fas fa-info-circle', color: 'bg-gray-100 text-gray-600' }
};
return types[type] || types.default;
}
function formatTime(timestamp) {
const now = new Date();
const date = new Date(timestamp);
const diffInHours = Math.abs(now - date) / 36e5;
if (diffInHours < 24) {
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
} else if (diffInHours < 48) {
return 'Yesterday';
} else {
return date.toLocaleDateString([], { month: 'short', day: 'numeric' });
}
}
// Initialize the dashboard
document.addEventListener('DOMContentLoaded', () => {
loadDashboardData();
});
</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=Althafas/clms" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |