@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
| {{ $discountLabel }} |
{{ currency(-$discountValue, $owner) }} |
@endforeach
@if($reservation->special_discount)
| Réduction spéciale |
{{ currency(-$reservation->special_discount, $owner) }} |
@endif
@if($reservation->donation && !$useFreePrice)
| Don supplémentaire |
{{ currency($reservation->donation, $owner) }} |
@endif
@endif
@if($useFreePrice)
| Total tarif recommandé |
{{ currency($reservation->recommendedPrice(), $owner) }} |
| Tarif libre |
{{ currency($finalTotal, $owner) }} |
@else
| Total (TTC) |
{{ currency($finalTotal, $owner) }} |
@endif