{% extends 'admin_base.html.twig' %}

{% block title %}WidgetForm{% endblock %}

{% block body %}
    <h1>{{ widget_form.name }}</h1>
    <div class="row">
        <div class="col-md-8">
            <div class="jumbotron">
                {% for input in form_input %}
                    <div class="form-group">
                        <label for="widget_form_{{ input.bitrix24Id }}">{{ input.text }}</label>  
                        <a href="{{ path('widget_form_input_edit', {'id': input.id, 'formId': widget_form.id}) }}">Изменить</a>
                        {% if input.type == 'text' %}
                            <input class="form-control" type="text" id="{{ input.bitrix24Id }}">
                        {% elseif input.type == 'phone' %}
                            <input class="form-control" type="text" data-controller="inputMask" id="{{ input.bitrix24Id }}">
                        {% elseif input.type == 'date' %}
                            <input class="form-control" type="text" data-controller="datePicker" id="{{ input.bitrix24Id }}">
                        {% elseif input.type == 'textarea' %}
                            <textarea class="form-control" id="{{ input.bitrix24Id }}"></textarea>
                        {% endif %}

                    </div>
                {% endfor %}
            </div>
        </div>
        <div class="col-md-4">
            <p>Добавить элемент</p>
            {{ include('widget_form/_form.html.twig', {'button_label': 'Добавить поле'}) }}
        </div>
    </div>
    <a href="{{ path('widget_form_index') }}">back to list</a>
{% endblock %}
