<h1>
    {{ "Update activity"|trans }}
</h1>
<h2 class="badge-title mb-5">
    <span class="title_label"></span>
    <span class="title_action">
        {{ entity.type.name | localize_translatable_string }}
    </span>
</h2>

{{ form_start(edit_form) }}
{{ form_errors(edit_form) }}

{%- if edit_form.emergency is defined -%}
    {{ form_row(edit_form.emergency) }}
{% endif %}

{%- if edit_form.sentReceived is defined -%}
    {{ form_row(edit_form.sentReceived) }}
{% endif %}

{%- if edit_form.user is defined -%}
    {{ form_row(edit_form.user) }}
{% endif %}

{%- if edit_form.scope is defined -%}
    {{ form_row(edit_form.scope) }}
{% endif %}

{%- if edit_form.socialIssues is defined -%}
    {{ form_row(edit_form.socialIssues) }}
{% endif %}

{%- if edit_form.socialActions is defined -%}
    {{ form_row(edit_form.socialActions) }}
{% endif %}

{%- if edit_form.socialIssues is defined or edit_form.socialActions is defined -%}
<div id="social-issues-acc"></div>
{% endif %}

{%- if edit_form.reasons is defined -%}
    {{ form_row(edit_form.reasons) }}
{% endif %}

{%- if edit_form.persons is defined or edit_form.thirdParties is defined or edit_form.users is defined -%}
    <h2 class="chill-blue">{{ 'Concerned groups'|trans }}</h2>

    {%- if edit_form.persons is defined -%}
        {{ form_widget(edit_form.persons) }}
    {% endif %}
    {%- if edit_form.thirdParties is defined -%}
        {{ form_widget(edit_form.thirdParties) }}
    {% endif %}
    {%- if edit_form.users is defined -%}
        {{ form_widget(edit_form.users) }}
    {% endif %}

    <div id="add-persons"></div>
{% endif %}


<h2 class="chill-blue">{{ 'Activity data'|trans }}</h2>

{%- if edit_form.date is defined -%}
    {{ form_row(edit_form.date) }}
{% endif %}

{%- if edit_form.location is defined -%}
    {{ form_row(edit_form.location) }}
    <div id="location"></div>
{% endif %}

{%- if edit_form.durationTime is defined -%}
    {{ form_row(edit_form.durationTime) }}
{% endif %}

{%- if edit_form.travelTime is defined -%}
    {{ form_row(edit_form.travelTime) }}
{% endif %}

{%- if edit_form.comment is defined -%}
    {{ form_row(edit_form.comment) }}
{% endif %}

{%- if edit_form.privateComment is defined -%}
    {{ form_row(edit_form.privateComment) }}
{% endif %}

{%- if edit_form.attendee is defined -%}
    {{ form_row(edit_form.attendee) }}
{% endif %}

{%- if edit_form.documents is defined -%}
    {{ form_label(edit_form.documents) }}
    {{ form_errors(edit_form.documents) }}
    {{ form_widget(edit_form.documents) }}
    <div data-docgen-template-picker="data-docgen-template-picker" data-entity-class="Chill\ActivityBundle\Entity\Activity" data-entity-id="{{ entity.id }}"></div>
{% endif %}


{% set person_id = null %}
{% if entity.person %}
    {% set person_id = entity.person.id %}
{% endif %}

{% set accompanying_course_id = null %}
{% if accompanyingCourse %}
    {% set accompanying_course_id = accompanyingCourse.id %}
{% endif %}

<ul class="record_actions sticky-form-buttons">
    <li class="cancel">
        <a href="{{ path('chill_activity_activity_show', { 'id': entity.id, 'person_id': person_id, 'accompanying_period_id': accompanying_course_id  } ) }}" class="btn btn-cancel">
            {{ 'Cancel'|trans }}
        </a>
    </li>
    <li>
        <button class="btn btn-update" type="submit">{{ 'Save'|trans }}</button>
    </li>
</ul>

{{ form_end(edit_form) }}
{# {{ form(delete_form) }} #}

{% block js %}
    {{ encore_entry_script_tags('mod_pickentity_type') }}
{% endblock %}

{% block css %}
    {{ encore_entry_link_tags('mod_pickentity_type') }}
{% endblock %}
