auditoria_pdf.html 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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>{{ _("Auditoría -") }} {{ audit_type }}</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: 0.75; margin-bottom: 16px; }
  12. .box { border: 1px solid #d1d5db; border-radius: 8px; padding: 14px; margin-bottom: 10px; }
  13. .table { width: 100%; border-collapse: collapse; margin-top: 8px; }
  14. .table th, .table td { border: 1px solid #d1d5db; padding: 6px; text-align: left; }
  15. .table th { background: #f3f4f6; }
  16. </style>
  17. </head>
  18. <body>
  19. <h1>{{ _("Auditoría:") }} {{ audit_type | replace('_',' ') | title }}</h1>
  20. <div class="meta">{{ _("Generado:") }} {{ generated_at }} {{ _("| Filtros:") }} {% for k,v in params.items() if v %}{{ k }}={{ v }}{% if not loop.last %}, {% endif %}{% endfor %}</div>
  21. {% if data.error %}
  22. <div class="box"><strong>{{ _("Error:") }}</strong> {{ data.error }}</div>
  23. {% else %}
  24. {% set has_results = data.results is defined and data.results %}
  25. {% if audit_type == 'user_summary' %}
  26. <div class="box">
  27. <h2>{{ _("Resumen de Usuario") }}</h2>
  28. <p>{{ _("Total solicitudes:") }} {{ data.total_requests | default(0) }}</p>
  29. <p>{{ _("Datos totales (GB):") }} {{ data.total_data_gb | default(0) }}</p>
  30. </div>
  31. {% if data.top_domains %}
  32. <div class="box"><h2>{{ _("Top dominios") }}</h2><table class="table"><tr><th>{{ _("Dominio") }}</th><th>{{ _("Conteo") }}</th></tr>{% for row in data.top_domains %}<tr><td>{{ row.domain }}</td><td>{{ row.count }}</td></tr>{% endfor %}</table></div>
  33. {% endif %}
  34. {% if data.response_summary %}
  35. <div class="box"><h2>{{ _("Resumen de respuestas") }}</h2><table class="table"><tr><th>{{ _("Código") }}</th><th>{{ _("Conteo") }}</th></tr>{% for row in data.response_summary %}<tr><td>{{ row.code }}</td><td>{{ row.count }}</td></tr>{% endfor %}</table></div>
  36. {% endif %}
  37. {% elif audit_type == 'daily_activity' %}
  38. <div class="box"><h2>{{ _("Actividad diaria") }}</h2><p>{{ _("Total solicitudes:") }} {{ data.total_requests | default(0) }}</p><table class="table"><tr><th>{{ _("Hora") }}</th><th>{{ _("Requests") }}</th></tr>{% for value in data.hourly_activity %}<tr><td>{{ loop.index0 }}:00</td><td>{{ value }}</td></tr>{% endfor %}</table></div>
  39. {% elif audit_type == 'total_data_consumed' %}
  40. <div class="box"><h2>{{ _("Consumo total") }}</h2><p>{{ _("Datos totales (GB):") }} {{ data.total_data_gb | default(0) }}</p><p>{{ _("Total peticiones:") }} {{ data.total_requests | default(0) }}</p><p>{{ _("Rango:") }} {{ data.date_range | default('n/a') }}</p></div>
  41. {% elif audit_type == 'top_users_data' %}
  42. {% set rows = data.top_users %}
  43. <div class="box"><h2>{{ _("Top usuarios por datos") }}</h2></div>
  44. {% elif audit_type == 'top_users_requests' %}
  45. {% set rows = data.top_users_requests %}
  46. <div class="box"><h2>{{ _("Top usuarios por solicitudes") }}</h2></div>
  47. {% elif audit_type == 'top_urls_data' %}
  48. {% set rows = data.top_urls %}
  49. <div class="box"><h2>{{ _("Top URLs por datos") }}</h2></div>
  50. {% elif audit_type == 'top_ips_data' %}
  51. {% set rows = data.top_ips %}
  52. <div class="box"><h2>{{ _("Top IPs por datos") }}</h2></div>
  53. {% elif has_results %}
  54. {% set rows = data.results %}
  55. <div class="box"><h2>{{ _("Resultados") }}</h2></div>
  56. {% else %}
  57. <div class="box"><p>{{ _("No hay datos disponibles para esta auditoría.") }}</p></div>
  58. {% endif %}
  59. {% if rows is defined and rows %}
  60. <div class="box">
  61. <table class="table">
  62. <thead>
  63. <tr>{% for key in rows[0].keys() %}<th>{{ key }}</th>{% endfor %}</tr>
  64. </thead>
  65. <tbody>
  66. {% for row in rows %}
  67. <tr>{% for key, val in row.items() %}<td>{{ val }}</td>{% endfor %}</tr>
  68. {% endfor %}
  69. </tbody>
  70. </table>
  71. </div>
  72. {% endif %}
  73. {% endif %}
  74. </body>
  75. </html>