wip: improved booking summary

This commit is contained in:
Björn Fromme
2025-07-24 12:44:38 +02:00
parent 787e76c21c
commit 2b122a7cc4
11 changed files with 168 additions and 90 deletions
-15
View File
@@ -1,15 +0,0 @@
<div id="booking-summary">
<h3>Zusammenfassung</h3>
<h4>Zimmer</h4>
<ul class="list-disc list-inside pb-4">
{% for roomSelection in roomSummary %}
<li>
{{ roomSelection.quantity }} x {{ roomSelection.roomLabel }}
</li>
{% endfor %}
</ul>
<h4>Anzahl Teilnehmer</h4>
<p>
{{ participantCount }}
</p>
</div>
+32
View File
@@ -0,0 +1,32 @@
<h3>Zusammenfassung</h3>
<p>Reise: {{ bookingCreateDto.travel.label }}</p>
<p>Datum: {{ bookingCreateDto.travel.dateFrom|date('d.m.Y') }} - {{ bookingCreateDto.travel.dateTo|date('d.m.Y') }}</p>
<p>Hotel: {{ bookingCreateDto.travel.hotel.name }}</p>
{% if groupedSelectedRooms.by_room is not empty %}
<h4>Zimmer</h4>
<ul class="list-disc pl-4 pb-4">
{% for roomSelection in groupedSelectedRooms.by_room %}
<li>
{{ roomSelection.quantity }} x {{ roomSelection.roomLabel }}
{% if assignmentCounts is defined and assignmentCounts[roomSelection.roomId] is defined %}
<span class="block text-sm">{{ assignmentCounts[roomSelection.roomId] }}/{{ roomSelection.quantity }} belegt</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% if groupedSelectedRooms.by_pax is not empty %}
<h4>Betten</h4>
<ul class="list-disc pl-4 pb-4">
{% for roomSelection in groupedSelectedRooms.by_pax %}
<li>
{{ roomSelection.quantity }} x {{ roomSelection.roomLabel }}
{% if assignmentCounts is defined and assignmentCounts[roomSelection.roomId] is defined %}
<span class="block text-sm">{{ assignmentCounts[roomSelection.roomId] }}/{{ roomSelection.quantity }} belegt</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
<h4>Anzahl Teilnehmer</h4>
<p>{{ participantCount }}</p>
+34 -9
View File
@@ -5,28 +5,53 @@
<h1>Neue Buchung</h1>
<div class="grid grid-cols-3 gap-8">
<div class="col-span-2">
<h2>Zimmerauswahl</h2>
<h2 class="pb-4">
Unterkunft
</h2>
{{ form_start(form) }}
<div>
{% for roomSelection in form.roomSelections %}
{{ form_row(roomSelection, {
{% if groupedRooms.by_room is not empty %}
<h3>
Zimmer
</h3>
{% for roomId, room in groupedRooms.by_room %}
{{ form_row(form.roomSelections[roomId], {
'attr': {
'hx-post': path('app_booking_create_step_1_room_summary'),
'hx-target': '#booking-summary',
'hx-swap': 'outerHTML',
'hx-swap': 'innerHTML',
'hx-trigger': 'change'
}
}) }}
{% endfor %}
</div>
<div class="flex justify-end">
{% endif %}
{% if groupedRooms.by_pax is not empty %}
<h3>
Betten
</h3>
{% for roomId, room in groupedRooms.by_pax %}
{{ form_row(form.roomSelections[roomId], {
'attr': {
'hx-post': path('app_booking_create_step_1_room_summary'),
'hx-target': '#booking-summary',
'hx-swap': 'innerHTML',
'hx-trigger': 'change'
}
}) }}
{% endfor %}
{% endif %}
<div class="flex justify-end pt-4">
<button type="submit" class="button bg-button bg-button--secondary">Weiter</button>
</div>
{{ form_rest(form) }}
{{ form_end(form) }}
</div>
<div>
{% include 'booking/_room_summary.html.twig' %}
<div id="booking-summary">
{% include 'booking/_summary.html.twig' with {
'bookingCreateDto': bookingCreateDto,
'participantCount': participantCount,
'groupedSelectedRooms': groupedSelectedRooms,
'assignmentCounts': []
} %}
</div>
</div>
{% endblock %}
+10 -48
View File
@@ -62,53 +62,15 @@
{{ form_rest(form) }}
{{ form_end(form) }}
</div>
<div>
{# This block contains the booking summary #}
{% block booking_summary %}
<div id="booking-summary"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
<h3>Zusammenfassung</h3>
<h4>
Reise
</h4>
<p>
{{ bookingCreateDto.travel.label }}
</p>
<h4>
Datum
</h4>
<p>
{{ bookingCreateDto.travel.dateFrom | date('d.m.Y') }} - {{ bookingCreateDto.travel.dateTo | date('d.m.Y') }}
</p>
<h4>
Unterkunft
</h4>
<p>
{{ bookingCreateDto.travel.hotel.name }}
</p>
{% if participantsCount > 0 %}
<h4>
Anzahl Teilnehmer
</h4>
<p>
{{ participantsCount }}
</p>
{% endif %}
<h4>
Zimmer
</h4>
<ul>
{% for roomSelection in bookingCreateDto.selectedRooms %}
{% set assignedCount = assignmentCounts[roomSelection.roomId] ?? 0 %}
<li>
{{ roomSelection.roomLabel }}
<span class="text-sm pl-2 {% if assignedCount == roomSelection.quantity %}text-green-600{% else %}text-gray-500{% endif %}">
({{ assignedCount }}/{{ roomSelection.quantity }})
</span>
</li>
{% endfor %}
</ul>
</div>
{% endblock %}
</div>
{% block booking_summary %}
<div id="booking-summary"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{% include 'booking/_summary.html.twig' with {
'bookingCreateDto': bookingCreateDto,
'participantCount': participantsCount,
'groupedSelectedRooms': groupedSelectedRooms,
'assignmentCounts': assignmentCounts
} %}
</div>
{% endblock %}
</div>
{% endblock %}