<div class="accompanying-course-work">
    {% for w in works | slice(0,5) %}

        <a href="{%- if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w) -%}
            {{- chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) -}}
        {%- elseif is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_SEE', w) -%}
            {{- chill_path_add_return_path('chill_person_accompanying_period_work_show', { 'id': w.id }) -}}
        {%- else %}#{% endif -%}" class="dashboard-link" title="{{ 'crud.social_action.title_link'|trans }}">
        <div class="dashboard">
            <span class="title_label"></span>
            <span class="title_action"><span class="like-h3">{{ w.socialAction|chill_entity_render_string }}</span>

                <ul class="small_in_title columns mt-3">
                    <li>
                        <span class="item-key">{{ 'accompanying_course_work.start_date'|trans ~ ' : ' }}</span>
                        <b>{{ w.startDate|format_date('short') }}</b>
                    </li>
                    {% if w.endDate %}
                        <li>
                        <span class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
                        <b>{{ w.endDate|format_date('short') }}</b>
                    </li>
                    {% endif %}
                </ul>

                <ul class="small_in_title">
                    {% if w.handlingThierParty %}
                        <li>
                        <span class="item-key">{{ 'Thirdparty handling'|trans ~ ' : ' }}</span>
                        <span class="badge-thirdparty">{{ w.handlingThierParty|chill_entity_render_box }}</span>
                    </li>
                    {% endif %}
                    {% if w.referrers %}
                        <li>
                        <span class="item-key">{{ 'Referrers'|trans ~ ' : ' }}</span>
                        {% for rh in w.referrersHistoryCurrent %}
                            <span class="badge-user">{{ rh.user|chill_entity_render_box({'at_date': rh.startDate}) }}</span>
                        {% endfor %}
                            {% if w.referrers|length == 0 %}
                                <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
                            {% endif %}
                    </li>
                    {% endif %}
                    <li class="associated-persons">
                        <span class="item-key">{{ 'Participants'|trans ~ ' : ' }}</span>
                        {% for p in w.persons %}
                            <span class="badge-person">{{ p|chill_entity_render_box({'addAgeBadge': true}) }}</span>
                        {% endfor %}
                    </li>
                </ul>

                <ul class="list-content my-3">
                    <li class="social-issues">
                        {{ w.socialAction.issue|chill_entity_render_box }}
                    </li>
                </ul>

                <ul class="small_in_title mb-3 ps-0">
                    {% include '@ChillPerson/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig' with {} %}
                </ul>

                <div class="metadata text-end">
                    {% import '@ChillPerson/Macro/updatedBy.html.twig' as macro %}
                    {{ macro.updatedBy(w) }}
                </div>

            </span>
        </div>

        </a>
    {% endfor %}
</div>


