{% extends "core/base.jinja" %}

{% block title %}
  {% trans %}UE comment moderation{% endtrans %}
{% endblock title %}

{% block content %}
  {{ form.errors }}
  <table>
    <thead>
      <tr>
        <td>{% trans %}UE{% endtrans %}</td>
        <td>{% trans %}Comment{% endtrans %}</td>
        <td>{% trans %}Reason{% endtrans %}</td>
        <td>{% trans %}Action{% endtrans %}</td>
      </tr>
    </thead>
    <tbody>
      {% set queryset = form.accepted_reports.field.queryset %}
      {% for widget in form.accepted_reports.subwidgets %}
        {% set report = queryset.get(id=widget.data.value.value) %}
        <form action="{{ url('pedagogy:moderation') }}" method="post" enctype="multipart/form-data">
          {% csrf_token %}
          <tr>
            <td><a href="{{ url('pedagogy:ue_detail', ue_id=report.comment.ue_id) }}#{{ report.comment.ue_id }}">{{ report.comment.ue }}</a></td>
            <td>{{ report.comment.comment|markdown }}</td>
            <td>{{ report.reason|markdown }}</td>
            <td>
              <button name="accepted_reports" type="submit" value="{{ report.id }}">{% trans %}Delete comment{% endtrans %}</button>
              <button name="denied_reports" type="submit" value="{{ report.id }}">{% trans %}Delete report{% endtrans %}</button>
            </td>
          </tr>
        </form>
      {% endfor %}
    </tbody>
  </table>
{% endblock content %}
