{% if is_fragment %}
  {% extends "core/base_fragment.jinja" %}
{% else %}
  {% extends "core/base.jinja" %}
{% endif %}

{% from "core/macros.jinja" import user_mini_profile, paginate_htmx with context %}


{% block title %}
  {% trans %}Search user{% endtrans %}
{% endblock %}

{% block content %}
  {% if paginator.count > 0 %}
    <h2>{% trans %}Results{% endtrans %}</h2>
    <div class="matmat_results">
      {% for user in object_list %}
        <div class="matmat_user">
          <a href="{{ url("core:user_profile", user_id=user.id) }}">
            {{ user_mini_profile(user) }}
          </a>
        </div>

      {% endfor %}
    </div>
    {% if page_obj.has_other_pages() %}
      {{ paginate_htmx(page_obj, paginator) }}
    {% endif %}
    <hr>
  {% endif %}
  <h2>{% trans %}Search user{% endtrans %}</h2>
  <form action="{{ url('matmat:search') }}" method="get">
    {{ form.non_field_errors() }}
    <fieldset class="fields-centered">
      {% for field in form %}
        <div>
          {{ field.label_tag() }}
          {{ field }}
          {{ field.errors }}
        </div>
      {% endfor %}
    </fieldset>
    <div class="fields-centered">
      <input class="btn btn-blue" type="submit" value="{% trans %}Search{% endtrans %}" />
    </div>
  </form>
{% endblock %}
