{% extends "main/base.html" %}
{% load i18n static main_extras transaction_extras category history_extras %}
{% block link %}
  {{ block.super }}
  {% css "main/css/plot.css" %}
  {% css "main/css/table.css" %}
{% endblock link %}
{% block body %}
  <h2>
    {% block h2 %}
    {% endblock h2 %}
  </h2>
  {% history_pagination %}
  {% if account or category %}
    <p class="back">
      <a class="big-link"
         href="{% history_url year=year month=month clear=True %}">{{ "arrow-go-back"|remix }}{% translate "Back" %}</a>
      {% if account %}
        <a class="big-link" href="{% url "account" account.id %}">{{ account.icon|remix }}{{ account }}</a>
      {% endif %}
      {% if category %}
        <a class="big-link" href="{% url "category" category.id %}">{{ category.icon|remix }}{{ category }}</a>
      {% endif %}
    </p>
  {% endif %}
  {% if history %}
    <section>
      <h3>{% translate "History" %}</h3>
      {% include "history/plot.html" %}
    </section>
  {% endif %}
  {% if not category %}
    <section>
      <h3>{% translate "Categories" %}</h3>
      {% category_plot transactions month=month year=year %}
    </section>
  {% endif %}
  <section>
    <h3>{% translate "Transactions" %}</h3>
    {% if month %}
      {% url_get "transactions" start_date=month end_date=month|end_of_month category=category.id account=account.id as t_url %}
    {% elif year %}
      {% url_get "transactions" start_date=year end_date=year|end_of_year category=category.id account=account.id as t_url %}
    {% endif %}
    <p>
      <a class="big-link" href="{{ t_url }}">{{ "list-check"|remixnl }}{% translate "View all transactions" %}</a>
    </p>
    {% transaction_table transactions n_max=8 transactions_url=t_url %}
  </section>
  {% history_pagination %}
{% endblock body %}
