{% extends "online/base.html" %}
{% block title %}Reportes{% endblock %}
{% block content %}
<header><p class="eyebrow">MODERACIÓN Y SOPORTE</p><h1>Reportes al equipo</h1><p>Informa de abuso, trampas, errores, privacidad o pagos. Explica hechos concretos y no publiques datos personales innecesarios.</p></header>
<section class="server-card" aria-labelledby="new-report-title">
  <h2 id="new-report-title">Enviar un reporte</h2>
  <form method="post" class="server-form">
    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
    <label for="category">Categoría</label>
    <select id="category" name="category">{% for key, label in REPORT_CATEGORIES.items() %}<option value="{{ key }}">{{ label }}</option>{% endfor %}</select>
    <label for="game-id">Universo relacionado</label>
    <select id="game-id" name="game_id"><option value="0">Ninguno o asunto general</option>{% for item in memberships %}<option value="{{ item.game_id }}">{{ item.game_name }}</option>{% endfor %}</select>
    <label for="target-account">Jugador relacionado</label>
    <select id="target-account" name="target_account_id"><option value="0">Ninguno</option>{% for target in targets %}<option value="{{ target.account_id }}">{{ target.username }} — {{ target.empire_name }}</option>{% endfor %}</select>
    <label for="subject">Asunto</label>
    <input id="subject" name="subject" minlength="5" maxlength="120" required>
    <label for="description">Descripción detallada</label>
    <textarea id="description" name="description" minlength="20" maxlength="5000" required></textarea>
    <label for="evidence">Evidencias o referencias</label>
    <textarea id="evidence" name="evidence" maxlength="2000"></textarea>
    <button class="button button-primary" type="submit">Enviar reporte</button>
  </form>
</section>
<section aria-labelledby="my-reports-title">
  <h2 id="my-reports-title">Mis reportes</h2>
  {% if reports %}<div class="server-table-wrap"><table class="server-table">
    <thead><tr><th>Expediente</th><th>Asunto</th><th>Estado</th><th>Actualizado</th></tr></thead>
    <tbody>{% for report in reports %}<tr>
      <td><a href="{{ url_for('online_report_detail', report_id=report.id) }}">#{{ report.id }}</a></td>
      <td>{{ report.subject }}</td><td>{{ report.status }}</td><td>{{ report.updated_at|date_label }}</td>
    </tr>{% endfor %}</tbody>
  </table></div>{% else %}<p>No has enviado reportes.</p>{% endif %}
</section>
{% endblock %}
