feat: list and respect all surcharges
This commit is contained in:
@@ -226,11 +226,7 @@ class BookingResponseParser
|
||||
foreach ($xml->zuschlag as $item) {
|
||||
$attributes = $item->attributes();
|
||||
|
||||
$label = (string) $attributes['bezeichnung'];
|
||||
// Skip invalid entries
|
||||
if (empty($label)) {
|
||||
continue;
|
||||
}
|
||||
$label = empty($attributes['bezeichnung']) ? 'unbekannt' : (string) $attributes['bezeichnung'];
|
||||
|
||||
$surcharge = new Surcharge();
|
||||
$surcharge->label = $label;
|
||||
|
||||
@@ -121,6 +121,13 @@ class Booking
|
||||
return $price;
|
||||
}
|
||||
|
||||
public function getSurchargesForParticipant(int $participantIndex): array
|
||||
{
|
||||
return array_filter($this->surcharges, function (Surcharge $surcharge) use ($participantIndex) {
|
||||
return in_array($participantIndex, $surcharge->mapping);
|
||||
});
|
||||
}
|
||||
|
||||
public function isEditable(): bool
|
||||
{
|
||||
return $this->travelDate > new \DateTimeImmutable() && false === in_array($this->status, ['S', 'U']);
|
||||
|
||||
@@ -202,11 +202,28 @@
|
||||
<div class="absolute top-0 left-0 inset-0 cursor-not-allowed"></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-xl font-semibold pb-2">
|
||||
Gesamtpreis
|
||||
</h3>
|
||||
<span class="text-2xl font-medium">{{ bookingData.priceForParticipant(participant.index)|format_currency('EUR') }}</span>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-4">
|
||||
<div>
|
||||
<h3 class="text-xl font-semibold pb-2">
|
||||
Gesamtpreis
|
||||
</h3>
|
||||
<span class="text-2xl font-medium">{{ bookingData.priceForParticipant(participant.index)|format_currency('EUR') }}</span>
|
||||
</div>
|
||||
{% set surcharges = bookingData.surchargesForParticipant(participant.index) %}
|
||||
{% if surcharges|length > 0 %}
|
||||
<div>
|
||||
<h3 class="text-xl font-semibold pb-2">
|
||||
Zuschläge
|
||||
</h3>
|
||||
<ul>
|
||||
{% for surcharge in surcharges %}
|
||||
<li>
|
||||
{{ surcharge.label }}: {{ surcharge.individualPrice[participant.index]|format_currency('EUR') }}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user