{% if calendar.documents|length > 0 %}

{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}

<div class="accompanying-course-work">
    <table class="obj-res-eval my-3">
        <thead>
        <th class="eval">
            <h4 class="title_label">{{ 'chill_calendar.Documents'|trans }}</h4>
        </th>
        </thead>
        <tbody>
        {% for d in calendar.documents %}
            {% if is_granted('CHILL_CALENDAR_DOC_SEE', d) %}
                <tr>
                    <td class="eval">
                        <ul class="eval_title">
                            <li>
                                <div class="row">
                                    <div class="col text-start">
                                        {{ d.storedObject.title }}
                                    </div>
                                    {% if d.dateTimeVersion < d.calendar.dateTimeVersion %}
                                    <div class="col text-start">
                                        <span class="badge bg-danger">{{ 'chill_calendar.Document outdated'|trans }}</span>
                                    </div>
                                    {% endif %}
                                    <div class="col col-lg-4 text-end">
                                        <ul class="record_actions">
                                            <li>
                                                {{ d.storedObject|chill_document_button_group(d.storedObject.title, is_granted('CHILL_CALENDAR_DOC_EDIT', d), {'small': true}) }}
                                            </li>
                                            <li>
                                                <a href="{{ chill_path_add_return_path('chill_calendar_calendardoc_edit', {id: d.id}) }}" class="btn btn-sm btn-edit"></a>
                                            </li>
                                            <li>
                                                <a href="{{ chill_path_add_return_path('chill_calendar_calendardoc_delete', {id: d.id}) }}" class="btn btn-sm btn-delete"></a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </td>
                </tr>
            {% endif %}
        {% endfor %}
        </tbody>
    </table>
</div>
{% endif %}
