feat: split summary DTOs into typed sub-objects

This commit is contained in:
Björn Fromme
2026-04-12 11:23:19 +02:00
parent 69705052b3
commit aa997826f8
18 changed files with 224 additions and 113 deletions
+20 -20
View File
@@ -3,7 +3,7 @@
<div class="shrink-0 px-4 lg:px-8 py-4 lg:flex lg:flex-col lg:justify-center shadow-md relative z-10">
<div class="flex items-center justify-between pb-2">
<span class="block uppercase font-semibold">Gesamtpreis</span>
<span class="font-semibold">{{ summaryData.payableAmount|format_currency('EUR') }}</span>
<span class="font-semibold">{{ summaryData.vouchers.payableAmount|format_currency('EUR') }}</span>
</div>
<div class="flex items-center justify-between">
<span class="block uppercase font-semibold">Buchungsübersicht</span>
@@ -83,8 +83,8 @@
Zusatzleistungen
</td>
<td class="p-2 align-top w-24 text-right whitespace-nowrap">
{% if mutableData.items['additional_services'].mutable %}
{{ mutableData.items['additional_services'].mutableBefore|date('d.m.Y') }}
{% if mutableData.additionalServices and mutableData.additionalServices.mutable %}
{{ mutableData.additionalServices.mutableBefore|date('d.m.Y') }}
{% else %}
nicht mehr möglich
{% endif %}
@@ -95,8 +95,8 @@
Beförderung
</td>
<td class="p-2 align-top w-24 text-right whitespace-nowrap">
{% if mutableData.items['transportation'].mutable %}
{{ mutableData.items['transportation'].mutableBefore|date('d.m.Y') }}
{% if mutableData.transportation and mutableData.transportation.mutable %}
{{ mutableData.transportation.mutableBefore|date('d.m.Y') }}
{% else %}
nicht mehr möglich
{% endif %}
@@ -107,8 +107,8 @@
Zustiege
</td>
<td class="p-2 align-top w-24 text-right whitespace-nowrap">
{% if mutableData.items['pickup'].mutable %}
{{ mutableData.items['pickup'].mutableBefore|date('d.m.Y') }}
{% if mutableData.pickup and mutableData.pickup.mutable %}
{{ mutableData.pickup.mutableBefore|date('d.m.Y') }}
{% else %}
nicht mehr möglich
{% endif %}
@@ -119,8 +119,8 @@
Unterkunft
</td>
<td class="p-2 align-top w-24 text-right whitespace-nowrap">
{% if mutableData.items['accommodation'].mutable %}
{{ mutableData.items['accommodation'].mutableBefore|date('d.m.Y') }}
{% if mutableData.accommodation and mutableData.accommodation.mutable %}
{{ mutableData.accommodation.mutableBefore|date('d.m.Y') }}
{% else %}
nicht mehr möglich
{% endif %}
@@ -131,13 +131,13 @@
{% endif %}
{# Rooms Section #}
{% if summaryData.pricingData.rooms is not empty %}
{% if summaryData.pricing.rooms is not empty %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold">
Unterkunft
</div>
<table class="w-full table-fixed">
{% for roomPricing in summaryData.pricingData.rooms %}
{% for roomPricing in summaryData.pricing.rooms %}
<tr>
<td class="p-2 align-top">
{{ roomPricing.quantity }}x {{ roomPricing.label }}
@@ -152,12 +152,12 @@
{% endif %}
{# Services Section #}
{% if summaryData.pricingData.services is not empty %}
{% if summaryData.pricing.services is not empty %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold">
Leistungen
</div>
{% for serviceGroup in summaryData.pricingData.services %}
{% for serviceGroup in summaryData.pricing.services %}
<div class="p-2 text-primary-dark/70 uppercase font-semibold">
{{ serviceGroup.groupName }}
</div>
@@ -178,13 +178,13 @@
{% endif %}
{# Surcharges Section (Edit mode only) #}
{% if summaryData.pricingData.surcharges is defined and summaryData.pricingData.surcharges is not empty %}
{% if summaryData.pricing.surcharges is not empty %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold">
Zu-/Abschläge
</div>
<table class="w-full table-fixed">
{% for surchargePricing in summaryData.pricingData.surcharges %}
{% for surchargePricing in summaryData.pricing.surcharges %}
<tr>
<td class="px-2 pb-2 align-top">
{{ surchargePricing.participantCount }}x {{ surchargePricing.label }}
@@ -199,9 +199,9 @@
{% endif %}
{# Total Section #}
{% if summaryData.totalPrice > 0 %}
{% if summaryData.pricing.grandTotal > 0 %}
{# Show subtotal and voucher discounts when vouchers are applied #}
{% set acceptedVouchers = bookingDto.getAcceptedVouchers() %}
{% set acceptedVouchers = summaryData.vouchers.acceptedVouchers %}
{% if acceptedVouchers and acceptedVouchers.hasVouchers() %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold">
@@ -214,7 +214,7 @@
Gesamtpreis
</td>
<td class="px-2 pb-2 align-top w-24 text-right whitespace-nowrap">
{{ summaryData.totalPrice|format_currency('EUR') }}
{{ summaryData.pricing.grandTotal|format_currency('EUR') }}
</td>
</tr>
{# Voucher discounts breakdown #}
@@ -239,12 +239,12 @@
{# Amount to pay after vouchers #}
<div class="flex items-center justify-between px-2 pb-2">
<span class="block uppercase font-semibold">Zu zahlen</span>
<span class="font-semibold">{{ summaryData.payableAmount|format_currency('EUR') }}</span>
<span class="font-semibold">{{ summaryData.vouchers.payableAmount|format_currency('EUR') }}</span>
</div>
{% else %}
<div class="flex items-center justify-between pb-2">
<span class="block uppercase font-semibold">Gesamtpreis</span>
<span class="font-semibold">{{ summaryData.payableAmount|format_currency('EUR') }}</span>
<span class="font-semibold">{{ summaryData.vouchers.payableAmount|format_currency('EUR') }}</span>
</div>
{% endif %}
{% endif %}
+4 -4
View File
@@ -65,19 +65,19 @@
{% block room_selection_form %}
<div id="room-selection-form"{% if htmx_oob_swap is defined and htmx_oob_swap %} hx-swap-oob="true"{% endif %}>
{{ form_errors(form) }}
{% if bookingCreateContext.groupedRooms.by_room is not empty %}
{% if bookingCreateContext.groupedRooms.byRoom is not empty %}
<h3>
Zimmer
</h3>
{% for roomId, room in bookingCreateContext.groupedRooms.by_room %}
{% for roomId, room in bookingCreateContext.groupedRooms.byRoom %}
{{ _self.stepFormField(form.roomSelections[roomId]) }}
{% endfor %}
{% endif %}
{% if bookingCreateContext.groupedRooms.by_pax is not empty %}
{% if bookingCreateContext.groupedRooms.byPax is not empty %}
<h3>
Betten
</h3>
{% for roomId, room in bookingCreateContext.groupedRooms.by_pax %}
{% for roomId, room in bookingCreateContext.groupedRooms.byPax %}
{{ _self.stepFormField(form.roomSelections[roomId]) }}
{% endfor %}
{% endif %}
+12 -12
View File
@@ -20,7 +20,7 @@
<div class="shrink-0 px-4 lg:px-8 py-4 lg:flex lg:flex-col lg:justify-center shadow-md relative z-10">
<div class="flex items-center justify-between pb-2">
<span class="block uppercase font-semibold">Gesamtpreis</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.payableAmount|format_currency('EUR') }}</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.vouchers.payableAmount|format_currency('EUR') }}</span>
</div>
<div class="flex items-center justify-between">
<span class="block uppercase font-semibold">Buchungsübersicht</span>
@@ -132,18 +132,18 @@
</h3>
{# Rooms Section #}
{% if bookingCreateContext.summaryData.pricingData.rooms is not empty %}
{% if bookingCreateContext.summaryData.pricing.rooms is not empty %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold">
Unterkunft
</div>
<table class="w-full table-fixed">
{% for roomPricing in bookingCreateContext.summaryData.pricingData.rooms %}
{% for roomPricing in bookingCreateContext.summaryData.pricing.rooms %}
<tr>
<td class="p-2 align-top">
<div>{{ roomPricing.quantity }}x {{ roomPricing.label }}</div>
{% if bookingCreateContext.summaryData.assignmentCounts[roomPricing.roomId] is defined %}
<div class="text-sm text-gray-600">{{ bookingCreateContext.summaryData.assignmentCounts[roomPricing.roomId] }} Person(en) belegt</div>
{% if bookingCreateContext.summaryData.pricing.assignmentCounts[roomPricing.roomId] is defined %}
<div class="text-sm text-gray-600">{{ bookingCreateContext.summaryData.pricing.assignmentCounts[roomPricing.roomId] }} Person(en) belegt</div>
{% endif %}
</td>
<td class="p-2 align-top w-24 text-right whitespace-nowrap">
@@ -156,12 +156,12 @@
{% endif %}
{# Services Section #}
{% if bookingCreateContext.summaryData.pricingData.services is not empty %}
{% if bookingCreateContext.summaryData.pricing.services is not empty %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold">
Leistungen
</div>
{% for serviceGroup in bookingCreateContext.summaryData.pricingData.services %}
{% for serviceGroup in bookingCreateContext.summaryData.pricing.services %}
<div class="p-2 text-primary-dark/70 uppercase font-semibold">
{{ serviceGroup.groupName }}
</div>
@@ -462,8 +462,8 @@
{% endfor %}
{# Grand Total #}
{% if bookingCreateContext.summaryData.pricingData.grandTotal is defined and bookingCreateContext.summaryData.pricingData.grandTotal > 0 %}
{% set acceptedVouchers = bookingCreateContext.bookingDto.getAcceptedVouchers() %}
{% if bookingCreateContext.summaryData.pricing.grandTotal > 0 %}
{% set acceptedVouchers = bookingCreateContext.summaryData.vouchers.acceptedVouchers %}
{% if acceptedVouchers and acceptedVouchers.hasVouchers() %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold">
@@ -475,7 +475,7 @@
Gesamtpreis
</td>
<td class="px-2 pb-2 align-top w-24 text-right whitespace-nowrap">
{{ bookingCreateContext.summaryData.pricingData.grandTotal|format_currency('EUR') }}
{{ bookingCreateContext.summaryData.pricing.grandTotal|format_currency('EUR') }}
</td>
</tr>
{% for voucher in acceptedVouchers.vouchers %}
@@ -498,12 +498,12 @@
</div>
<div class="flex items-center justify-between px-2 pb-4">
<span class="block uppercase font-semibold">Zu zahlen</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.payableAmount|format_currency('EUR') }}</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.vouchers.payableAmount|format_currency('EUR') }}</span>
</div>
{% else %}
<div class="flex items-center justify-between pb-4">
<span class="block uppercase font-semibold">Gesamtpreis</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.pricingData.grandTotal|format_currency('EUR') }}</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.pricing.grandTotal|format_currency('EUR') }}</span>
</div>
{% endif %}
{% endif %}