Spaces:
Running
Running
File size: 35,361 Bytes
2df524b e61092b | 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 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>StreamAdmin - Panel de Control</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
<script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
.sidebar {
transition: all 0.3s;
}
.sidebar-collapsed {
width: 80px;
}
.sidebar-expanded {
width: 260px;
}
.main-content {
transition: margin-left 0.3s;
}
.content-expanded {
margin-left: 260px;
}
.content-collapsed {
margin-left: 80px;
}
.active-menu {
background-color: #6366f1;
color: white;
}
.active-menu:hover {
background-color: #4f46e5 !important;
}
.dropdown-enter {
opacity: 0;
transform: translateY(-10px);
}
.dropdown-enter-active {
opacity: 1;
transform: translateY(0);
transition: all 0.2s ease;
}
.dropdown-exit {
opacity: 1;
transform: translateY(0);
}
.dropdown-exit-active {
opacity: 0;
transform: translateY(-10px);
transition: all 0.2s ease;
}
@media (max-width: 768px) {
.sidebar {
position: fixed;
z-index: 50;
transform: translateX(-100%);
}
.sidebar-mobile-show {
transform: translateX(0);
}
.main-content {
margin-left: 0 !important;
}
}
</style>
</head>
<body class="bg-gray-100 font-sans">
<!-- Login Page -->
<div id="login-page" class="min-h-screen flex items-center justify-center bg-gradient-to-br from-indigo-600 to-purple-600">
<div class="bg-white p-8 rounded-lg shadow-xl w-full max-w-md" data-aos="zoom-in">
<div class="text-center mb-8">
<h1 class="text-3xl font-bold text-gray-800">StreamAdmin</h1>
<p class="text-gray-600 mt-2">Panel de administración de servicios</p>
</div>
<form id="login-form" class="space-y-6">
<div>
<label for="username" class="block text-sm font-medium text-gray-700">Usuario</label>
<input type="text" id="username" name="username" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="password" class="block text-sm font-medium text-gray-700">Contraseña</label>
<input type="password" id="password" name="password" required
class="mt-1 block w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<button type="submit"
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
Iniciar sesión
</button>
</div>
</form>
</div>
</div>
<!-- Admin Dashboard (initially hidden) -->
<div id="admin-dashboard" class="hidden">
<!-- Sidebar -->
<div id="sidebar" class="sidebar sidebar-expanded fixed h-full bg-gray-800 text-white overflow-y-auto">
<div class="p-4 flex items-center justify-between border-b border-gray-700">
<h1 class="text-xl font-semibold whitespace-nowrap">StreamAdmin</h1>
<button id="toggle-sidebar" class="text-gray-400 hover:text-white focus:outline-none">
<i data-feather="menu"></i>
</button>
</div>
<nav class="mt-6">
<div class="px-4">
<div class="relative">
<input type="text" placeholder="Buscar..."
class="w-full bg-gray-700 text-white px-4 py-2 rounded-md focus:outline-none focus:ring-1 focus:ring-indigo-500">
<i data-feather="search" class="absolute right-3 top-2.5 text-gray-400"></i>
</div>
</div>
<div class="mt-6">
<a href="#" class="menu-item active-menu flex items-center px-4 py-3 text-sm font-medium hover:bg-gray-700">
<i data-feather="home" class="mr-3"></i>
<span class="menu-text">Dashboard</span>
</a>
<a href="#" class="menu-item flex items-center px-4 py-3 text-sm font-medium hover:bg-gray-700">
<i data-feather="users" class="mr-3"></i>
<span class="menu-text">Usuarios</span>
</a>
<a href="#" class="menu-item flex items-center px-4 py-3 text-sm font-medium hover:bg-gray-700">
<i data-feather="tv" class="mr-3"></i>
<span class="menu-text">Servicios</span>
</a>
<a href="#" class="menu-item flex items-center px-4 py-3 text-sm font-medium hover:bg-gray-700">
<i data-feather="file-text" class="mr-3"></i>
<span class="menu-text">Reportes</span>
</a>
<a href="#" class="menu-item flex items-center px-4 py-3 text-sm font-medium hover:bg-gray-700">
<i data-feather="settings" class="mr-3"></i>
<span class="menu-text">Configuración</span>
</a>
</div>
</nav>
<div class="absolute bottom-0 w-full p-4 border-t border-gray-700">
<div class="flex items-center">
<div class="w-10 h-10 rounded-full bg-indigo-600 flex items-center justify-center">
<i data-feather="user"></i>
</div>
<div class="ml-3 menu-text">
<p class="text-sm font-medium">Administrador</p>
<p class="text-xs text-gray-400">admin@streamadmin.com</p>
</div>
</div>
<button id="logout-btn" class="mt-4 w-full flex items-center justify-center py-2 px-4 bg-gray-700 rounded-md hover:bg-gray-600">
<i data-feather="log-out" class="mr-2"></i>
<span class="menu-text">Cerrar sesión</span>
</button>
</div>
</div>
<!-- Main Content -->
<div id="main-content" class="main-content content-expanded min-h-screen">
<!-- Top Navigation -->
<header class="bg-white shadow-sm">
<div class="max-w-7xl mx-auto px-4 py-4 sm:px-6 lg:px-8 flex justify-between items-center">
<h1 class="text-lg font-semibold text-gray-900">Dashboard</h1>
<div class="flex items-center space-x-4">
<button class="p-2 rounded-full text-gray-500 hover:text-gray-700 hover:bg-gray-100 focus:outline-none">
<i data-feather="bell"></i>
</button>
<button class="md:hidden p-2 rounded-full text-gray-500 hover:text-gray-700 hover:bg-gray-100 focus:outline-none" id="mobile-menu-button">
<i data-feather="menu"></i>
</button>
</div>
</div>
</header>
<!-- Dashboard Content -->
<main class="max-w-7xl mx-auto px-4 py-6 sm:px-6 lg:px-8">
<!-- Stats Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<div class="bg-white rounded-lg shadow p-6" data-aos="fade-up">
<div class="flex items-center">
<div class="p-3 rounded-full bg-indigo-100 text-indigo-600">
<i data-feather="users"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Usuarios activos</p>
<p class="text-2xl font-semibold text-gray-900">1,248</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6" data-aos="fade-up" data-aos-delay="100">
<div class="flex items-center">
<div class="p-3 rounded-full bg-green-100 text-green-600">
<i data-feather="tv"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Servicios activos</p>
<p class="text-2xl font-semibold text-gray-900">2,543</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6" data-aos="fade-up" data-aos-delay="200">
<div class="flex items-center">
<div class="p-3 rounded-full bg-yellow-100 text-yellow-600">
<i data-feather="clock"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Por renovar</p>
<p class="text-2xl font-semibold text-gray-900">187</p>
</div>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6" data-aos="fade-up" data-aos-delay="300">
<div class="flex items-center">
<div class="p-3 rounded-full bg-red-100 text-red-600">
<i data-feather="alert-circle"></i>
</div>
<div class="ml-4">
<p class="text-sm font-medium text-gray-500">Vencidos</p>
<p class="text-2xl font-semibold text-gray-900">92</p>
</div>
</div>
</div>
</div>
<!-- Charts -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
<div class="bg-white rounded-lg shadow p-6" data-aos="fade-right">
<h2 class="text-lg font-medium text-gray-900 mb-4">Servicios más contratados</h2>
<div class="h-64">
<canvas id="servicesChart"></canvas>
</div>
</div>
<div class="bg-white rounded-lg shadow p-6" data-aos="fade-left">
<h2 class="text-lg font-medium text-gray-900 mb-4">Renovaciones próximas</h2>
<div class="h-64">
<canvas id="renewalsChart"></canvas>
</div>
</div>
</div>
<!-- Recent Users -->
<div class="bg-white rounded-lg shadow overflow-hidden" data-aos="fade-up">
<div class="px-6 py-4 border-b border-gray-200 flex justify-between items-center">
<h2 class="text-lg font-medium text-gray-900">Usuarios recientes</h2>
<button class="text-sm text-indigo-600 hover:text-indigo-800">Ver todos</button>
</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">Nombre</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">WhatsApp</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Servicios</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Estado</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Acciones</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">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/1" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Juan Pérez</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">juan@example.com</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">+1 234 567 890</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex space-x-1">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-purple-100 text-purple-800">Disney+</span>
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">HBO Max</span>
</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">Activo</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
<button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</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">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/2" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">María González</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">maria@example.com</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">+1 987 654 321</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex space-x-1">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800">HBO Max</span>
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800">Prime Video</span>
</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-yellow-100 text-yellow-800">Por vencer</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
<button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</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">
<img class="h-10 w-10 rounded-full" src="http://static.photos/people/200x200/3" alt="">
</div>
<div class="ml-4">
<div class="text-sm font-medium text-gray-900">Carlos López</div>
</div>
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">carlos@example.com</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">+1 555 123 456</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex space-x-1">
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800">Paramount+</span>
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Bantel TV</span>
</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-red-100 text-red-800">Vencido</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
<button class="text-indigo-600 hover:text-indigo-900 mr-3"><i data-feather="edit" class="w-4 h-4"></i></button>
<button class="text-red-600 hover:text-red-900"><i data-feather="trash-2" class="w-4 h-4"></i></button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</main>
</div>
<!-- Add User Modal -->
<div id="add-user-modal" class="fixed inset-0 z-50 hidden overflow-y-auto">
<div class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
<div class="absolute inset-0 bg-gray-500 opacity-75"></div>
</div>
<span class="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
<div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full" role="dialog" aria-modal="true" aria-labelledby="modal-headline">
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
<div class="sm:flex sm:items-start">
<div class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-indigo-100 sm:mx-0 sm:h-10 sm:w-10">
<i data-feather="user-plus" class="text-indigo-600"></i>
</div>
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left w-full">
<h3 class="text-lg leading-6 font-medium text-gray-900" id="modal-headline">Agregar nuevo usuario</h3>
<div class="mt-2">
<form class="space-y-4">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="name" class="block text-sm font-medium text-gray-700">Nombre completo</label>
<input type="text" id="name" name="name" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700">Email</label>
<input type="email" id="email" name="email" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="phone" class="block text-sm font-medium text-gray-700">Teléfono</label>
<input type="tel" id="phone" name="phone" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="whatsapp" class="block text-sm font-medium text-gray-700">WhatsApp</label>
<input type="tel" id="whatsapp" name="whatsapp" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Servicios de streaming</label>
<div class="grid grid-cols-2 md:grid-cols-3 gap-3">
<div class="flex items-center">
<input id="disney" name="services" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="disney" class="ml-2 block text-sm text-gray-700">Disney+</label>
</div>
<div class="flex items-center">
<input id="hbo" name="services" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="hbo" class="ml-2 block text-sm text-gray-700">HBO Max</label>
</div>
<div class="flex items-center">
<input id="prime" name="services" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="prime" class="ml-2 block text-sm text-gray-700">Prime Video</label>
</div>
<div class="flex items-center">
<input id="paramount" name="services" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="paramount" class="ml-2 block text-sm text-gray-700">Paramount+</label>
</div>
<div class="flex items-center">
<input id="bantel" name="services" type="checkbox" class="h-4 w-4 text-indigo-600 focus:ring-indigo-500 border-gray-300 rounded">
<label for="bantel" class="ml-2 block text-sm text-gray-700">Bantel TV</label>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label for="start-date" class="block text-sm font-medium text-gray-700">Fecha de inicio</label>
<input type="date" id="start-date" name="start-date" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
<div>
<label for="end-date" class="block text-sm font-medium text-gray-700">Fecha de vencimiento</label>
<input type="date" id="end-date" name="end-date" class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
</div>
</div>
<div>
<label for="status" class="block text-sm font-medium text-gray-700">Estado</label>
<select id="status" name="status" class="mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md">
<option value="active">Activo</option>
<option value="pending">Por vencer</option>
<option value="expired">Vencido</option>
<option value="suspended">Suspendido</option>
</select>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
<button type="button" class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:ml-3 sm:w-auto sm:text-sm">
Guardar
</button>
<button type="button" class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm cancel-modal">
Cancelar
</button>
</div>
</div>
</div>
</div>
</div>
<script>
// Initialize AOS animations
AOS.init({
duration: 800,
easing: 'ease-in-out',
once: true
});
// Initialize Feather Icons
feather.replace();
// Login functionality
document.getElementById('login-form').addEventListener('submit', function(e) {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
if (username === 'admin' && password === 'admin') {
document.getElementById('login-page').classList.add('hidden');
document.getElementById('admin-dashboard').classList.remove('hidden');
} else {
alert('Credenciales incorrectas. Usuario: admin, Contraseña: admin');
}
});
// Logout functionality
document.getElementById('logout-btn').addEventListener('click', function() {
document.getElementById('admin-dashboard').classList.add('hidden');
document.getElementById('login-page').classList.remove('hidden');
document.getElementById('username').value = '';
document.getElementById('password').value = '';
});
// Toggle sidebar
document.getElementById('toggle-sidebar').addEventListener('click', function() {
const sidebar = document.getElementById('sidebar');
const mainContent = document.getElementById('main-content');
if (sidebar.classList.contains('sidebar-expanded')) {
sidebar.classList.remove('sidebar-expanded');
sidebar.classList.add('sidebar-collapsed');
mainContent.classList.remove('content-expanded');
mainContent.classList.add('content-collapsed');
} else {
sidebar.classList.remove('sidebar-collapsed');
sidebar.classList.add('sidebar-expanded');
mainContent.classList.remove('content-collapsed');
mainContent.classList.add('content-expanded');
}
// Update menu text visibility
document.querySelectorAll('.menu-text').forEach(el => {
el.classList.toggle('hidden');
});
});
// Mobile menu toggle
document.getElementById('mobile-menu-button').addEventListener('click', function() {
document.getElementById('sidebar').classList.toggle('sidebar-mobile-show');
});
// Close modals
document.querySelectorAll('.cancel-modal').forEach(btn => {
btn.addEventListener('click', function() {
this.closest('.fixed').classList.add('hidden');
});
});
// Charts
document.addEventListener('DOMContentLoaded', function() {
// Services Chart
const servicesCtx = document.getElementById('servicesChart').getContext('2d');
const servicesChart = new Chart(servicesCtx, {
type: 'doughnut',
data: {
labels: ['Disney+', 'HBO Max', 'Prime Video', 'Paramount+', 'Bantel TV'],
datasets: [{
data: [35, 25, 20, 15, 5],
backgroundColor: [
'#8b5cf6',
'#3b82f6',
'#f59e0b',
'#ef4444',
'#10b981'
],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'right',
}
}
}
});
// Renewals Chart
const renewalsCtx = document.getElementById('renewalsChart').getContext('2d');
const renewalsChart = new Chart(renewalsCtx, {
type: 'bar',
data: {
labels: ['Hoy', 'Mañana', 'En 3 días', 'En 1 semana', 'En 2 semanas'],
datasets: [{
label: 'Renovaciones',
data: [12, 19, 8, 15, 24],
backgroundColor: '#6366f1',
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true
}
}
}
});
});
</script>
</body>
</html>
|