feat: finalize voucher handling and discount display in summary and overview

This commit is contained in:
Björn Fromme
2025-11-26 17:29:15 +01:00
parent 32bef9a4e9
commit f4691ec67e
15 changed files with 762 additions and 46 deletions
+46 -6
View File
@@ -142,12 +142,52 @@
{# Total Section #}
{% if pricingData.grandTotal is defined and pricingData.grandTotal > 0 %}
<div class="pt-4 border-t-2 border-gray-300">
<div class="flex justify-between items-center">
<span class="font-bold text-lg text-gray-800">Gesamtpreis:</span>
<span class="font-bold text-xl text-gray-900" {{ qa_attribute('summary-total') }}>
{{ pricingData.grandTotal|number_format(2, ',', '.') }}
</span>
</div>
{# Show subtotal and voucher discounts when vouchers are applied #}
{% set acceptedVouchers = bookingCreateDto.getAcceptedVouchers() %}
{% if acceptedVouchers and acceptedVouchers.hasVouchers() %}
{# Subtotal before vouchers #}
<div class="flex justify-between items-center mb-2">
<span class="text-gray-600">Gesamtpreis:</span>
<span class="text-gray-900">
{{ pricingData.grandTotal|number_format(2, ',', '.') }}
</span>
</div>
{# Voucher discounts breakdown #}
<div class="mb-3 space-y-1">
{% for voucher in acceptedVouchers.vouchers %}
<div class="flex justify-between items-center text-sm">
<span class="text-gray-600">
{% if voucher.promotional %}
Aktionsgutschein ({{ voucher.code }})
{% elseif voucher.goodwill %}
Kulanzgutschein ({{ voucher.code }})
{% elseif voucher.purchase %}
Kaufgutschein ({{ voucher.code }})
{% endif %}
</span>
<span class="font-medium text-green-600">
-€{{ voucher.amount|number_format(2, ',', '.') }}
</span>
</div>
{% endfor %}
</div>
{# Amount to pay after vouchers #}
<div class="flex justify-between items-center pt-2 border-t border-gray-200">
<span class="font-bold text-lg text-gray-800">Zu zahlen:</span>
<span class="font-bold text-xl text-gray-900" {{ qa_attribute('summary-total') }}>
{{ (pricingData.grandTotal - acceptedVouchers.totalDiscount)|number_format(2, ',', '.') }}
</span>
</div>
{% else %}
<div class="flex justify-between items-center">
<span class="font-bold text-lg text-gray-800">Gesamtpreis:</span>
<span class="font-bold text-xl text-gray-900" {{ qa_attribute('summary-total') }}>
{{ pricingData.grandTotal|number_format(2, ',', '.') }}
</span>
</div>
{% endif %}
</div>
{% endif %}
</div>
+45 -6
View File
@@ -86,12 +86,51 @@
{# Grand Total #}
{% if pricingData.grandTotal is defined and pricingData.grandTotal > 0 %}
<div class="pt-4">
<div class="flex justify-between items-center">
<span class="font-bold text-xl text-blue-900">Gesamtpreis:</span>
<span class="font-bold text-2xl text-blue-900">
{{ pricingData.grandTotal|number_format(2, ',', '.') }}
</span>
</div>
{% set acceptedVouchers = bookingCreateDto.getAcceptedVouchers() %}
{% if acceptedVouchers and acceptedVouchers.hasVouchers() %}
{# Subtotal before vouchers #}
<div class="flex justify-between items-center mb-3">
<span class="text-lg text-blue-800">Gesamtpreis:</span>
<span class="text-lg text-blue-800">
{{ pricingData.grandTotal|number_format(2, ',', '.') }}
</span>
</div>
{# Voucher discounts breakdown #}
<div class="mb-4 space-y-2 pb-4 border-b border-blue-200">
{% for voucher in acceptedVouchers.vouchers %}
<div class="flex justify-between items-center">
<span class="text-blue-700">
{% if voucher.promotional %}
Aktionsgutschein ({{ voucher.code }})
{% elseif voucher.goodwill %}
Kulanzgutschein ({{ voucher.code }})
{% elseif voucher.purchase %}
Kaufgutschein ({{ voucher.code }})
{% endif %}
</span>
<span class="font-semibold text-green-600">
-€{{ voucher.amount|number_format(2, ',', '.') }}
</span>
</div>
{% endfor %}
</div>
{# Amount to pay after vouchers #}
<div class="flex justify-between items-center">
<span class="font-bold text-xl text-blue-900">Zu zahlen:</span>
<span class="font-bold text-2xl text-blue-900">
{{ (pricingData.grandTotal - acceptedVouchers.totalDiscount)|number_format(2, ',', '.') }}
</span>
</div>
{% else %}
<div class="flex justify-between items-center">
<span class="font-bold text-xl text-blue-900">Gesamtpreis:</span>
<span class="font-bold text-2xl text-blue-900">
{{ pricingData.grandTotal|number_format(2, ',', '.') }}
</span>
</div>
{% endif %}
</div>
{% endif %}
</div>