feat: render room assignment as radio buttons
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
</td>
|
||||
{% if choiceData %}
|
||||
<td class="border border-primary-bg p-2 align-top w-24 text-right whitespace-nowrap">
|
||||
{% if choiceData.price is not null %}
|
||||
{% if choiceData.price is defined and choiceData.price is not null %}
|
||||
{{ choiceData.price | format_currency('EUR') }}
|
||||
{% endif %}
|
||||
</td>
|
||||
@@ -84,3 +84,28 @@
|
||||
{% endfor -%}
|
||||
</table>
|
||||
{%- endblock choice_widget_expanded -%}
|
||||
|
||||
{# Room assignment field - simple scalar choices (label => id), no price column #}
|
||||
{%- block _participant_assignedRoomId_widget -%}
|
||||
<table class="w-full table-fixed border-collapse">
|
||||
{%- for child in form %}
|
||||
{%- set child_attr = {} -%}
|
||||
{%- if attr['hx-trigger'] is defined -%}
|
||||
{%- set child_attr = {
|
||||
'hx-trigger': attr['hx-trigger'],
|
||||
'hx-post': attr['hx-post'],
|
||||
'hx-target': attr['hx-target']|default('#main-content'),
|
||||
'hx-swap': attr['hx-swap']
|
||||
} -%}
|
||||
{%- endif -%}
|
||||
<tr>
|
||||
<td class="border border-primary-bg p-2 align-top" colspan="2">
|
||||
<div>{{- child.vars.label -}}</div>
|
||||
</td>
|
||||
<td class="border border-primary-bg p-2 align-top w-12 text-center">
|
||||
{{- form_widget(child, { 'attr': child_attr }) -}}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor -%}
|
||||
</table>
|
||||
{%- endblock _participant_assignedRoomId_widget -%}
|
||||
|
||||
@@ -232,13 +232,13 @@
|
||||
|
||||
{# Room assignment - hidden until date of birth is provided, or shown as static text in edit mode #}
|
||||
{% if form.assignedRoomId is defined or is_static_text('assignedRoomId', bookingDto, participantIndex) %}
|
||||
{% set assignedRoom = bookingDto.travel.getRoomById(form.vars.data.participant.assignedRoomId) %}
|
||||
{% set roomLabel = assignedRoom ? assignedRoom.label : 'Kein Zimmer zugewiesen' %}
|
||||
<hr>
|
||||
<h3 class="font-semibold text-lg mb-4">
|
||||
Unterkunft
|
||||
</h3>
|
||||
<div class="grid lg:grid-cols-2 lg:gap-x-8">
|
||||
<div>
|
||||
{% set assignedRoom = bookingDto.travel.getRoomById(form.vars.data.participant.assignedRoomId) %}
|
||||
{% set roomLabel = assignedRoom ? assignedRoom.label : 'Kein Zimmer zugewiesen' %}
|
||||
<h3 class="font-semibold text-lg mb-4">
|
||||
Unterkunft
|
||||
</h3>
|
||||
{{ macros.field_or_static(form, 'assignedRoomId', 'Zimmer', roomLabel, bookingDto, participantIndex, {
|
||||
'attr': {
|
||||
'hx-trigger': 'change',
|
||||
|
||||
Reference in New Issue
Block a user