{#
 # ---------------------------------------------------------------------
 # Formcreator is a plugin which allows creation of custom forms of
 # easy access.
 # ---------------------------------------------------------------------
 # LICENSE
 #
 # This file is part of Formcreator.
 #
 # Formcreator is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
 # (at your option) any later version.
 #
 # Formcreator 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 General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # along with Formcreator. If not, see <http://www.gnu.org/licenses/>.
 # ---------------------------------------------------------------------
 # @copyright Copyright © 2011 - 2021 Teclib'
 # @license   http://www.gnu.org/licenses/gpl.txt GPLv3+
 # @link      https://github.com/pluginsGLPI/formcreator/
 # @link      https://pluginsglpi.github.io/formcreator/
 # @link      http://plugins.glpi-project.org/#/plugin/formcreator
 # ---------------------------------------------------------------------
 #}

{% import 'components/form/fields_macros.html.twig' as fields %}

<div id="plugin_formcreator_form" class="asset plugin_formcreator_form_design" data-itemtype="{{ item.getType }}" data-id="{{ item.fields['id'] }}">
   {{ include('components/form/header.html.twig') }}
    <div class="card-body d-flex flex-wrap">
        <div class="col-12 col-xxl-{{ item_has_pictures ? '9' : '12' }} flex-column">
            <div class="d-flex flex-row flex-wrap flex-xl-nowrap">
                <div class="row flex-row align-items-start flex-grow-1">
                    <div class="row flex-row">
                        {{ fields.smallTitle(__('Condition to generate the target', 'formcreator')) }}

                        {{ fields.dropdownArrayField('show_rule', item.fields['show_rule'], item.getEnumShowrule(), '', { 'no_label': true, 'on_change': 'plugin_formcreator_toggleCondition(this);' }) }}
                        {% set conditions = call('PluginFormcreatorCondition::getConditionsFromItem', [item]) %}
                        {% for condition in conditions %}
                            {{ include('@formcreator/components/form/condition.html.twig') }}
                        {% endfor %}
                    </div> {# .row #}
                </div> {# .row #}
            </div> {# .flex-row #}
        </div>
    </div>
    {{ include('components/form/buttons.html.twig') }}
</div>
