{#
 * Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
 *
 * This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 *  License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
#}
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}

{% block title %}{{ 'CustomField creation'|trans }}{% endblock title %}

{% block admin_content %}
    <h1>{{ 'CustomField creation'|trans }}</h1>

    <h2>{{ 'General informations'|trans }}</h2>
    {{ form_start(form) }}
    {{ form_row(form.name) }}
    {{ form_row(form.active) }}
    {{ form_row(form.slug) }}
    {% if form.customFieldsGroup is defined %}
    {{ form_row(form.customFieldsGroup) }}
    {% endif %}
    {{ form_row(form.ordering) }}
    {{ form_row(form.required) }}
    {% if form.options is not empty %}
    <h2>{{ 'Options'|trans }}</h2>
    {% for option in form.options %}
        {{ form_row(option) }}
    {% endfor %}
    {% endif %}
    {{ form_row(form.submit, {'attr': { 'class': 'btn btn-create' } } ) }}
    {{ form_end(form) }}

    <ul class="record_actions">
    <li>
        {% if entity.customFieldsGroup is not null %}
        <a href="{{ path('customfieldsgroup_show', { 'id': entity.customFieldsGroup.id }) }}" class="btn btn-reset">
            {{ 'Back to the group'|trans }}
        </a>
        {% else %}
        <a href="{{ path('customfieldsgroup') }}" class="btn btn-reset">
            {{ 'Back to the list'|trans }}
        </a>
        {% endif %}
    </li>
</ul>
{% endblock %}
