@php
$isNonRefundable = $rate['non_refundable'] ?? false;
$underCancellation = $cancellationPolicy['under_cancellation'] ?? false;
$cancelDate = $cancelByDate ? \Carbon\Carbon::parse($cancelByDate) : null;
$now = \Carbon\Carbon::now();
@endphp
@if(!$supportsCancellation)
Non-Cancellable
No refund allowed under any circumstance.
@elseif($supportsCancellation && $isNonRefundable)
Non-Refundable
No refund will be issued once booked.
@else
@if($underCancellation)
Partially Refundable
Cancellation fee may apply.
@else
Fully Refundable
Before cancellation deadline
@endif
@if($cancelDate)
@if($now->lt($cancelDate))
Free cancellation until: {{ $cancelDate->format('M d, Y h:i A') }}
@else
Cancellation deadline passed: {{ $cancelDate->format('M d, Y h:i A') }}
@endif
@endif
@if(!empty($cancellationDetails))
Cancellation Charges:
@foreach($cancellationDetails as $rule)
@php
$ruleDate = !empty($rule['from'])
? \Carbon\Carbon::parse($rule['from'])->format('M d, Y h:i A')
: 'N/A';
if (isset($rule['percent'])) {
$chargeMsg = $rule['percent'] . '% of the total booking amount will be charged.';
} elseif (array_key_exists('amount', $rule)) {
$ruleCurrency = $rule['currency'] ?? '';
$chargeMsg = 'A charge of ' . $ruleCurrency . ' ' . number_format($rule['amount'] ?? 0, 2) . ' will be applied.';
} elseif (isset($rule['flat_fee'])) {
$ruleCurrency = $rule['currency'] ?? '';
$chargeMsg = 'A fixed fee of ' . $ruleCurrency . ' ' . number_format($rule['flat_fee'] ?? 0, 2) . ' will be charged.';
} elseif (isset($rule['nights'])) {
$chargeMsg = 'You will be charged the cost of ' . $rule['nights'] . ' night(s).';
} else {
$chargeMsg = 'Charges apply as per policy.';
}
@endphp
From {{ $ruleDate }}: {{ $chargeMsg }}
@endforeach
@endif
@if(!empty($noShowFee))
@php
if (isset($noShowFee['percent'])) {
$noShowMsg = "{$noShowFee['percent']}% of the booking amount will be charged if you fail to check in.";
} elseif (isset($noShowFee['amount'])) {
$noShowMsg = "A charge of " . number_format($noShowFee['amount'] ?? 0, 2) . " will be applied.";
} elseif (isset($noShowFee['flat_fee'])) {
$nsC = $noShowFee['currency'] ?? '';
$noShowMsg = "A fixed charge of {$nsC} " . number_format($noShowFee['flat_fee'] ?? 0, 2) . " will be applied if you fail to check in.";
} elseif (isset($noShowFee['nights'])) {
$noShowMsg = "If you do not arrive, you will be charged for {$noShowFee['nights']} night(s).";
} else {
$noShowMsg = "No-show charges may apply.";
}
@endphp
{{ $noShowMsg }}
@endif
@endif {{-- end supports_cancellation else --}}