{% extends 'admin/base.html.twig' %}

{% form_theme form 'admin/form/custom_theme.html.twig' %}

{% block content %}

    {% set languages = global_service.languages %}

    <div class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <div class="card">
                        <div class="card-header">
                            <h4 class="card-title">{{ title }}</h4>
                        </div>
                        <div class="card-body">
                            {{ form_start(form) }}

                            <div class="row">
                                <div class="col-md-4">
                                    {{ form_row(form.is_active) }}
                                </div>
                                <div class="col-md-8">
                                    {{ form_row(form.url) }}
                                </div>
                            </div>

                            {% for language in languages %}
                                <div class="card">
                                    <div class="card-header">
                                        <h5 class="form-lang-header">
                                            <a href="#collapse-{{ language.code }}" data-toggle="collapse">
                                                <span class="language left lang-{{ language.code }}"></span>
                                                {{ language.title }}
                                            </a>
                                        </h5>
                                    </div>

                                    <div id="collapse-{{ language.code }}" class="collapse {% if  language.code == 'ru' or language.code == 'en' %}show{% else %}hide{% endif %}">
                                        <div class="card-body">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    {{ form_row(form["lang_#{language.id}_title"]) }}
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    {{ form_row(form["lang_#{language.id}_text"]) }}
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    {{ form_row(form["lang_#{language.id}_meta_keywords"]) }}
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    {{ form_row(form["lang_#{language.id}_meta_description"]) }}
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            {% endfor %}

                            <p class="text-center">
                                <button type="submit" class="btn btn-primary btn-fill">Сохранить</button>
                            </p>

                            {{ form_end(form) }}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}