{% extends "@ChillPerson/AccompanyingCourse/layout.html.twig"  %}

{% set activeRouteKey = '' %}

{% block title %}
	{# {{ 'Editing document for %name%'|trans({ '%name%': accompanyingCourse|chill_entity_render_string } ) }} #}
{% endblock %}
{% block content %}

	<h1>{{ 'Edit Document' | trans }}</h1>

	{{ form_errors(form) }}

	{{ form_start(form) }}

	{{ form_row(form.title) }}
	{{ form_row(form.date) }}
	{{ form_row(form.category) }}
	{{ form_row(form.description) }}
	{{ form_row(form.object, { 'label': 'Document', 'existing': document.object }) }}

	<ul class="record_actions sticky-form-buttons">
		<li class="cancel">
			<a href="{{ chill_return_path_or('chill_docstore_generic-doc_by-period_index', {'id': accompanyingCourse.id}) }}" class="btn btn-cancel">
				{{ 'Back to the list' | trans }}
			</a>
		</li>
        {% if is_granted('CHILL_ACCOMPANYING_COURSE_DOCUMENT_DELETE', document) %}
            <li class="delete">
                <a href="{{ chill_return_path_or('chill_docstore_accompanying_course_document_delete', {'course': accompanyingCourse.id, 'id': document.id}) }}" class="btn btn-delete"></a>
            </li>
        {% endif %}
        <li class="edit">
            <button class="btn btn-save">{{ 'Save'|trans }}</button>
		</li>
	</ul>

	{{ form_end(form) }}


{% endblock %}

{% block js %}
	{{ parent() }}
	{{ encore_entry_script_tags('mod_async_upload') }}
{% endblock %}

{% block css %}
    {{ parent() }}
	{{ encore_entry_link_tags('mod_async_upload') }}
{% endblock %}
