feat: add typed dto for cms data

This commit is contained in:
Björn Fromme
2026-04-12 18:17:54 +02:00
parent 6ab34fa87c
commit 16cab4b768
13 changed files with 78 additions and 34 deletions
@@ -141,10 +141,10 @@
{% endmacro %}
{# Shared by booking create and edit flows; callers should pass one of the flow contexts. #}
{% set bookingFlowContext = bookingEditContext|default(bookingCreateContext|default(null)) %}
{% set bookingDto = bookingFlowContext.bookingDto %}
{% set summaryData = bookingFlowContext.summaryData %}
{% set mutableData = bookingFlowContext.mutableData|default(null) %}
{% set bookingFlowContext = bookingFlowContext|default(bookingEditContext|default(bookingCreateContext|default(null))) %}
{% set bookingDto = bookingDto|default(bookingFlowContext ? bookingFlowContext.bookingDto : null) %}
{% set summaryData = summaryData|default(bookingFlowContext ? bookingFlowContext.summaryData : null) %}
{% set mutableData = mutableData|default(bookingFlowContext and bookingFlowContext.mutableData is defined ? bookingFlowContext.mutableData : null) %}
{# Standalone participant form view (replaces main content area) #}
{% block participant_form %}
+3 -1
View File
@@ -69,7 +69,9 @@
</table>
</div>
{% include 'booking/_summary_hotel.html.twig' %}
{% include 'booking/_summary_hotel.html.twig' with {
'summaryData': summaryData
} %}
{# Mutability information (edit mode only) #}
{% if bookingDto.mode == constant('App\\Form\\Model\\BookingDto::MODE_EDIT') and mutableData %}
+8 -8
View File
@@ -1,14 +1,14 @@
{% if summaryData.cmsData.hotel.name %}
{% if summaryData.cmsData and summaryData.cmsData.name %}
<div class="grid grid-cols-3 gap-x-4 py-4 border-t border-primary-bg">
{% if summaryData.cmsData.hotel.images.resized.l[0] is defined %}
<img src="{{ summaryData.cmsData.hotel.images.resized.l[0].url }}"
alt="{{ summaryData.cmsData.hotel.images.resized.l[0].alt }}"
{% if summaryData.cmsData.images and summaryData.cmsData.images.resized.l[0] is defined %}
<img src="{{ summaryData.cmsData.images.resized.l[0].url }}"
alt="{{ summaryData.cmsData.images.resized.l[0].alt }}"
class="block w-full h-auto">
{% endif %}
<div class="{{ summaryData.cmsData.hotel.images.resized.l[0] is defined ? 'col-span-2' : 'col-span-3' }}">
<span class="block font-semibold uppercase">{{ summaryData.cmsData.hotel.name }}</span>
{% if summaryData.cmsData.hotel.address %}
{{ summaryData.cmsData.hotel.address | nl2br }}
<div class="{{ summaryData.cmsData.images and summaryData.cmsData.images.resized.l[0] is defined ? 'col-span-2' : 'col-span-3' }}">
<span class="block font-semibold uppercase">{{ summaryData.cmsData.name }}</span>
{% if summaryData.cmsData.address %}
{{ summaryData.cmsData.address | nl2br }}
{% endif %}
</div>
</div>
@@ -10,9 +10,9 @@
</h1>
<div class="lg:flex lg:space-x-8 pb-8 mb-8 border-b border-primary-bg/40">
{% if cmsData.hotel.images.resized.l[0] is defined %}
<img src="{{ cmsData.hotel.images.resized.l[0].url }}"
alt="{{ cmsData.hotel.images.resized.l[0].alt }}"
{% if cmsData and cmsData.images and cmsData.images.resized.l[0] is defined %}
<img src="{{ cmsData.images.resized.l[0].url }}"
alt="{{ cmsData.images.resized.l[0].alt }}"
class="block w-full max-w-64 h-auto mb-4">
{% endif %}
<div class="text-white max-w-96">
@@ -22,11 +22,11 @@
<div class="text-lg font-semibold uppercase">
{{ travel_date_from | date('d.m.Y') }} - {{ travel_date_to | date('d.m.Y') }}
</div>
{% if cmsData.hotel.name is defined and cmsData.hotel.name %}
<div class="mt-4 font-semibold">{{ cmsData.hotel.name }}</div>
{% if cmsData and cmsData.name %}
<div class="mt-4 font-semibold">{{ cmsData.name }}</div>
{% endif %}
{% if cmsData.hotel.address is defined and cmsData.hotel.address %}
<div>{{ cmsData.hotel.address | nl2br }}</div>
{% if cmsData and cmsData.address %}
<div>{{ cmsData.address | nl2br }}</div>
{% endif %}
</div>
</div>
@@ -30,7 +30,11 @@
<div id="main-content" class="flex-1 overflow-y-auto px-4 lg:px-8 py-8">
{# Flash messages - must be inside main-content for HTMX swap to display them #}
{% include '_partials/_flashes.html.twig' %}
{% include 'booking/_participant_form.html.twig' %}
{% include 'booking/_participant_form.html.twig' with {
'bookingCreateContext': bookingCreateContext,
'bookingDto': bookingCreateContext.bookingDto,
'summaryData': bookingCreateContext.summaryData
} %}
</div>
</div>
</div>
+6 -2
View File
@@ -65,7 +65,9 @@
</table>
</div>
{% include 'booking/_summary_hotel.html.twig' %}
{% include 'booking/_summary_hotel.html.twig' with {
'summaryData': bookingCreateContext.summaryData
} %}
</div>
</div>
@@ -123,7 +125,9 @@
</tr>
</table>
{% include 'booking/_summary_hotel.html.twig' %}
{% include 'booking/_summary_hotel.html.twig' with {
'summaryData': bookingCreateContext.summaryData
} %}
</div>
{# Detailed Pricing Breakdown #}
@@ -29,6 +29,9 @@
{% include '_partials/_flashes.html.twig' %}
{% include 'booking/_participant_form.html.twig' with {
'bookingEditContext': bookingEditContext,
'bookingDto': bookingEditContext.bookingDto,
'summaryData': bookingEditContext.summaryData,
'mutableData': bookingEditContext.mutableData|default(null),
'participantIndex': participantIndex,
'refreshRouteName': refreshRouteName,
'refreshRouteParams': refreshRouteParams|default({}),