{% extends 'base.html.twig' %}

{% block title %}{{ ('documentType_' ~ type)|trans }}{% if archive %} | {% trans %}title_archives{% endtrans %}{% endif %}{% endblock %}
{% block subtitle %}
  {{ ('documentType_' ~ type)|trans }} {% if archive %} | {% trans %}title_archives{% endtrans %}{% else %}
  {% if documentTypeEntity.directory is not defined and documentTypeEntity.user is not defined %}
    {% if app.user.hasPermission(type ~ '_create')  %}
    <a href="{{ path('document_create', {type: type}) }}"><span class="badge rounded-pill bg-success"><i class="fa fa-plus"></i> {% trans %}button_create{% endtrans %}</span></a>{% endif %}
    {% endif %}
  {% endif %}
{% endblock %}

{% block body %}
  <div class="row">    
        <div class="col-12 col-md-5">{{form(searchForm)}}</div>
        <div class="col-12 col-md-3">
          {% if archive %}
          <a href="{{ path('document_list', {type: type}) }}" class="btn btn-info">{% trans %}button_go_to_not_archived{% endtrans %}</a>
          {% else %}
            <a href="{{ path('document_list_archives', {type: type}) }}" class="btn btn-primary">{% trans %}button_go_to_archived{% endtrans %}</a>
          {% endif %}
        </div>         
  </div>
  <div class="row">
    <div class="col-lg-8"><hr><p>{{ 'title_count'|trans }}: {{ count }}</p>
      {% include '_cells/documentTable.html.twig' with {'documents': pagination, 'notype': true } %}
    </div>

    {% if directory is defined and directory is not null %}
    <div class="col-lg-4">
      <h3>{% trans %}title_document_linked_to_directory{% endtrans %}:</h3>
      <hr>
      {% include '_cells/directoryCard.html.twig' with {'directory': directory} %} 
    </div>
    {% endif %}
    
  </div>
  <div class="row">
    {{ knp_pagination_render(pagination) }}
  </div>
{% endblock %}
