{% use 'form_div_layout.html.twig' %} {%- block form_row -%} {%- set widget_attr = {} -%} {%- if help is not empty -%} {%- set widget_attr = {attr: {'aria-describedby': id ~"_help"}} -%} {%- endif -%} {{- form_label(form) -}} {{- form_widget(form, widget_attr) -}} {{- form_errors(form) -}} {{- form_help(form) -}} {%- endblock form_row -%} {%- block form_label -%} {% set class = 'block font-bold pb-2' %} {% if errors|length %} {% set class = class ~ ' text-red-500' %} {% endif %} {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ class)|trim}) %} {{ parent() }} {%- endblock form_label -%} {%- block form_errors -%} {%- if errors|length > 0 -%} {%- endif -%} {%- endblock form_errors -%} {%- block form_widget_simple -%} {%- set type = type|default('text') -%} {%- if type != 'hidden' -%} {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%} {%- endif -%} {%- if disabled is defined and disabled == true -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} {%- endif -%} {%- endif -%} {{ parent() }} {%- if disabled is defined and disabled == true -%} {%- endif -%} {%- endblock form_widget_simple -%} {%- block textarea_widget -%} {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%} {%- endif -%} {%- if disabled is defined and disabled == true -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} {%- endif -%} {{ parent() }} {%- if disabled is defined and disabled == true -%} {%- endif -%} {%- endblock textarea_widget -%} {%- block checkbox_widget -%} {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' h-4 w-4 rounded border-gray-300 text-primary')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 focus:ring-red-500' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' focus:ring-primary' }) -%} {%- endif -%} {%- if attr.disabled is defined and attr.disabled == true -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} {%- endif -%} {%- endblock checkbox_widget -%} {%- block choice_widget_collapsed -%} {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%} {%- endif -%} {%- if disabled is defined and disabled == true -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} {%- endif -%} {{ parent() }} {%- if disabled is defined and disabled == true -%} {%- endif -%} {%- endblock choice_widget_collapsed -%} {%- block choice_widget_expanded -%}
{% if form.vars.label %} {{ form.vars.label }} {% endif %}
{%- for child in form %}
{{- form_widget(child) -}}
{% endfor -%}
{%- endblock choice_widget_expanded -%} {%- block birthday_widget -%}
{{ form_widget(form.children['day']) }} {{ form_widget(form.children['month']) }} {{ form_widget(form.children['year']) }}
{%- endblock -%} {% block abbreviated_date_widget %} {%- set class = 'flex items-center space-x-1 ' ~ attr.class|default('') -%} {%- do form.setRendered -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} {%- endif -%}
{{ form_widget(form.month, { 'attr': attr })}} / {{ form_widget(form.year, { 'attr': attr })}}
{% endblock %} {%- block money_widget -%} {% set currency_class = 'absolute top-1/2 transform -translate-y-1/2 right-0 mr-2' %} {% if errors|length %} {% set currency_class = currency_class ~ ' text-red-500' %} {% else %} {% set currency_class = currency_class ~ ' text-gray-600' %} {% endif %}
{{ block('form_widget_simple') }}
{%- endblock money_widget -%} {%- block datepicker_widget -%} {%- set minDate = form.vars.min_date ? form.vars.min_date | date('Y-m-d') : null -%} {%- set maxDate = form.vars.max_date ? form.vars.max_date | date('Y-m-d') : null -%} {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-500 placeholder-red-500 focus:ring-red-500' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-gray-400 focus:ring-primary' }) -%} {%- endif -%} {%- if disabled is defined and disabled == true -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%} {%- endif -%}
{%- if disabled is defined and disabled == true -%} {%- endif -%} {%- endblock datepicker_widget %}