reports_pdf.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <!DOCTYPE html>
  2. <html lang="{{ get_locale() }}">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>{{ _("Reportes SquidStats -") }} {{ selected_date.isoformat() }}</title>
  7. <style>
  8. body { font-family: Arial, Helvetica, sans-serif; color: #1f2937; margin: 24px; }
  9. h1 { font-size: 22px; margin-bottom: 8px; }
  10. h2 { font-size: 18px; margin-top: 24px; margin-bottom: 8px; }
  11. .meta { font-size: 12px; opacity: .8; margin-bottom: 16px; }
  12. .box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; margin-bottom: 12px; }
  13. .table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  14. .table th, .table td { border: 1px solid #d1d5db; padding: 8px; text-align: left; }
  15. .table th { background: #f3f4f6; }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>{{ _("Reportes SquidStats") }}</h1>
  20. <div class="meta">{{ _("Fecha del reporte:") }} {{ selected_date.isoformat() }} {{ _("- Generado:") }} {{ generated_at }}</div>
  21. <div class="box">
  22. <h2>{{ _("Resumen General") }}</h2>
  23. <p>{{ _("Total usuarios:") }} {{ metrics.total_stats.total_users | default(0) }}</p>
  24. <p>{{ _("Total solicitudes:") }} {{ metrics.total_stats.total_requests | default(0) }}</p>
  25. <p>{{ _("Datos consumidos (MB):") }} {{ ((metrics.total_stats.total_data_transmitted | default(0)) / 1048576) | round(2) }}</p>
  26. </div>
  27. <div class="box">
  28. <h2>{{ _("Top usuarios por actividad") }}</h2>
  29. <table class="table">
  30. <thead>
  31. <tr><th>{{ _("Usuario") }}</th><th>{{ _("Visitas") }}</th></tr>
  32. </thead>
  33. <tbody>
  34. {% for item in metrics.top_users_by_activity %}
  35. <tr>
  36. <td>{{ item.username }}</td>
  37. <td>{{ item.total_visits }}</td>
  38. </tr>
  39. {% endfor %}
  40. </tbody>
  41. </table>
  42. </div>
  43. <div class="box">
  44. <h2>{{ _("Top URLs por consumo de datos") }}</h2>
  45. <table class="table">
  46. <thead>
  47. <tr><th>{{ _("URL") }}</th><th>{{ _("Datos (MB)") }}</th></tr>
  48. </thead>
  49. <tbody>
  50. {% for item in metrics.top_pages_by_data %}
  51. <tr>
  52. <td>{{ item.url }}</td>
  53. <td>{{ ((item.total_data_bytes | default(0)) / 1048576) | round(2) }}</td>
  54. </tr>
  55. {% endfor %}
  56. </tbody>
  57. </table>
  58. </div>
  59. <div class="box">
  60. <h2>{{ _("Distribución de códigos HTTP") }}</h2>
  61. <table class="table">
  62. <thead>
  63. <tr><th>{{ _("Código") }}</th><th>{{ _("Conteo") }}</th></tr>
  64. </thead>
  65. <tbody>
  66. {% for code in metrics.http_response_distribution_chart.labels %}
  67. <tr>
  68. <td>{{ code }}</td>
  69. <td>{{ metrics.http_response_distribution_chart.data[loop.index0] }}</td>
  70. </tr>
  71. {% endfor %}
  72. </tbody>
  73. </table>
  74. </div>
  75. </body>
  76. </html>