feat: add the house manager questionnaire per travel and compact the questionnaire layout
This commit is contained in:
1 parent
d760ed3cdf
commit
bfef08b519
50 files changed
+2763
-180
No files matched your search
@@ -252,6 +252,158 @@
|
||||
</div>
|
||||
{%- 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 -%}
|
||||
<div{% with { attr: row_attr } %}{{ block('attributes') }}{% endwith %}>
|
||||
<div class="sm:flex sm:items-start sm:justify-between sm:gap-x-6">
|
||||
{{- form_label(form, null, { label_attr: { class: 'sm:pb-0 sm:pt-1.5' } }) -}}
|
||||
{{- form_widget(form) -}}
|
||||
</div>
|
||||
{{- form_errors(form) -}}
|
||||
{{- form_help(form) -}}
|
||||
</div>
|
||||
{%- endblock questionnaire_inline_choice_row -%}
|
||||
|
||||
{%- block questionnaire_inline_choice_widget -%}
|
||||
<div class="flex shrink-0 flex-wrap gap-2" role="radiogroup">
|
||||
{%- for child in form -%}
|
||||
<label class="cursor-pointer">
|
||||
{{- form_widget(child, { attr: { class: 'peer sr-only' } }) -}}
|
||||
<span class="{{ html_classes('flex min-w-16 items-center justify-center rounded-md px-3 py-1.5 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-500 text-red-500': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
|
||||
{{- child.vars.label -}}
|
||||
</span>
|
||||
</label>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
{%- 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 -%}
|
||||
<div class="questionnaire-pick">
|
||||
{{- block('questionnaire_pick_toggle') -}}
|
||||
<div class="questionnaire-pick__body ml-2 border-l-2 border-gray-200 pt-2 pb-1 pl-4">
|
||||
<div class="flex flex-col gap-y-2">
|
||||
{%- for child in form|filter(child => child.vars.name != 'picked') -%}
|
||||
{{- form_row(child) -}}
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%- 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' -%}
|
||||
<div class="questionnaire-pick sm:flex sm:items-start sm:gap-x-4">
|
||||
{{- block('questionnaire_pick_toggle') -}}
|
||||
<div class="questionnaire-pick__body pt-2 sm:pt-0">
|
||||
<div class="flex flex-wrap items-center gap-x-4 gap-y-2 text-sm">
|
||||
{%- for child in form|filter(child => child.vars.name != 'picked') -%}
|
||||
{{- block('questionnaire_pick_number') -}}
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
{{- block('questionnaire_pick_errors') -}}
|
||||
</div>
|
||||
</div>
|
||||
{%- 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' -%}
|
||||
<div class="questionnaire-pick sm:flex sm:items-start sm:gap-x-4">
|
||||
{{- block('questionnaire_pick_toggle') -}}
|
||||
<div class="questionnaire-pick__body min-w-0 pt-2 sm:pt-0">
|
||||
<div class="flex flex-col gap-y-2">
|
||||
<div class="flex flex-wrap items-center gap-x-2 text-sm">
|
||||
{%- with { child: form.days } -%}{{- block('questionnaire_pick_number') -}}{%- endwith -%}
|
||||
<span class="font-bold" aria-hidden="true">×</span>
|
||||
{%- with { child: form.hours_per_day } -%}{{- block('questionnaire_pick_number') -}}{%- endwith -%}
|
||||
</div>
|
||||
<div>
|
||||
<p class="pb-1 text-sm text-gray-700">{{ form.dates.vars.label }}</p>
|
||||
{{- form_widget(form.dates) -}}
|
||||
</div>
|
||||
</div>
|
||||
{{- block('questionnaire_pick_errors') -}}
|
||||
</div>
|
||||
</div>
|
||||
{%- 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 -%}
|
||||
<div class="questionnaire-pick__head {{ head_class|default('') }}">
|
||||
<label for="{{ form.picked.vars.id }}"
|
||||
class="{{ html_classes('flex cursor-pointer select-none items-center gap-x-3 rounded-md px-3 py-1.5 text-sm ring-1 ring-inset transition-colors hover:bg-gray-100 has-[:checked]:bg-primary/10 has-[:checked]:ring-primary', { 'ring-red-500': errors|length, 'ring-gray-200': not errors|length }) }}">
|
||||
{{- form_widget(form.picked) -}}
|
||||
<span class="text-gray-900">{{ form.picked.vars.label }}</span>
|
||||
</label>
|
||||
{{- form_errors(form) -}}
|
||||
</div>
|
||||
{%- endblock questionnaire_pick_toggle -%}
|
||||
|
||||
{# One number of a pick, its input before its label: "[15] Teilnehmende je Guiding". Expects `child`. #}
|
||||
{%- block questionnaire_pick_number -%}
|
||||
<label class="flex items-center gap-x-2">
|
||||
<span class="w-20">{{- form_widget(child) -}}</span>
|
||||
<span class="{{ html_classes({ 'text-red-500': child.vars.errors|length, 'text-gray-700': not child.vars.errors|length }) }}">{{ child.vars.label }}</span>
|
||||
</label>
|
||||
{%- 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 -%}
|
||||
<div class="flex flex-wrap gap-1.5">
|
||||
{%- for child in form -%}
|
||||
<label class="cursor-pointer">
|
||||
<input type="checkbox" id="{{ child.vars.id }}" name="{{ child.vars.full_name }}" value="{{ child.vars.value }}" class="peer sr-only"{% if child.vars.checked %} checked="checked"{% endif %}>
|
||||
<span class="{{ html_classes('flex items-center rounded-md px-2 py-1 text-xs ring-1 ring-inset peer-checked:bg-primary peer-checked:text-white peer-checked:ring-primary peer-focus-visible:ring-2', { 'ring-red-500 text-red-500': errors|length, 'ring-gray-300 text-gray-900': not errors|length }) }}">
|
||||
{{- child.vars.label -}}
|
||||
</span>
|
||||
</label>
|
||||
{%- endfor -%}
|
||||
</div>
|
||||
{%- endblock questionnaire_days_widget -%}
|
||||
|
||||
{# A teamer or programme widget's picks, stacked. #}
|
||||
{%- block teamer_guidings_widget -%}
|
||||
<div class="flex flex-col gap-y-2" {{ block('widget_container_attributes') }}>
|
||||
{%- for child in form -%}
|
||||
{{- form_row(child) -}}
|
||||
{%- endfor -%}
|
||||
{%- if form is empty -%}
|
||||
<p class="text-sm text-gray-500">Für diese Reise sind keine Teamer:innen eingeteilt.</p>
|
||||
{%- endif -%}
|
||||
</div>
|
||||
{%- 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 -%}
|
||||
<div class="grid grid-cols-3 gap-x-1">
|
||||
{{ form_widget(form.children['day']) }}
|
||||
|
||||
Reference in new issue
Block a user