{% load i18n l10n fontawesome_5 %}
<div id="documents" class="card">
    <div class="card-header rlp-r">
        <div class="row">
            <div class="col-sm-6">
                <h5>
                    <span class="badge badge-light">{{obj.documents.count}}</span>
                    {% trans 'Documents' %}
                </h5>
            </div>
            <div class="col-sm-6">
                <div class="d-flex justify-content-end">
                    {% if is_default_member and is_entry_shared  %}
                    <button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
                        {% fa5_icon 'plus' %}
                        {% fa5_icon 'file' %}
                    </button>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
    <div class="card-body {% if tables_scrollable %}scroll-300{% endif %} p-2">
        <table class="table table-hover">
            <thead>
            <tr>
                <th scope="col">
                    {% trans 'Title' %}
                </th>
                <th scope="col">
                    {% trans 'Created on' %}
                </th>
                <th scope="col">
                    {% trans 'Comment' %}
                </th>
                <th class="w-10" scope="col">
                    <span class="float-right">
                        {% trans 'Action' %}
                    </span>
                </th>
            </tr>
            </thead>
            <tbody>
            {% for doc in obj.documents.all %}
            <tr>
                <td class="align-middle">
                    <a href="{% url 'compensation:acc:get-doc' obj.id doc.id %}">
                        {{ doc.title }}
                    </a>
                </td>
                <td class="align-middle">
                    {{ doc.date_of_creation }}
                </td>
                <td class="align-middle">
                    <div class="scroll-150">
                        {{ doc.comment }}
                    </div>
                </td>
                <td class="align-middle float-right">
                    {% if is_default_member and is_entry_shared  %}
                    <button data-form-url="{% url 'compensation:acc:edit-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Edit document' %}">
                        {% fa5_icon 'edit' %}
                    </button>
                    <button data-form-url="{% url 'compensation:acc:remove-doc' obj.id doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove document' %}">
                        {% fa5_icon 'trash' %}
                    </button>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
    </div>
</div>