{% load dict_key_extras %}

<table class="table table-bordered table-striped table-hover">
    <thead>
        {% if data.menu %}
            <th> <input type="checkbox" id="select_all_{{group}}" onchange="selectAll(this, '{{group}}')"> </th>
        {% endif %}
        <th>Name</th>
        <th>Role</th>
        {% if data.usernames %}
            <th>User</th>
        {% endif %}
        <th>Actions</th>
    </thead>
    <tbody>
        {% for data_loaded in objects %}
            {% cycle 'even' '' as rowcolors silent %}
            <tr class="{{ rowcolors }}" objectid="{{data_loaded.form.id}}">
                {% if data.menu %}
                <td id="actionCheckbox_{{forloop.counter}}">
                    <input type="checkbox" id={{data_loaded.form.id}} name={{group}}>
                </td>
                {% endif %}
                <td>
                    {{ data_loaded.form.name }}
                </td>
                <td>
                    {{ data_loaded.role }}
                </td>
                {% if data.usernames %}
                <td>
                    {% with key=data_loaded.form.user %}
                      {{ data.usernames|get:key }}
                    {% endwith %}
                </td>
                {% endif %}
                <td>
                    {% if come_from_admin %}
                        <a class="btn btn-secondary view-form-btn"
                           href="{% url 'admin:core_curate_view_form' data_loaded.form.id %}">
                            <i class="far fa-file-alt"></i> View
                        </a>
                    {% else %}
                        <a class="btn btn-secondary view-form-btn"
                           href="{% url 'core_curate_view_form' data_loaded.form.id %}">
                            <i class="far fa-file-alt"></i> View
                        </a>
                    {% endif %}
                    <a class="btn btn-secondary edit-form-btn" href="{% url 'core_curate_enter_data' data_loaded.form.id %}">
                        <i class="fas fa-edit"></i> Edit
                    </a>


                    <a class="btn btn-secondary change-owner-btn">
                        <i class="fas fa-user-circle"></i> Change Owner
                    </a>
                    <button class="btn btn-danger delete-document-btn">
                        <i class="fas fa-trash"></i> Delete
                    </button>
                </td>
            </tr>
        {% endfor %}
    </tbody>
</table>