{% extends 'Admin/layout.html.twig' %}
{%- import 'Admin/Form/macros.html.twig' as m -%}

{% block body %}
    <header>
        <ul class="btns">
            <li class="btns-back">
                {{ m.step_back() }}
            </li>
            <li>
                <button class="btn btn-save" form="form-mediaadd">
                    {{ 'action.save'|trans({}, 'action') }}
                </button>
            </li>
        </ul>

        {% if 'pdf' == type %}
            {% set type_readable_add = 'un PDF' %}
            {% set type_readable_edit = 'le PDF' %}
        {% elseif 'picture' == type %}
            {% set type_readable_add = 'une image' %}
            {% set type_readable_edit = 'lʼimage' %}
        {% elseif 'video' == type %}
            {% set type_readable_add = 'une vidéo' %}
            {% set type_readable_edit = 'la vidéo' %}
        {% endif %}
        <h1>
            {% if form.title.vars.value is empty %}
                Ajouter {{ type_readable_add}}
            {% else %}
                Modifier {{ type_readable_edit }} <em>{{ form.title.vars.value }}</em>
            {% endif %}
        </h1>
    </header>

    {{ form(form, {'attr': {'id': 'form-mediaadd'}}) }}

    <ul class="btns">
        <li>
            <button class="btn btn-save" form="form-mediaadd">
                {{ 'action.save'|trans({}, 'action') }}
            </button>
        </li>
    </ul>
{% endblock %}
