{% 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 -%} {# Muted and smaller than the label, so a help text never outweighs the field it explains. #} {%- block form_help -%} {%- set help_attr = help_attr|merge({'class': (help_attr.class|default('') ~ ' pt-1 text-sm text-gray-500')|trim}) -%} {{ parent() }} {%- endblock form_help -%} {%- 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-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|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-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|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-sm text-primary')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-red-500 text-red-500 ring-red-500 focus:ring-red-500' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' border-gray-300 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 checkbox_row %}
{{ form_widget(form) }}
{{- form_errors(form) -}} {{- form_help(form) -}}
{% endblock %} {%- 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-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|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 -%} {%- for child in form %}
{{- form_widget(child) -}}
{% endfor -%} {%- endblock choice_widget_expanded -%} {# # The boarding points of a destination, as a radio list. Expanded rather than a dropdown # because a row carries three things - the town, the street and the departure time - and two # towns can repeat within one travel, where only the street tells them apart. App\Form\AssignmentType # puts the latter two on the choice as data attributes. #} {%- block pickup_choice_widget -%} {%- if choices is empty -%} {# no destination chosen yet, or one without boarding points - the caller says which #}

{{ attr['data-empty-text']|default('Keine Zustiege verfügbar.') }}

{%- elseif expanded -%} {# 82% of destinations have seven boarding points or fewer and fit without scrolling; the longest hold fifteen, which would otherwise stretch the form past the fields beside it #}
{%- for child in form %} {%- set departure = child.vars.attr['data-departure']|default('') -%} {%- set street = child.vars.attr['data-street']|default('') -%}
{%- if street is not empty %}

{{ street }}

{%- endif %}
{{- form_widget(child) -}}
{% endfor -%}
{%- else -%} {{- block('choice_widget_collapsed') -}} {%- endif -%} {%- endblock pickup_choice_widget -%} {# # A section of a questionnaire (App\Form\QuestionnaireType): its title and its questions. The # questions' rows carry data-question-key and, when conditional, data-show-if, which # assets/controllers/questionnaire_controller.js reads to show and hide them. #} {%- block questionnaire_section_row -%}
{%- if label is not same as(false) -%} {{ label }} {%- endif -%}
{%- for child in form -%} {{- form_row(child) -}} {%- endfor -%}
{%- endblock questionnaire_section_row -%} {# A 1-5 rating as a row of buttons, the radios themselves hidden. #} {%- block questionnaire_rating_widget -%}
{%- for child in form -%} {%- endfor -%}
{%- endblock questionnaire_rating_widget -%} {%- 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-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|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-900 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 %} {%- block autocomplete_widget -%} {%- set attr = attr|merge({'class': (attr.class|default('') ~ ' autocomplete-input block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-xs ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-inset text-sm')|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 -%}
{{ icon('search', 'w-4 h-4 text-gray-700') }}
{%- endblock autocomplete_widget -%} {%- block multiselect_widget -%}
{{ icon('dots', 'w-4 h-4 mt-2') }}
{%- endblock multiselect_widget -%}