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

{% block title %}
  {% trans %}Invoices call{% endtrans %}
{% endblock %}

{% block notifications %}{# Notifications are moved below #}{% endblock %}

{% block content %}
  <h3>{% trans date=start_date|date("F Y") %}Invoices call for {{ date }}{% endtrans %}</h3>
  <form method="get" action="">
    <label for="id_form_other_month">{% trans %}Choose another month: {% endtrans %}</label>
    <select name="month" id="id_form_other_month">
      {% for m in months %}
        <option value="{{ m|date("Y-m") }}">{{ m|date("Y-m") }}</option>
      {% endfor %}
    </select>
    <input type="submit" value="{% trans %}Go{% endtrans %}" />
  </form>

  <br>
  <p>{% trans %}CB Payments{% endtrans %} : {{ sum_cb }} €</p>
  <br>

  {% include "core/base/notifications.jinja" %}

  <form method="post" action="">
    {% csrf_token %}
    <table>
      <thead>
        <tr>
          <td>{% trans %}Club{% endtrans %}</td>
          <td>{% trans %}Sum{% endtrans %}</td>
          <td>{% trans %}Validated{% endtrans %}</td>
        </tr>
      </thead>
      <tbody>
        {% for invoice in invoices %}
          <tr>
            <td>{{ invoice.club__name }}</td>
            <td>{{ "%.2f"|format(invoice.selling_sum) }} €</td>
            <td>
              {{ form[invoice.club_id|string] }}
            </td>
          </tr>
        {% endfor %}
      </tbody>
    </table>
    <input type="hidden" name="month" value="{{ start_date|date('Y-m') }}">
    <button type="submit">{% trans %}Save{% endtrans %}</button>
  </form>
{% endblock %}