{% 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-700' %} {% 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 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%} {%- 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 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%} {%- 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-700 text-red-700 ring-red-700 focus:ring-red-700' }) -%} {% 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 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%} {%- 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 -%} {# # One questionnaire within a questionnaire form (App\Form\QuestionnaireType), which may hold # several: its title, its description and its sections. #} {%- block questionnaire_part_row -%}

{{ label }}

{%- if help is not empty -%}

{{ help|nl2br }}

{%- endif -%} {%- for child in form -%} {{- form_row(child) -}} {%- endfor -%}
{%- endblock questionnaire_part_row -%} {# # One bus ride of a per-bus-leg questionnaire (App\Form\QuestionnaireType): its title and its # sections. Its row carries data-question-key and data-show-if like a conditional question, so the # questionnaire Stimulus controller shows it only while the leg is chosen. #} {%- block questionnaire_leg_row -%}

{{ label }}

{%- for child in form -%} {{- form_row(child) -}} {%- endfor -%}
{%- endblock questionnaire_leg_row -%} {# # 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 questionnaire's radio or checkbox list: each answer a whole clickable row that lights up on # hover and stays marked once chosen, so it is plain where to click. Questionnaire-only; the # app's other choice lists keep choice_widget_expanded. #} {%- block questionnaire_choice_widget -%}
{%- for child in form -%} {%- endfor -%}
{%- endblock questionnaire_choice_widget -%} {# 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 -%} {# # A questionnaire radio question with short options ("Ja"/"Nein"): the question and a row of # answer buttons on one line, the radios themselves hidden. Stacked on narrow screens. # App\Form\QuestionnaireType picks it by the length of the option labels. #} {%- block questionnaire_inline_choice_row -%}
{{- form_label(form, null, { label_attr: { class: 'sm:pb-0 sm:pt-1.5' } }) -}} {{- form_widget(form) -}}
{{- form_errors(form) -}} {{- form_help(form) -}} {%- endblock questionnaire_inline_choice_row -%} {%- block questionnaire_inline_choice_widget -%}
{%- for child in form -%} {%- endfor -%}
{%- endblock questionnaire_inline_choice_widget -%} {# # A pick of the house manager questionnaire's widgets (App\Form\Questionnaire\AbstractPickType): # its checkbox, its errors, and the fields shown only while it is ticked. The element with # questionnaire-pick__body is hidden by assets/styles/components/questionnaire.css, so it must not # carry a display utility itself: utilities outrank that rule. Layout goes on an inner element. # # A teamer (or "Sonstiges") opens its fields indented below it... #} {%- block questionnaire_pick_row -%}
{{- block('questionnaire_pick_toggle') -}}
{%- for child in form|filter(child => child.vars.name != 'picked') -%} {{- form_row(child) -}} {%- endfor -%}
{%- endblock questionnaire_pick_row -%} {# ...a guiding type or programme item has its numbers on the same line... #} {%- block questionnaire_pick_inline_row -%} {%- set head_class = 'sm:w-72 sm:shrink-0' -%}
{{- block('questionnaire_pick_toggle') -}}
{%- for child in form|filter(child => child.vars.name != 'picked') -%} {{- block('questionnaire_pick_number') -}} {%- endfor -%}
{{- block('questionnaire_pick_errors') -}}
{%- endblock questionnaire_pick_inline_row -%} {# ...and a course type reads "[2] Tage × [3] Std. pro Tag", with the days it took place below. #} {%- block questionnaire_pick_course_row -%} {%- set head_class = 'sm:w-72 sm:shrink-0' -%}
{{- block('questionnaire_pick_toggle') -}}
{%- with { child: form.days } -%}{{- block('questionnaire_pick_number') -}}{%- endwith -%} {%- with { child: form.hours_per_day } -%}{{- block('questionnaire_pick_number') -}}{%- endwith -%}

{{ form.dates.vars.label }}

{{- form_widget(form.dates) -}}
{{- block('questionnaire_pick_errors') -}}
{%- endblock questionnaire_pick_course_row -%} {# # The pick's checkbox as a clickable row, and the pick's own errors ("mindestens ein ..."). The # head is what the CSS rule looks into; a row block with the fields beside it sets `head_class`. #} {%- block questionnaire_pick_toggle -%}
{{- form_errors(form) -}}
{%- endblock questionnaire_pick_toggle -%} {# One number of a pick, its input before its label: "[15] Teilnehmende je Guiding". Expects `child`. #} {%- block questionnaire_pick_number -%} {%- endblock questionnaire_pick_number -%} {# The errors of a pick's fields, under them rather than between them. #} {%- block questionnaire_pick_errors -%} {%- for child in form|filter(child => child.vars.name != 'picked') -%} {{- form_errors(child) -}} {%- endfor -%} {%- endblock questionnaire_pick_errors -%} {# The days of a travel to tick, as a row of small buttons, the checkboxes themselves hidden. #} {%- block questionnaire_days_widget -%}
{%- for child in form -%} {%- endfor -%}
{%- endblock questionnaire_days_widget -%} {# A teamer or programme widget's picks, stacked. #} {%- block teamer_guidings_widget -%}
{%- for child in form -%} {{- form_row(child) -}} {%- endfor -%} {%- if form is empty -%}

Für diese Reise sind keine Teamer:innen eingeteilt.

{%- endif -%}
{%- endblock teamer_guidings_widget -%} {%- block teamer_courses_widget -%} {{- block('teamer_guidings_widget') -}} {%- endblock teamer_courses_widget -%} {%- block programme_widget -%} {{- block('teamer_guidings_widget') -}} {%- endblock programme_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-700 placeholder-red-700 focus:ring-red-700' }) -%} {%- 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-700' %} {% 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 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder:text-red-700 focus:ring-red-700' }) -%} {% 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 ring-1 ring-inset ring-slate-500 focus:ring-2 focus:ring-inset text-sm')|trim }) -%} {%- if errors|length -%} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' ring-red-700 placeholder-red-700 focus:ring-red-700' }) -%} {% else %} {%- set attr = attr|merge({'class': attr.class|default('') ~ ' placeholder:text-slate-500 focus:ring-brand-bright' }) -%} {%- 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 -%}