{% extends "main/base.html" %}
{% load i18n static %}
{% load main_extras account_extras transaction_extras statement_extras %}
{% block title %}
  {% translate "Search" %} – Nummi
{% endblock title %}
{% block link %}
  {{ block.super }}
  {% css "main/css/form.css" %}
  {% css "main/css/table.css" %}
{% endblock link %}
{% block body %}
  <h2>{% translate "Search" %}</h2>
  <form method="post" action="{% url "search" %}">
    {% csrf_token %}
    {{ form }}
  </form>
  {% if accounts %}
    <section>
      <h3>{% translate "Accounts" %}</h3>
      <div class="split">{% account_table accounts search=True %}</div>
    </section>
  {% endif %}
  {% if statements %}
    <section>
      <h3>{% translate "Statements" %}</h3>
      {% statement_table statements %}
    </section>
  {% endif %}
  {% if categories %}
    <section>
      <h3>{% translate "Categories" %}</h3>
      <p>
        {% for cat in categories %}
          <a class="category" href="{{ cat.get_absolute_url }}">{{ cat.icon|remix }}{{ cat }}</a>
        {% endfor %}
      </p>
    </section>
  {% endif %}
  {% if transactions %}
    <section>
      <h3>{% translate "Transactions" %}</h3>
      {% url_get "transactions" search=search as t_url %}
      <p>
        <a class="big-link" href="{{ t_url }}">{{ "list-check"|remixnl }}{% translate "Show all transactions" %}</a>
      </p>
      {% transaction_table transactions n_max=8 transactions_url=t_url %}
    </section>
  {% endif %}
  {% if invoices %}
    <section>
      <h3>{% translate "Invoices" %}</h3>
      {% invoice_table invoices=invoices %}
    </section>
  {% endif %}
  {% if not accounts and not categories and not transactions and not invoices %}
    <p>{% translate "No results found." %}</p>
  {% endif %}
{% endblock body %}
