feat: centralize create/edit flow contexts, extract edit submit service

This commit is contained in:
Björn Fromme
2026-04-12 10:17:04 +02:00
parent f903f17ebd
commit 69705052b3
28 changed files with 1342 additions and 423 deletions
+30 -30
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">{{ summaryData.payableAmount|format_currency('EUR') }}</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.payableAmount|format_currency('EUR') }}</span>
</div>
<div class="flex items-center justify-between">
<span class="block uppercase font-semibold">Buchungsübersicht</span>
@@ -35,7 +35,7 @@
Reise
</th>
<td class="pl-2">
{{ bookingCreateDto.travel.label }}
{{ bookingCreateContext.bookingDto.travel.label }}
</td>
</tr>
<tr>
@@ -43,7 +43,7 @@
Zeitraum
</th>
<td class="pl-2">
{{ bookingCreateDto.travel.dateFrom|date('d.m.Y') }} - {{ bookingCreateDto.travel.dateTo|date('d.m.Y') }}
{{ bookingCreateContext.bookingDto.travel.dateFrom|date('d.m.Y') }} - {{ bookingCreateContext.bookingDto.travel.dateTo|date('d.m.Y') }}
</td>
</tr>
<tr>
@@ -51,7 +51,7 @@
Unterkunft
</th>
<td class="pl-2">
{{ bookingCreateDto.travel.hotel.name }}
{{ bookingCreateContext.bookingDto.travel.hotel.name }}
</td>
</tr>
<tr>
@@ -59,7 +59,7 @@
Teilnehmer
</th>
<td class="pl-2">
{{ summaryData.participantCount }}
{{ bookingCreateContext.summaryData.participantCount }}
</td>
</tr>
</table>
@@ -94,7 +94,7 @@
Reise
</th>
<td class="pl-2">
{{ bookingCreateDto.travel.label }}
{{ bookingCreateContext.bookingDto.travel.label }}
</td>
</tr>
<tr>
@@ -102,7 +102,7 @@
Zeitraum
</th>
<td class="pl-2">
{{ bookingCreateDto.travel.dateFrom|date('d.m.Y') }} - {{ bookingCreateDto.travel.dateTo|date('d.m.Y') }}
{{ bookingCreateContext.bookingDto.travel.dateFrom|date('d.m.Y') }} - {{ bookingCreateContext.bookingDto.travel.dateTo|date('d.m.Y') }}
</td>
</tr>
<tr>
@@ -110,7 +110,7 @@
Unterkunft
</th>
<td class="pl-2">
{{ bookingCreateDto.travel.hotel.name }}
{{ bookingCreateContext.bookingDto.travel.hotel.name }}
</td>
</tr>
<tr>
@@ -118,7 +118,7 @@
Teilnehmer
</th>
<td class="pl-2">
{{ summaryData.participantCount }}
{{ bookingCreateContext.summaryData.participantCount }}
</td>
</tr>
</table>
@@ -132,18 +132,18 @@
</h3>
{# Rooms Section #}
{% if summaryData.pricingData.rooms is not empty %}
{% if bookingCreateContext.summaryData.pricingData.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 bookingCreateContext.summaryData.pricingData.rooms %}
<tr>
<td class="p-2 align-top">
<div>{{ roomPricing.quantity }}x {{ roomPricing.label }}</div>
{% if summaryData.assignmentCounts[roomPricing.roomId] is defined %}
<div class="text-sm text-gray-600">{{ summaryData.assignmentCounts[roomPricing.roomId] }} Person(en) belegt</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>
{% endif %}
</td>
<td class="p-2 align-top w-24 text-right whitespace-nowrap">
@@ -156,12 +156,12 @@
{% endif %}
{# Services Section #}
{% if summaryData.pricingData.services is not empty %}
{% if bookingCreateContext.summaryData.pricingData.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 bookingCreateContext.summaryData.pricingData.services %}
<div class="p-2 text-primary-dark/70 uppercase font-semibold">
{{ serviceGroup.groupName }}
</div>
@@ -186,15 +186,15 @@
Teilnehmer
</h3>
{% for participant in bookingCreateDto.participants %}
{% for participant in bookingCreateContext.bookingDto.participants %}
<div class="border border-primary-bg mb-4">
<div class="p-2 bg-primary-bg uppercase font-semibold flex justify-between items-center">
<span>
{{ participant.firstName }} {{ participant.lastName }}
{% if loop.first and not bookingCreateDto.isInternalAgencyBooking() %}<span class="text-sm font-normal">(Anmelder:in)</span>{% endif %}
{% if loop.first and not bookingCreateContext.bookingDto.isInternalAgencyBooking() %}<span class="text-sm font-normal">(Anmelder:in)</span>{% endif %}
</span>
{% if participantPrices is defined and participantPrices[loop.index0] is defined %}
<span>{{ participantPrices[loop.index0]|format_currency('EUR') }}</span>
{% if bookingCreateContext.participantPrices is defined and bookingCreateContext.participantPrices[loop.index0] is defined %}
<span>{{ bookingCreateContext.participantPrices[loop.index0]|format_currency('EUR') }}</span>
{% endif %}
</div>
{# Personal Data - responsive grid #}
@@ -242,7 +242,7 @@
</div>
{# Unterkunft Section #}
{% set assignedRoom = bookingCreateDto.travel.getRoomById(participant.assignedRoomId) %}
{% set assignedRoom = bookingCreateContext.bookingDto.travel.getRoomById(participant.assignedRoomId) %}
{% if assignedRoom or participant.remarksRoom %}
<div class="px-2 py-1 text-primary-dark/70 text-sm uppercase font-semibold">
Unterkunft
@@ -462,8 +462,8 @@
{% endfor %}
{# Grand Total #}
{% if summaryData.pricingData.grandTotal is defined and summaryData.pricingData.grandTotal > 0 %}
{% set acceptedVouchers = bookingCreateDto.getAcceptedVouchers() %}
{% if bookingCreateContext.summaryData.pricingData.grandTotal is defined and bookingCreateContext.summaryData.pricingData.grandTotal > 0 %}
{% set acceptedVouchers = bookingCreateContext.bookingDto.getAcceptedVouchers() %}
{% 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">
{{ summaryData.pricingData.grandTotal|format_currency('EUR') }}
{{ bookingCreateContext.summaryData.pricingData.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">{{ summaryData.payableAmount|format_currency('EUR') }}</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.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">{{ summaryData.pricingData.grandTotal|format_currency('EUR') }}</span>
<span class="font-semibold">{{ bookingCreateContext.summaryData.pricingData.grandTotal|format_currency('EUR') }}</span>
</div>
{% endif %}
{% endif %}
@@ -516,24 +516,24 @@
<table class="w-full table-fixed text-sm">
<tr>
<td class="p-2 align-top">
{% if bookingCreateDto.paymentMethod == constant('App\\BusProNet\\Constants::PAYMENT_METHOD_DEBIT') %}
{% if bookingCreateContext.bookingDto.paymentMethod == constant('App\\BusProNet\\Constants::PAYMENT_METHOD_DEBIT') %}
Lastschrift (Einzugsermächtigungsverfahren)
{% else %}
Überweisung
{% endif %}
</td>
</tr>
{% if bookingCreateDto.paymentMethod == constant('App\\BusProNet\\Constants::PAYMENT_METHOD_DEBIT') and bookingCreateDto.bankAccount %}
{% if bookingCreateContext.bookingDto.paymentMethod == constant('App\\BusProNet\\Constants::PAYMENT_METHOD_DEBIT') and bookingCreateContext.bookingDto.bankAccount %}
<tr>
<td class="p-2 align-top">
<span class="text-gray-600 font-semibold">IBAN:</span>
<span class="font-mono">{{ bookingCreateDto.bankAccount.iban }}</span>
<span class="font-mono">{{ bookingCreateContext.bookingDto.bankAccount.iban }}</span>
</td>
</tr>
<tr>
<td class="p-2 align-top">
<span class="text-gray-600 font-semibold">Kontoinhaber:</span>
{{ bookingCreateDto.bankAccount.accountHolder }}
{{ bookingCreateContext.bookingDto.bankAccount.accountHolder }}
</td>
</tr>
{% endif %}
@@ -572,7 +572,7 @@
Zurück
</a>
<button type="submit" class="button button--primary" {{ qa_attribute('btn-submit') }}>
{% if bookingCreateDto.bookingStatus == 'A' %}
{% if bookingCreateContext.bookingDto.bookingStatus == 'A' %}
Anfragen
{% else %}
Verbindlich buchen