@php $totalPrice = $reservation->events->sum('price'); $useFreePrice = $room->price_mode == App\Enums\PriceModes::FREE; $hasDiscounts = $reservation->discounts->isNotEmpty() || $reservation->special_discount || ($reservation->donation && !$useFreePrice); $finalTotal = $reservation->finalPrice(); @endphp
@if($hasDiscounts)
Total initial {{ currency($totalPrice, $owner) }}
@foreach($reservation->discounts as $discount) @php $discountValue = $discount->type->value === 'fixed' ? $discount->value : ($discount->value * $totalPrice / 100); $discountLabel = $discount->name; if ($discount->type->value === 'percent') { $discountLabel .= " (-" . $discount->value . "%)"; } @endphp @endforeach @if($reservation->special_discount) @endif @if($reservation->donation && !$useFreePrice) @endif
{{ $discountLabel }} {{ currency(-$discountValue, $owner) }}
Réduction spéciale {{ currency(-$reservation->special_discount, $owner) }}
Don supplémentaire {{ currency($reservation->donation, $owner) }}
@endif @if($useFreePrice) @else
Total tarif recommandé {{ currency($reservation->recommendedPrice(), $owner) }}
Tarif libre {{ currency($finalTotal, $owner) }}
Total (TTC) {{ currency($finalTotal, $owner) }}
@endif