Spaces:
Running
Running
File size: 64,244 Bytes
7fb76fd |
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 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 |
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sistema de Feedback Avanzado</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>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
body {
font-family: 'Inter', sans-serif;
}
.fade-in {
animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.card-hover:hover {
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
textarea {
resize: none;
}
.progress-bar {
height: 6px;
border-radius: 3px;
transition: width 0.6s ease;
}
.type-tab {
transition: all 0.3s ease;
}
.type-tab.active {
border-bottom: 3px solid;
font-weight: 600;
}
.priority-high {
border-left: 4px solid #ef4444;
}
.priority-medium {
border-left: 4px solid #f59e0b;
}
.priority-low {
border-left: 4px solid #10b981;
}
.status-pending {
background-color: #fef3c7;
color: #d97706;
}
.status-resolved {
background-color: #d1fae5;
color: #059669;
}
.status-in-progress {
background-color: #dbeafe;
color: #2563eb;
}
.chart-container {
height: 300px;
}
.counter-card {
transition: all 0.3s ease;
}
.counter-card:hover {
transform: translateY(-5px);
}
.glow {
box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-8 max-w-7xl">
<!-- Header con estadísticas -->
<header class="mb-10">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-6">
<div>
<h1 class="text-4xl font-bold text-indigo-700 mb-2">Sistema de Feedback</h1>
<p class="text-gray-600">Registro y seguimiento de comentarios, bugs y solicitudes</p>
</div>
<div class="mt-4 md:mt-0 flex space-x-3">
<button onclick="openExportModal()" class="px-4 py-2 bg-gray-800 text-white rounded-lg hover:bg-gray-700 transition flex items-center">
<i class="fas fa-file-export mr-2"></i> Exportar
</button>
<button onclick="openAnalyticsModal()" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition flex items-center glow">
<i class="fas fa-chart-pie mr-2"></i> Analytics
</button>
</div>
</div>
<!-- Estadísticas principales -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-6">
<div class="bg-white rounded-xl shadow p-5 counter-card">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500 uppercase tracking-wider">Total Registros</p>
<h3 class="text-2xl font-bold" id="totalCount">0</h3>
<p class="text-xs text-gray-500 mt-1">Último: <span id="lastRecordDate">N/A</span></p>
</div>
<div class="p-3 rounded-full bg-indigo-100 text-indigo-600">
<i class="fas fa-list"></i>
</div>
</div>
<div class="mt-4">
<div class="flex justify-between text-xs text-gray-500 mb-1">
<span>Abiertos</span>
<span id="openCount">0</span>
</div>
<div class="h-1 w-full bg-gray-200 rounded-full">
<div class="h-1 bg-indigo-500 rounded-full progress-bar" id="openProgress"></div>
</div>
</div>
</div>
<div class="bg-white rounded-xl shadow p-5 counter-card">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500 uppercase tracking-wider">Bugs Reportados</p>
<h3 class="text-2xl font-bold" id="bugsCount">0</h3>
<p class="text-xs text-gray-500 mt-1">Resueltos: <span id="resolvedBugsCount">0</span></p>
</div>
<div class="p-3 rounded-full bg-red-100 text-red-600">
<i class="fas fa-bug"></i>
</div>
</div>
<div class="mt-4">
<div class="flex justify-between text-xs text-gray-500 mb-1">
<span>Prioridad Alta</span>
<span id="highPriorityBugs">0</span>
</div>
<div class="h-1 w-full bg-gray-200 rounded-full">
<div class="h-1 bg-red-500 rounded-full progress-bar" id="bugsProgress"></div>
</div>
</div>
</div>
<div class="bg-white rounded-xl shadow p-5 counter-card">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500 uppercase tracking-wider">Solicitudes</p>
<h3 class="text-2xl font-bold" id="requestsCount">0</h3>
<p class="text-xs text-gray-500 mt-1">Implementadas: <span id="implementedRequests">0</span></p>
</div>
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
<i class="fas fa-lightbulb"></i>
</div>
</div>
<div class="mt-4">
<div class="flex justify-between text-xs text-gray-500 mb-1">
<span>En progreso</span>
<span id="inProgressRequests">0</span>
</div>
<div class="h-1 w-full bg-gray-200 rounded-full">
<div class="h-1 bg-purple-500 rounded-full progress-bar" id="requestsProgress"></div>
</div>
</div>
</div>
<div class="bg-white rounded-xl shadow p-5 counter-card">
<div class="flex justify-between items-start">
<div>
<p class="text-sm text-gray-500 uppercase tracking-wider">Resueltos</p>
<h3 class="text-2xl font-bold" id="resolvedCount">0</h3>
<p class="text-xs text-gray-500 mt-1">Tiempo promedio: <span id="avgResolutionTime">0d</span></p>
</div>
<div class="p-3 rounded-full bg-green-100 text-green-600">
<i class="fas fa-check-circle"></i>
</div>
</div>
<div class="mt-4">
<div class="flex justify-between text-xs text-gray-500 mb-1">
<span>Últimos 7 días</span>
<span id="lastWeekResolved">0</span>
</div>
<div class="h-1 w-full bg-gray-200 rounded-full">
<div class="h-1 bg-green-500 rounded-full progress-bar" id="resolvedProgress"></div>
</div>
</div>
</div>
</div>
<!-- Estadísticas secundarias -->
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
<div class="bg-white rounded-xl shadow p-4 flex items-center">
<div class="p-3 rounded-full bg-orange-100 text-orange-600 mr-3">
<i class="fas fa-exclamation-triangle"></i>
</div>
<div>
<p class="text-sm text-gray-500">Quejas</p>
<h3 class="text-xl font-bold" id="complaintsCount">0</h3>
</div>
</div>
<div class="bg-white rounded-xl shadow p-4 flex items-center">
<div class="p-3 rounded-full bg-yellow-100 text-yellow-600 mr-3">
<i class="fas fa-star"></i>
</div>
<div>
<p class="text-sm text-gray-500">Elogios</p>
<h3 class="text-xl font-bold" id="praisesCount">0</h3>
</div>
</div>
<div class="bg-white rounded-xl shadow p-4 flex items-center">
<div class="p-3 rounded-full bg-blue-100 text-blue-600 mr-3">
<i class="fas fa-comment-dots"></i>
</div>
<div>
<p class="text-sm text-gray-500">Sugerencias</p>
<h3 class="text-xl font-bold" id="suggestionsCount">0</h3>
</div>
</div>
<div class="bg-white rounded-xl shadow p-4 flex items-center">
<div class="p-3 rounded-full bg-pink-100 text-pink-600 mr-3">
<i class="fas fa-user-tie"></i>
</div>
<div>
<p class="text-sm text-gray-500">Usuarios únicos</p>
<h3 class="text-xl font-bold" id="uniqueUsersCount">0</h3>
</div>
</div>
</div>
</header>
<!-- Pestañas de tipos -->
<div class="flex overflow-x-auto mb-6 bg-white rounded-lg shadow-sm">
<button onclick="filterByType('all')" class="type-tab active px-6 py-3 text-sm font-medium text-center border-b-2 border-transparent hover:text-gray-600" data-type="all">
<i class="fas fa-layer-group mr-2"></i> Todos
</button>
<button onclick="filterByType('bug')" class="type-tab px-6 py-3 text-sm font-medium text-center border-b-2 border-transparent hover:text-gray-600" data-type="bug">
<i class="fas fa-bug mr-2"></i> Bugs
</button>
<button onclick="filterByType('request')" class="type-tab px-6 py-3 text-sm font-medium text-center border-b-2 border-transparent hover:text-gray-600" data-type="request">
<i class="fas fa-lightbulb mr-2"></i> Solicitudes
</button>
<button onclick="filterByType('complaint')" class="type-tab px-6 py-3 text-sm font-medium text-center border-b-2 border-transparent hover:text-gray-600" data-type="complaint">
<i class="fas fa-exclamation-triangle mr-2"></i> Quejas
</button>
<button onclick="filterByType('praise')" class="type-tab px-6 py-3 text-sm font-medium text-center border-b-2 border-transparent hover:text-gray-600" data-type="praise">
<i class="fas fa-star mr-2"></i> Elogios
</button>
<button onclick="filterByType('suggestion')" class="type-tab px-6 py-3 text-sm font-medium text-center border-b-2 border-transparent hover:text-gray-600" data-type="suggestion">
<i class="fas fa-comment-dots mr-2"></i> Sugerencias
</button>
</div>
<!-- Contenido principal -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Formulario -->
<div class="lg:col-span-1">
<div class="bg-white rounded-xl shadow-md p-6 sticky top-6 transition-all duration-300 hover:shadow-lg">
<h2 class="text-2xl font-semibold text-gray-800 mb-6 flex items-center">
<i class="fas fa-plus-circle mr-3 text-indigo-500"></i> Nuevo Registro
</h2>
<form id="feedbackForm" class="space-y-4">
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">Nombre</label>
<input type="text" id="name" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="Tu nombre" required>
</div>
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input type="email" id="email" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="[email protected]" required>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="type" class="block text-sm font-medium text-gray-700 mb-1">Tipo</label>
<select id="type" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
<option value="bug">Bug/Error</option>
<option value="request">Solicitud</option>
<option value="complaint">Queja</option>
<option value="praise">Elogio</option>
<option value="suggestion">Sugerencia</option>
</select>
</div>
<div>
<label for="priority" class="block text-sm font-medium text-gray-700 mb-1">Prioridad</label>
<select id="priority" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
<option value="low">Baja</option>
<option value="medium" selected>Media</option>
<option value="high">Alta</option>
</select>
</div>
</div>
<div>
<label for="message" class="block text-sm font-medium text-gray-700 mb-1">Mensaje</label>
<textarea id="message" rows="5" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="Describe con detalle..." required></textarea>
</div>
<div id="bugDetails" class="hidden space-y-4">
<div>
<label for="browser" class="block text-sm font-medium text-gray-700 mb-1">Navegador</label>
<input type="text" id="browser" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="Ej: Chrome 112">
</div>
<div>
<label for="os" class="block text-sm font-medium text-gray-700 mb-1">Sistema Operativo</label>
<input type="text" id="os" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="Ej: Windows 10">
</div>
<div>
<label for="steps" class="block text-sm font-medium text-gray-700 mb-1">Pasos para reproducir</label>
<textarea id="steps" rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition" placeholder="Describe cómo reproducir el problema..."></textarea>
</div>
</div>
<div class="flex justify-end space-x-3 pt-2">
<button type="reset" class="px-6 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition">
<i class="fas fa-eraser mr-2"></i> Limpiar
</button>
<button type="submit" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition flex items-center">
<i class="fas fa-paper-plane mr-2"></i> Enviar
</button>
</div>
</form>
</div>
</div>
<!-- Lista de Registros -->
<div class="lg:col-span-2">
<div class="bg-white rounded-xl shadow-md p-6">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center mb-6">
<h2 class="text-2xl font-semibold text-gray-800 flex items-center">
<i class="fas fa-list-ul mr-3 text-indigo-500"></i> Registros Recientes
</h2>
<div class="mt-3 md:mt-0 flex space-x-2">
<div class="relative">
<select id="filterStatus" onchange="renderFeedbacks()" class="appearance-none px-4 py-2 pr-8 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition text-sm">
<option value="all">Todos los estados</option>
<option value="pending">Pendientes</option>
<option value="in-progress">En progreso</option>
<option value="resolved">Resueltos</option>
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
<i class="fas fa-chevron-down text-sm"></i>
</div>
</div>
<div class="relative">
<select id="filterPriority" onchange="renderFeedbacks()" class="appearance-none px-4 py-2 pr-8 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition text-sm">
<option value="all">Todas las prioridades</option>
<option value="high">Alta</option>
<option value="medium">Media</option>
<option value="low">Baja</option>
</select>
<div class="pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700">
<i class="fas fa-chevron-down text-sm"></i>
</div>
</div>
</div>
</div>
<div id="feedbackList" class="space-y-4">
<!-- Los registros aparecerán aquí dinámicamente -->
<div class="text-center py-10 text-gray-500">
<i class="fas fa-inbox text-4xl mb-3 opacity-50"></i>
<p>No hay registros aún. Agrega tu primer comentario o reporte.</p>
</div>
</div>
<div class="mt-6 flex justify-between items-center">
<div class="text-sm text-gray-500" id="showingCount">
Mostrando 0 de 0 registros
</div>
<div class="flex space-x-2">
<button id="prevPage" onclick="changePage(-1)" disabled class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition disabled:opacity-50">
<i class="fas fa-chevron-left"></i>
</button>
<button id="nextPage" onclick="changePage(1)" disabled class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition disabled:opacity-50">
<i class="fas fa-chevron-right"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal de Exportación -->
<div id="exportModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl p-6 w-full max-w-md fade-in">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-gray-800">Exportar Datos</h3>
<button onclick="closeExportModal()" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="space-y-4">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Formato</label>
<div class="grid grid-cols-2 gap-3">
<button onclick="exportData('json')" class="px-4 py-3 border border-gray-300 rounded-lg hover:bg-gray-50 transition flex items-center justify-center">
<i class="fas fa-file-code text-blue-500 mr-2"></i> JSON
</button>
<button onclick="exportData('csv')" class="px-4 py-3 border border-gray-300 rounded-lg hover:bg-gray-50 transition flex items-center justify-center">
<i class="fas fa-file-csv text-green-500 mr-2"></i> CSV
</button>
</div>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Filtros</label>
<select id="exportFilter" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 transition">
<option value="all">Todos los registros</option>
<option value="bug">Solo Bugs</option>
<option value="request">Solo Solicitudes</option>
<option value="complaint">Solo Quejas</option>
<option value="praise">Solo Elogios</option>
<option value="suggestion">Solo Sugerencias</option>
</select>
</div>
</div>
</div>
</div>
<!-- Modal de Analytics -->
<div id="analyticsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl p-6 w-full max-w-4xl max-h-[90vh] overflow-y-auto fade-in">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-gray-800">Analíticas de Feedback</h3>
<button onclick="closeAnalyticsModal()" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mb-6">
<div class="bg-white p-4 rounded-lg border border-gray-200">
<h4 class="font-medium text-gray-700 mb-3">Distribución por Tipo</h4>
<div class="chart-container" id="typeChart"></div>
</div>
<div class="bg-white p-4 rounded-lg border border-gray-200">
<h4 class="font-medium text-gray-700 mb-3">Estado de Tickets</h4>
<div class="chart-container" id="statusChart"></div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-white p-4 rounded-lg border border-gray-200">
<h4 class="font-medium text-gray-700 mb-3">Prioridades</h4>
<div class="chart-container" id="priorityChart"></div>
</div>
<div class="bg-white p-4 rounded-lg border border-gray-200">
<h4 class="font-medium text-gray-700 mb-3">Actividad Reciente</h4>
<div class="chart-container" id="activityChart"></div>
</div>
</div>
<div class="mt-6 pt-4 border-t border-gray-200">
<h4 class="font-medium text-gray-700 mb-3">Top Usuarios</h4>
<div id="topUsers" class="space-y-2">
<!-- Se llenará dinámicamente -->
</div>
</div>
</div>
</div>
<!-- Modal de Detalles -->
<div id="detailModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
<div class="bg-white rounded-xl shadow-xl p-6 w-full max-w-2xl max-h-[90vh] overflow-y-auto fade-in">
<div class="flex justify-between items-center mb-4">
<h3 class="text-xl font-bold text-gray-800">Detalles del Registro</h3>
<button onclick="closeDetailModal()" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div id="modalContent" class="space-y-4">
<!-- Contenido dinámico -->
</div>
<div class="mt-6 pt-4 border-t border-gray-200 flex justify-end space-x-3">
<button onclick="changeStatus('pending')" class="px-4 py-2 bg-yellow-100 text-yellow-800 rounded-lg hover:bg-yellow-200 transition">
<i class="fas fa-clock mr-2"></i> Pendiente
</button>
<button onclick="changeStatus('in-progress')" class="px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition">
<i class="fas fa-spinner mr-2"></i> En Progreso
</button>
<button onclick="changeStatus('resolved')" class="px-4 py-2 bg-green-100 text-green-800 rounded-lg hover:bg-green-200 transition">
<i class="fas fa-check mr-2"></i> Resuelto
</button>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script>
// Variables globales
let feedbacks = JSON.parse(localStorage.getItem('feedbacks')) || [];
let currentPage = 1;
const itemsPerPage = 5;
let currentFilterType = 'all';
let currentFilterStatus = 'all';
let currentFilterPriority = 'all';
let currentDetailId = null;
// Inicialización
document.addEventListener('DOMContentLoaded', function() {
// Manejar el envío del formulario
document.getElementById('feedbackForm').addEventListener('submit', handleFormSubmit);
// Mostrar campos adicionales para bugs
document.getElementById('type').addEventListener('change', function() {
const bugDetails = document.getElementById('bugDetails');
bugDetails.classList.toggle('hidden', this.value !== 'bug');
});
// Cargar datos iniciales
updateStats();
renderFeedbacks();
// Agregar algunos datos de ejemplo si está vacío
if (feedbacks.length === 0) {
addSampleData();
}
});
// Agregar datos de ejemplo
function addSampleData() {
const sampleFeedbacks = [
{
id: 1,
name: "Juan Pérez",
email: "[email protected]",
type: "bug",
priority: "high",
message: "El botón de enviar no funciona en la página de contacto",
date: "2023-05-15 10:30",
status: "pending",
browser: "Chrome 112",
os: "Windows 10",
steps: "1. Ir a la página de contacto\n2. Llenar el formulario\n3. Intentar hacer clic en enviar"
},
{
id: 2,
name: "María Gómez",
email: "[email protected]",
type: "request",
priority: "medium",
message: "Sería útil tener un buscador en la sección de productos",
date: "2023-05-14 15:45",
status: "in-progress"
},
{
id: 3,
name: "Carlos Ruiz",
email: "[email protected]",
type: "complaint",
priority: "high",
message: "El tiempo de carga de la página es demasiado lento",
date: "2023-05-13 09:20",
status: "pending"
},
{
id: 4,
name: "Ana López",
email: "[email protected]",
type: "praise",
priority: "low",
message: "Excelente servicio al cliente, muy atentos y resolvieron mi problema rápidamente",
date: "2023-05-12 14:10",
status: "resolved"
},
{
id: 5,
name: "Luis Martínez",
email: "[email protected]",
type: "suggestion",
priority: "low",
message: "Podrían agregar más métodos de pago como PayPal",
date: "2023-05-11 11:25",
status: "pending"
},
{
id: 6,
name: "Sofía Ramírez",
email: "[email protected]",
type: "bug",
priority: "medium",
message: "El menú desplegable no se muestra correctamente en móviles",
date: "2023-05-10 16:50",
status: "resolved",
browser: "Safari 15",
os: "iOS 15",
steps: "1. Abrir el sitio en un iPhone\n2. Intentar abrir el menú principal"
}
];
feedbacks = sampleFeedbacks;
localStorage.setItem('feedbacks', JSON.stringify(feedbacks));
updateStats();
renderFeedbacks();
}
// Manejar el envío del formulario
function handleFormSubmit(e) {
e.preventDefault();
// Obtener valores del formulario
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const type = document.getElementById('type').value;
const priority = document.getElementById('priority').value;
const message = document.getElementById('message').value;
const date = new Date().toISOString().slice(0, 19).replace('T', ' ');
// Datos adicionales para bugs
const bugData = type === 'bug' ? {
browser: document.getElementById('browser').value,
os: document.getElementById('os').value,
steps: document.getElementById('steps').value
} : {};
// Crear nuevo registro
const newFeedback = {
id: Date.now(),
name,
email,
type,
priority,
message,
date,
status: 'pending',
...bugData
};
// Agregar al array y guardar en localStorage
feedbacks.unshift(newFeedback);
localStorage.setItem('feedbacks', JSON.stringify(feedbacks));
// Renderizar la lista actualizada
renderFeedbacks();
updateStats();
// Resetear el formulario
e.target.reset();
// Mostrar notificación
showNotification('Registro guardado correctamente', 'success');
}
// Renderizar la lista de feedbacks
function renderFeedbacks() {
const feedbackList = document.getElementById('feedbackList');
// Obtener filtros actuales
currentFilterStatus = document.getElementById('filterStatus').value;
currentFilterPriority = document.getElementById('filterPriority').value;
// Aplicar filtros
let filteredFeedbacks = feedbacks.filter(feedback => {
const typeMatch = currentFilterType === 'all' || feedback.type === currentFilterType;
const statusMatch = currentFilterStatus === 'all' || feedback.status === currentFilterStatus;
const priorityMatch = currentFilterPriority === 'all' || feedback.priority === currentFilterPriority;
return typeMatch && statusMatch && priorityMatch;
});
// Paginación
const totalPages = Math.ceil(filteredFeedbacks.length / itemsPerPage);
const paginatedFeedbacks = filteredFeedbacks.slice(
(currentPage - 1) * itemsPerPage,
currentPage * itemsPerPage
);
// Actualizar controles de paginación
document.getElementById('prevPage').disabled = currentPage <= 1;
document.getElementById('nextPage').disabled = currentPage >= totalPages;
document.getElementById('showingCount').textContent =
`Mostrando ${paginatedFeedbacks.length} de ${filteredFeedbacks.length} registros`;
// Mostrar mensaje si no hay registros
if (paginatedFeedbacks.length === 0) {
feedbackList.innerHTML = `
<div class="text-center py-10 text-gray-500">
<i class="fas fa-inbox text-4xl mb-3 opacity-50"></i>
<p>No hay registros ${currentFilterType !== 'all' ? 'de este tipo' : ''}.</p>
</div>
`;
return;
}
// Generar HTML para cada registro
feedbackList.innerHTML = paginatedFeedbacks.map(feedback => `
<div class="bg-white border border-gray-200 rounded-lg p-5 card-hover transition-all duration-300 fade-in ${'priority-' + feedback.priority}">
<div class="flex justify-between items-start mb-3">
<div>
<h3 class="font-semibold text-lg text-gray-800">${feedback.name}</h3>
<p class="text-sm text-gray-500">${feedback.email}</p>
</div>
<div class="flex items-center space-x-2">
<span class="px-2 py-1 text-xs rounded-full ${getTypeClass(feedback.type)}">
${getTypeLabel(feedback.type)}
</span>
<span class="px-2 py-1 text-xs rounded-full ${getStatusClass(feedback.status)}">
${getStatusLabel(feedback.status)}
</span>
<span class="text-xs text-gray-400">${formatDate(feedback.date)}</span>
</div>
</div>
<p class="text-gray-700 mb-4">${feedback.message}</p>
<div class="flex justify-between items-center">
<span class="text-xs px-2 py-1 rounded-full ${getPriorityClass(feedback.priority)}">
<i class="fas ${getPriorityIcon(feedback.priority)} mr-1"></i>
${getPriorityLabel(feedback.priority)}
</span>
<div class="flex space-x-2">
<button onclick="viewDetails(${feedback.id})" class="text-indigo-500 hover:text-indigo-700 transition text-sm flex items-center">
<i class="fas fa-eye mr-1"></i> Ver
</button>
<button onclick="deleteFeedback(${feedback.id})" class="text-red-500 hover:text-red-700 transition text-sm flex items-center">
<i class="fas fa-trash-alt mr-1"></i> Eliminar
</button>
</div>
</div>
</div>
`).join('');
}
// Formatear fecha para mostrar
function formatDate(dateString) {
const date = new Date(dateString);
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'});
}
// Cambiar página
function changePage(direction) {
const newPage = currentPage + direction;
const filteredFeedbacks = getFilteredFeedbacks();
const totalPages = Math.ceil(filteredFeedbacks.length / itemsPerPage);
if (newPage > 0 && newPage <= totalPages) {
currentPage = newPage;
renderFeedbacks();
}
}
// Filtrar por tipo
function filterByType(type) {
currentFilterType = type;
currentPage = 1;
// Actualizar pestañas activas
document.querySelectorAll('.type-tab').forEach(tab => {
tab.classList.toggle('active', tab.dataset.type === type);
});
renderFeedbacks();
updateStats();
}
// Obtener feedbacks filtrados
function getFilteredFeedbacks() {
return feedbacks.filter(feedback => {
const typeMatch = currentFilterType === 'all' || feedback.type === currentFilterType;
const statusMatch = currentFilterStatus === 'all' || feedback.status === currentFilterStatus;
const priorityMatch = currentFilterPriority === 'all' || feedback.priority === currentFilterPriority;
return typeMatch && statusMatch && priorityMatch;
});
}
// Actualizar estadísticas
function updateStats() {
const total = feedbacks.length;
const bugs = feedbacks.filter(f => f.type === 'bug').length;
const requests = feedbacks.filter(f => f.type === 'request').length;
const complaints = feedbacks.filter(f => f.type === 'complaint').length;
const praises = feedbacks.filter(f => f.type === 'praise').length;
const suggestions = feedbacks.filter(f => f.type === 'suggestion').length;
const resolved = feedbacks.filter(f => f.status === 'resolved').length;
const pending = feedbacks.filter(f => f.status === 'pending').length;
const inProgress = feedbacks.filter(f => f.status === 'in-progress').length;
// Contadores principales
document.getElementById('totalCount').textContent = total;
document.getElementById('bugsCount').textContent = bugs;
document.getElementById('requestsCount').textContent = requests;
document.getElementById('resolvedCount').textContent = resolved;
document.getElementById('complaintsCount').textContent = complaints;
document.getElementById('praisesCount').textContent = praises;
document.getElementById('suggestionsCount').textContent = suggestions;
// Estadísticas secundarias
document.getElementById('openCount').textContent = pending + inProgress;
document.getElementById('resolvedBugsCount').textContent = feedbacks.filter(f => f.type === 'bug' && f.status === 'resolved').length;
document.getElementById('highPriorityBugs').textContent = feedbacks.filter(f => f.type === 'bug' && f.priority === 'high').length;
document.getElementById('implementedRequests').textContent = feedbacks.filter(f => f.type === 'request' && f.status === 'resolved').length;
document.getElementById('inProgressRequests').textContent = feedbacks.filter(f => f.type === 'request' && f.status === 'in-progress').length;
document.getElementById('lastWeekResolved').textContent = feedbacks.filter(f => {
const resolvedDate = new Date(f.date);
const oneWeekAgo = new Date();
oneWeekAgo.setDate(oneWeekAgo.getDate() - 7);
return f.status === 'resolved' && resolvedDate > oneWeekAgo;
}).length;
// Fecha del último registro
if (feedbacks.length > 0) {
const lastRecord = feedbacks[0];
document.getElementById('lastRecordDate').textContent = formatDate(lastRecord.date);
} else {
document.getElementById('lastRecordDate').textContent = 'N/A';
}
// Usuarios únicos
const uniqueEmails = [...new Set(feedbacks.map(f => f.email))];
document.getElementById('uniqueUsersCount').textContent = uniqueEmails.length;
// Tiempo promedio de resolución (simulado para el ejemplo)
const avgDays = feedbacks.length > 0 ? Math.floor(Math.random() * 5) + 1 : 0;
document.getElementById('avgResolutionTime').textContent = `${avgDays}d`;
// Actualizar barras de progreso
document.getElementById('bugsProgress').style.width = total > 0 ? `${(bugs / total) * 100}%` : '0%';
document.getElementById('requestsProgress').style.width = total > 0 ? `${(requests / total) * 100}%` : '0%';
document.getElementById('resolvedProgress').style.width = total > 0 ? `${(resolved / total) * 100}%` : '0%';
document.getElementById('openProgress').style.width = total > 0 ? `${((pending + inProgress) / total) * 100}%` : '0%';
}
// Ver detalles
function viewDetails(id) {
const feedback = feedbacks.find(f => f.id === id);
if (!feedback) return;
currentDetailId = id;
// Construir contenido del modal
let detailsHTML = `
<div class="space-y-4">
<div>
<h4 class="text-sm font-medium text-gray-500">Información Básica</h4>
<div class="mt-2 grid grid-cols-2 gap-4">
<div>
<p class="text-xs text-gray-500">Nombre</p>
<p class="font-medium">${feedback.name}</p>
</div>
<div>
<p class="text-xs text-gray-500">Email</p>
<p class="font-medium">${feedback.email}</p>
</div>
<div>
<p class="text-xs text-gray-500">Tipo</p>
<p class="font-medium">
<span class="px-2 py-1 text-xs rounded-full ${getTypeClass(feedback.type)}">
${getTypeLabel(feedback.type)}
</span>
</p>
</div>
<div>
<p class="text-xs text-gray-500">Prioridad</p>
<p class="font-medium">
<span class="px-2 py-1 text-xs rounded-full ${getPriorityClass(feedback.priority)}">
${getPriorityLabel(feedback.priority)}
</span>
</p>
</div>
<div>
<p class="text-xs text-gray-500">Fecha</p>
<p class="font-medium">${formatDate(feedback.date)}</p>
</div>
<div>
<p class="text-xs text-gray-500">Estado</p>
<p class="font-medium">
<span class="px-2 py-1 text-xs rounded-full ${getStatusClass(feedback.status)}">
${getStatusLabel(feedback.status)}
</span>
</p>
</div>
</div>
</div>
<div>
<h4 class="text-sm font-medium text-gray-500">Mensaje</h4>
<div class="mt-2 bg-gray-50 p-4 rounded-lg">
<p class="whitespace-pre-line">${feedback.message}</p>
</div>
</div>
`;
// Mostrar detalles adicionales para bugs
if (feedback.type === 'bug') {
detailsHTML += `
<div>
<h4 class="text-sm font-medium text-gray-500">Detalles del Bug</h4>
<div class="mt-2 grid grid-cols-2 gap-4">
<div>
<p class="text-xs text-gray-500">Navegador</p>
<p class="font-medium">${feedback.browser || 'No especificado'}</p>
</div>
<div>
<p class="text-xs text-gray-500">Sistema Operativo</p>
<p class="font-medium">${feedback.os || 'No especificado'}</p>
</div>
</div>
<div class="mt-4">
<p class="text-xs text-gray-500">Pasos para reproducir</p>
<div class="mt-2 bg-gray-50 p-4 rounded-lg">
<p class="whitespace-pre-line">${feedback.steps || 'No especificado'}</p>
</div>
</div>
</div>
`;
}
detailsHTML += `</div>`;
document.getElementById('modalContent').innerHTML = detailsHTML;
document.getElementById('detailModal').classList.remove('hidden');
}
// Cerrar modal de detalles
function closeDetailModal() {
document.getElementById('detailModal').classList.add('hidden');
currentDetailId = null;
}
// Cambiar estado de un feedback
function changeStatus(newStatus) {
if (!currentDetailId) return;
const index = feedbacks.findIndex(f => f.id === currentDetailId);
if (index !== -1) {
feedbacks[index].status = newStatus;
localStorage.setItem('feedbacks', JSON.stringify(feedbacks));
showNotification('Estado actualizado correctamente', 'success');
renderFeedbacks();
updateStats();
closeDetailModal();
}
}
// Eliminar feedback
function deleteFeedback(id) {
if (!confirm('¿Estás seguro de eliminar este registro?')) return;
feedbacks = feedbacks.filter(feedback => feedback.id !== id);
localStorage.setItem('feedbacks', JSON.stringify(feedbacks));
// Si estamos en la última página y queda vacía, retroceder una página
const filteredCount = getFilteredFeedbacks().length;
const maxPage = Math.ceil(filteredCount / itemsPerPage);
if (currentPage > maxPage && maxPage > 0) {
currentPage = maxPage;
}
renderFeedbacks();
updateStats();
showNotification('Registro eliminado', 'error');
}
// Mostrar notificación
function showNotification(message, type) {
const notification = document.createElement('div');
notification.className = `fixed bottom-6 right-6 px-6 py-3 rounded-lg shadow-lg text-white flex items-center ${
type === 'success' ? 'bg-green-500' : 'bg-red-500'
} fade-in`;
notification.innerHTML = `
<i class="fas ${type === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle'} mr-2"></i>
${message}
`;
document.body.appendChild(notification);
// Eliminar después de 3 segundos
setTimeout(() => {
notification.classList.remove('fade-in');
notification.classList.add('opacity-0', 'transition-opacity', 'duration-300');
setTimeout(() => notification.remove(), 300);
}, 3000);
}
// Funciones para manejar tipos
function getTypeClass(type) {
const classes = {
bug: 'bg-red-100 text-red-800',
request: 'bg-purple-100 text-purple-800',
complaint: 'bg-orange-100 text-orange-800',
praise: 'bg-green-100 text-green-800',
suggestion: 'bg-blue-100 text-blue-800'
};
return classes[type] || 'bg-gray-100 text-gray-800';
}
function getTypeLabel(type) {
const labels = {
bug: 'Bug',
request: 'Solicitud',
complaint: 'Queja',
praise: 'Elogio',
suggestion: 'Sugerencia'
};
return labels[type] || type;
}
// Funciones para manejar prioridades
function getPriorityClass(priority) {
const classes = {
high: 'bg-red-100 text-red-800',
medium: 'bg-yellow-100 text-yellow-800',
low: 'bg-green-100 text-green-800'
};
return classes[priority] || 'bg-gray-100 text-gray-800';
}
function getPriorityLabel(priority) {
const labels = {
high: 'Alta',
medium: 'Media',
low: 'Baja'
};
return labels[priority] || priority;
}
function getPriorityIcon(priority) {
const icons = {
high: 'fa-exclamation-circle',
medium: 'fa-exclamation-triangle',
low: 'fa-info-circle'
};
return icons[priority] || 'fa-question-circle';
}
// Funciones para manejar estados
function getStatusClass(status) {
const classes = {
pending: 'bg-yellow-100 text-yellow-800',
'in-progress': 'bg-blue-100 text-blue-800',
resolved: 'bg-green-100 text-green-800'
};
return classes[status] || 'bg-gray-100 text-gray-800';
}
function getStatusLabel(status) {
const labels = {
pending: 'Pendiente',
'in-progress': 'En Progreso',
resolved: 'Resuelto'
};
return labels[status] || status;
}
// Funciones para exportación
function openExportModal() {
document.getElementById('exportModal').classList.remove('hidden');
}
function closeExportModal() {
document.getElementById('exportModal').classList.add('hidden');
}
function exportData(format) {
const filter = document.getElementById('exportFilter').value;
let dataToExport = feedbacks;
if (filter !== 'all') {
dataToExport = feedbacks.filter(f => f.type === filter);
}
if (format === 'json') {
exportJSON(dataToExport);
} else if (format === 'csv') {
exportCSV(dataToExport);
}
closeExportModal();
showNotification('Exportación completada', 'success');
}
function exportJSON(data) {
const json = JSON.stringify(data, null, 2);
const blob = new Blob([json], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `feedback_${new Date().toISOString().slice(0, 10)}.json`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
function exportCSV(data) {
if (data.length === 0) return;
// Encabezados
const headers = Object.keys(data[0]);
let csv = headers.join(',') + '\n';
// Filas
data.forEach(item => {
const row = headers.map(header => {
let value = item[header];
// Escapar comas y comillas
if (typeof value === 'string') {
value = `"${value.replace(/"/g, '""')}"`;
}
return value;
});
csv += row.join(',') + '\n';
});
const blob = new Blob([csv], { type: 'text/csv' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `feedback_${new Date().toISOString().slice(0, 10)}.csv`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}
// Funciones para analytics
function openAnalyticsModal() {
document.getElementById('analyticsModal').classList.remove('hidden');
renderCharts();
}
function closeAnalyticsModal() {
document.getElementById('analyticsModal').classList.add('hidden');
}
function renderCharts() {
// Datos para los gráficos
const typeData = [
feedbacks.filter(f => f.type === 'bug').length,
feedbacks.filter(f => f.type === 'request').length,
feedbacks.filter(f => f.type === 'complaint').length,
feedbacks.filter(f => f.type === 'praise').length,
feedbacks.filter(f => f.type === 'suggestion').length
];
const statusData = [
feedbacks.filter(f => f.status === 'pending').length,
feedbacks.filter(f => f.status === 'in-progress').length,
feedbacks.filter(f => f.status === 'resolved').length
];
const priorityData = [
feedbacks.filter(f => f.priority === 'high').length,
feedbacks.filter(f => f.priority === 'medium').length,
feedbacks.filter(f => f.priority === 'low').length
];
// Gráfico de tipos
const typeChart = new ApexCharts(document.querySelector("#typeChart"), {
series: typeData,
chart: {
type: 'donut',
height: '100%'
},
labels: ['Bugs', 'Solicitudes', 'Quejas', 'Elogios', 'Sugerencias'],
colors: ['#EF4444', '#8B5CF6', '#F97316', '#10B981', '#3B82F6'],
legend: {
position: 'bottom'
},
responsive: [{
breakpoint: 480,
options: {
chart: {
width: 200
},
legend: {
position: 'bottom'
}
}
}]
});
typeChart.render();
// Gráfico de estados
const statusChart = new ApexCharts(document.querySelector("#statusChart"), {
series: statusData,
chart: {
type: 'pie',
height: '100%'
},
labels: ['Pendientes', 'En Progreso', 'Resueltos'],
colors: ['#F59E0B', '#3B82F6', '#10B981'],
legend: {
position: 'bottom'
}
});
statusChart.render();
// Gráfico de prioridades
const priorityChart = new ApexCharts(document.querySelector("#priorityChart"), {
series: priorityData,
chart: {
type: 'radialBar',
height: '100%'
},
plotOptions: {
radialBar: {
dataLabels: {
name: {
fontSize: '22px',
},
value: {
fontSize: '16px',
},
total: {
show: true,
label: 'Total',
formatter: function () {
return priorityData.reduce((a, b) => a + b, 0);
}
}
}
}
},
labels: ['Alta', 'Media', 'Baja'],
colors: ['#EF4444', '#F59E0B', '#10B981']
});
priorityChart.render();
// Gráfico de actividad (simulado)
const activityChart = new ApexCharts(document.querySelector("#activityChart"), {
series: [{
name: 'Registros',
data: [5, 8, 12, 7, 9, 15, 10]
}],
chart: {
type: 'area',
height: '100%',
sparkline: {
enabled: false
},
toolbar: {
show: false
}
},
colors: ['#8B5CF6'],
fill: {
type: 'gradient',
gradient: {
shadeIntensity: 1,
opacityFrom: 0.7,
opacityTo: 0.3,
}
},
stroke: {
curve: 'smooth',
width: 2
},
xaxis: {
categories: ['Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb', 'Dom']
},
tooltip: {
fixed: {
enabled: false
},
x: {
show: false
},
marker: {
show: false
}
}
});
activityChart.render();
// Top usuarios
const userCounts = {};
feedbacks.forEach(f => {
if (userCounts[f.email]) {
userCounts[f.email]++;
} else {
userCounts[f.email] = 1;
}
});
const sortedUsers = Object.entries(userCounts)
.sort((a, b) => b[1] - a[1])
.slice(0, 5);
const topUsersContainer = document.getElementById('topUsers');
topUsersContainer.innerHTML = sortedUsers.map(([email, count]) => `
<div class="flex justify-between items-center p-2 bg-gray-50 rounded-lg">
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-indigo-100 text-indigo-600 flex items-center justify-center mr-3">
<i class="fas fa-user text-sm"></i>
</div>
<span class="text-sm font-medium">${email.split('@')[0]}</span>
</div>
<span class="text-xs bg-gray-200 text-gray-700 px-2 py-1 rounded-full">${count} registros</span>
</div>
`).join('');
}
</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=TrainHeartX/nuevo" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |