{% extends "@AdminLTE/layout/form-theme.html.twig" %}

{# Adds the help icon, including a link to the documentation #}
{% block form_label %}
    {% if form.vars.docu_chapter is defined and form.vars.docu_chapter is not empty %}
        <a href="{{ form.vars.docu_chapter|docu_link }}" target="_blank"><i class="{{ 'help'|icon }}"></i></a>
    {% endif %}
    {{ parent() }}
{% endblock form_label %}

{% block daterange_widget %}
    <div class="input-group">
        <div class="input-group-addon">
            <i class="far fa-calendar-alt"></i>
        </div>

        {% set attr = attr|merge({'data-daterangepickerenable':'on'}) %}

        {{ block('form_widget_simple') }}
    </div>
{% endblock daterange_widget %}

{% block datetime_widget -%}
    {%- if widget == 'single_text' -%}
        <div class="input-group">
            <div class="input-group-addon">
                <a href="#" onclick="$('#{{ id }}').val(moment().format('{{ attr['data-format'] }}')).trigger('change')"><i class="fa fa-calendar-alt"></i></a>
            </div>
            {{ block('form_widget_simple') }}
        </div>
    {%- else -%}
        {{ block('form_widget_simple') }}
    {%- endif -%}
{%- endblock datetime_widget %}

{% block text_widget -%}
    {% if icon is not empty %}
    <div class="input-group">
        <div class="input-group-addon">
            <i class="{{ icon|icon }}"></i>
        </div>
        {{ block('form_widget_simple') }}
    </div>
    {% else %}
        {{ block('form_widget_simple') }}
    {% endif %}
{%- endblock text_widget %}
