@extends('layouts.app') @section('content') @php // Markup calculation logic $Com_Markup = DB::table('users')->where('id',1)->get(); $Age_Markup = []; $User_id = 0; if(Auth::user()->agency_id != ""){ $emp_id = Auth::user()->agency_id; $Age_Markup = DB::table('users')->where('id',$emp_id)->get(); }else{ $User_id = auth()->id(); } if(count($Com_Markup) && $User_id != 1 ){ $Com_Amt = $Com_Markup[0]->markup; $type = "percentage"; } if(count($Age_Markup) && $User_id != 1 && isset($emp_id)){ $Age_Amt = $Age_Markup[0]->markup; } @endphp @if(!isset($bundle))
{{ $hotel['hotel']['name'] }}
{{ $hotel['hotel']['category'] ?? '4.2' }}/5

{{ $hotel['hotel']['name'] }}

{{ $hotel['hotel']['address'] }}

{{ Str::limit($hotel['hotel']['description'] ?? 'Luxury accommodation with premium amenities', 200) }}

@if(!empty($hotel['hotel']['facilities'])) @php $facilities = explode(';', $hotel['hotel']['facilities']); $limitedFacilities = array_slice($facilities, 0, 4); @endphp @foreach($limitedFacilities as $facility) {{ trim($facility) }} @endforeach @endif

Your Stay Details

@php $rate = $hotel['hotel']['rate']; @endphp
Check-in
{{ $checkin }}
@if(!empty($rate['rate_comments']['checkin_begin_time']) || !empty($rate['rate_comments']['checkin_end_time']))

{{ $rate['rate_comments']['checkin_begin_time'] ?? '' }}

@endif
Check-out
{{ $checkout }}
@if(!empty($rate['rate_comments']['checkout_begin_time']) || !empty($rate['rate_comments']['checkout_time']))

{{ $rate['rate_comments']['checkout_time'] ?? '' }}

@endif
Guests
{{ $adults ?? '1 Adult' }} Adults
@if(!empty($childrens))
{{ $childrens }} Children
@endif
Nights
{{ $nights ?? '2' }}

Room Details

@php $boardingDetails = $rate['boarding_details'] ?? []; $otherInclusions = $rate['other_inclusions'] ?? []; // Rate comments $rateComments = $rate['rate_comments'] ?? []; $paxComments = $rateComments['pax_comments'] ?? ''; $remarks = $rateComments['remarks'] ?? ''; $comments = $rateComments['comments'] ?? ''; $mealplan = $rateComments['mealplan'] ?? ''; $checkinBeginTime = $rateComments['checkin_begin_time'] ?? ''; $checkinEndTime = $rateComments['checkin_end_time'] ?? ''; $checkoutTime = $rateComments['checkout_time'] ?? ''; $mandatoryTax = $rateComments['MandatoryTax'] ?? ''; // Room details $roomDescription = $rate['rooms'][0]['description'] ?? ''; $roomType = $rate['rooms'][0]['room_type'] ?? ''; // Cancellation Policy $cancellationPolicy = $rate['cancellation_policy'] ?? []; $cancelByDate = $cancellationPolicy['cancel_by_date'] ?? null; $cancellationDetails = $cancellationPolicy['details'] ?? []; $noShowFee = $cancellationPolicy['no_show_fee'] ?? null; $underCancellation = $cancellationPolicy['under_cancellation'] ?? false; // Determine Cancellation Type if (!empty($rate['non_refundable'])) { $cancellationType = 'Non-Refundable'; $badgeClass = 'bg-danger'; }elseif ($cancelByDate && !empty($cancellationDetails)) { $cancellationType = 'Full Refundable'; $badgeClass = 'bg-success text-dark'; }else { $cancellationType = 'Partially Refundable'; $badgeClass = 'bg-warning'; } // Pay at hotel $payableAtHotel = 0; $payableAtHotelDetails = []; $hotelCharges = $rate['price_details']['hotel_charges'] ?? []; $mandatoryTaxTotal = 0; $mandatoryFeeTotal = 0; $mandatoryTaxList = []; $mandatoryFeeList = []; foreach ($hotelCharges as $charge) { if (($charge['mandatory'] ?? 0) == 1) { $name = strtolower($charge['name']); if ($name === 'mandatorytax') { $mandatoryTaxTotal += $charge['amount'] ?? 0; $mandatoryTaxList[] = $charge; } if ($name === 'mandatoryfee') { $mandatoryFeeTotal += $charge['amount'] ?? 0; $mandatoryFeeList[] = $charge; } } } // Final Total Payable at Hotel $payableAtHotel = $mandatoryTaxTotal + $mandatoryFeeTotal; // Output array $output = [ 'mandatory_tax_total' => $mandatoryTaxTotal, 'mandatory_fee_total' => $mandatoryFeeTotal, 'mandatory_tax_list' => $mandatoryTaxList, 'mandatory_fee_list' => $mandatoryFeeList, 'total_payable_at_hotel' => $payableAtHotel, ]; // Additional data from response $supportsCancellation = $rate['supports_cancellation'] ?? false; $supportsAmendment = $rate['supports_amendment'] ?? false; $paymentType = $rate['payment_type'][0] ?? ''; $promotions = $rate['promotions_details'][0] ?? ''; @endphp

{{ $roomType }}

{{ $roomDescription }}

{{ $cancellationType }}
@if(!empty($boardingDetails))
Meal Plan

{{ implode(', ', $boardingDetails) }}

@endif @if($checkinBeginTime || $checkoutTime)
Check-in / Check-out
@if($checkinBeginTime)
Check-in {{ $checkinBeginTime }}
@endif @if($checkoutTime)
Check-out {{ $checkoutTime }}
@endif
@endif
@if(!empty($otherInclusions))
Room Inclusions
@foreach($otherInclusions as $inclusion) {{ $inclusion }}
@endforeach

@endif @if($payableAtHotel > 0)
{{-- Icon --}}
{{-- Content --}}
{{-- Title --}}
Charges Payable at Hotel

These charges are not included in your total booking amount.

{{-- Charges Card --}}

Mandatory Charges

{{-- Mandatory Tax --}} @if($mandatoryTaxTotal > 0)
Mandatory Tax {{ $rate['currency'] ?? '' }} {{ number_format($mandatoryTaxTotal, 2) }}
@endif {{-- Mandatory Fee --}} @if($mandatoryFeeTotal > 0)
Mandatory Fee {{ $rate['currency'] ?? '' }} {{ number_format($mandatoryFeeTotal, 2) }}
@endif
{{-- TOTAL --}}
Total Payable at Hotel {{ $rate['currency'] ?? '' }} {{ number_format($payableAtHotel, 2) }}
@endif
Cancellation Policy
@php // Flags from API for bundled rates $supportsCancellation = $rate['supports_cancellation'] ?? false; $isNonRefundable = $rate['non_refundable'] ?? false; $underCancellation = $cancellationPolicy['under_cancellation'] ?? false; $cancelDate = $cancelByDate ? \Carbon\Carbon::parse($cancelByDate) : null; $now = \Carbon\Carbon::now(); @endphp {{-- Step 1: Cannot cancel at all --}} @if(!$supportsCancellation)
Non-Cancellable

No refund allowed under any circumstance.

{{-- Step 2: Supports cancellation but non-refundable --}} @elseif($supportsCancellation && $isNonRefundable)
Non-Refundable

No refund will be issued once booked.

{{-- Step 3: Supports cancellation and refundable / partially refundable --}} @else @if($underCancellation)
Partially Refundable

Cancellation fee may apply.

@else
Fully Refundable

Before cancellation deadline

@endif {{-- Cancel by date --}} @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 {{-- Detailed Cancellation Rules --}} @if(!empty($cancellationDetails))
Cancellation Charges: @foreach($cancellationDetails as $rule) @php $ruleDate = \Carbon\Carbon::parse($rule['from'])->format('M d, Y h:i A'); if(isset($rule['percent'])) { $chargeMsg = "{$rule['percent']}% of the total booking amount will be charged."; } elseif(isset($rule['flat_fee'])) { $currency = $rule['currency'] ?? ''; $chargeMsg = "A fixed fee of {$currency} " . number_format($rule['flat_fee'], 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 {{-- No Show Fee --}} @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['flat_fee'])) { $currency = $noShowFee['currency'] ?? ''; $noShowMsg = "A fixed charge of {$currency} " . number_format($noShowFee['flat_fee'],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 --}}
Cancellation
{{ $supportsCancellation ? 'Allowed' : 'Not Allowed' }}
Amendments
{{ $supportsAmendment ? 'Allowed' : 'Not Allowed' }}
Payment Type
{{ $paymentType }}
@if(!empty($promotions))
Special Offer: {{ $promotions }}
@endif @php $rateComments = $rate['rate_comments'] ?? []; // Nice readable labels for each parameter $commentLabels = [ "remarks" => "Remarks", "policies" => "Hotel Policies", "pax_comments" => "Important Note", "mealplan" => "Meal Plan", "mandatory_fees" => "Mandatory Fees", "comments" => "Comments", "checkout_time" => "Checkout Time", "checkin_special_instructions"=> "Check-in Special Instructions", "checkin_min_age" => "Minimum Check-in Age", "checkin_instructions" => "Check-in Instructions", "checkin_end_time" => "Check-in End Time", "checkin_begin_time" => "Check-in Start Time", "MandatoryFee" => "Mandatory Fee", "MandatoryTax" => "Mandatory Tax", ]; @endphp @if(!empty($rateComments))
Rate Information
@foreach($rateComments as $key => $value) @if(!empty($value) && isset($commentLabels[$key]))
{{ $commentLabels[$key] }}:
{!! $value !!}
@endif @endforeach
@endif
agency_id !="") action="{{ route('employeeBooking.Confirm') }}" @else action="{{ route('Booking.Confirm') }}" @endif method="POST">

Guest Details

@foreach($Personcount as $roomIndex => $room)

Room {{ $roomIndex+1 }}

{{-- Adults --}} @for($i = 0; $i < $room['adults']; $i++)
Adult {{ $i+1 }}
@if($i == 0 && $roomIndex == 0) Main Guest @endif
@if($i == 0 && $roomIndex == 0)
@endif
@endfor {{-- Children --}} @for($j = 0; $j < $room['childrens']; $j++)
Child {{ $j+1 }}
@endfor
@endforeach
@else
{{ $hotel[0]['name'] }}
{{ $hotel[0]['category'] ?? '4.2' }}/5

{{ $hotel[0]['name'] }}

{{ $hotel[0]['address'] }}

{{ Str::limit($hotel[0]['description'] ?? 'Luxury accommodation with premium amenities', 200) }}

@if(!empty($hotel[0]['facilities'])) @php $facilities = explode(';', $hotel[0]['facilities']); $limitedFacilities = array_slice($facilities, 0, 4); @endphp @foreach($limitedFacilities as $facility) {{ trim($facility) }} @endforeach @endif

Your Stay Details

Check-in
{{ $checkin }}

{{ $rate['rate_comments']['checkin_begin_time'] ?? '2:00 PM' }}

Check-out
{{ $checkout }}

{{ $rate['rate_comments']['checkout_time'] ?? '12:00 PM' }}

Guests
@php $totalAdults = 0; $totalChildren = 0; foreach($Personcount as $room) { $totalAdults += $room['adults'] ?? 0; $totalChildren += $room['childrens'] ?? 0; } @endphp
{{ $totalAdults }} Adult{{ $totalAdults > 1 ? 's' : '' }}
@if($totalChildren > 0)
{{ $totalChildren }} Child{{ $totalChildren > 1 ? 'ren' : '' }}
@endif
Nights
{{ $nights ?? '2' }}

Room Details

@foreach($hotel as $key => $val) @php $rate = $val['rate']; // Room Details $roomCode = $rate['room_code'] ?? ''; $roomDescription = $rate['rooms'][0]['description'] ?? ''; $roomType = $rate['rooms'][0]['room_type'] ?? ''; $noOfAdults = $rate['rooms'][0]['no_of_adults'] ?? 0; $noOfChildren = $rate['rooms'][0]['no_of_children'] ?? 0; $childrenAges = $rate['rooms'][0]['children_ages'] ?? []; // Boarding and Inclusions $boardingDetails = $rate['boarding_details'] ?? []; $otherInclusions = $rate['other_inclusions'] ?? []; // Cancellation Policy $cancellationPolicy = $rate['cancellation_policy'] ?? []; $cancelByDate = $cancellationPolicy['cancel_by_date'] ?? ''; $cancellationDetails = $cancellationPolicy['details'] ?? []; $noShowFee = $cancellationPolicy['no_show_fee'] ?? []; $underCancellation = $cancellationPolicy['under_cancellation'] ?? false; // Rate Comments $rateComments = $rate['rate_comments'] ?? []; $paxComments = $rateComments['pax_comments'] ?? ''; $remarks = $rateComments['remarks'] ?? ''; // Other Rate Details $supportsCancellation = $rate['supports_cancellation'] ?? false; $supportsAmendment = $rate['supports_amendment'] ?? false; $paymentType = $rate['payment_type'][0] ?? ''; $nonRefundable = $rate['non_refundable'] ?? false; // Price Details $currency = $rate['currency'] ?? 'AED'; $price = $rate['price'] ?? 0; // Determine Cancellation Type $isRefundable = false; $cancellationText = ''; $cancellationClass = ''; if ($nonRefundable === true) { $cancellationText = 'Non-Refundable'; $cancellationClass = 'badge-nonrefundable'; $isRefundable = false; } elseif ($supportsCancellation && !empty($cancelByDate)) { if (empty($cancellationDetails)) { $cancellationText = 'Free Cancellation'; } else { $cancellationText = 'Full Refundable'; } $cancellationClass = 'badge-refundable'; $isRefundable = true; } elseif (stripos($remarks, 'non-refundable') !== false) { $cancellationText = 'Non-Refundable'; $cancellationClass = 'badge-nonrefundable'; $isRefundable = false; } else { $cancellationText = 'Partially Refundable'; $cancellationClass = 'badge bg-warning text-dark'; $isRefundable = false; } @endphp

{{ $roomType ?? 'Standard Room' }} - Room {{ $key + 1 }}

{{ $roomDescription }}

{{ $cancellationText }}
@if(!empty($boardingDetails))
Meal Plan: {{ implode(', ', $boardingDetails) }}
@endif @if(!empty($otherInclusions))
Inclusions:
@foreach($otherInclusions as $inclusion) {{ $inclusion }} @endforeach
@endif
Cancellation Policy
@php $supportsCancellation = $rate['supports_cancellation'] ?? false; $isNonRefundable = $rate['non_refundable'] ?? false; @endphp {{-- Step 1: If booking cannot be cancelled at all --}} @if(!$supportsCancellation)
Non-Cancellable. No refund allowed under any circumstance.
{{-- Step 2: Supports cancellation but NON-REFUNDABLE --}} @elseif($supportsCancellation && $isNonRefundable)
Non-Refundable. No refund will be issued once booked.
{{-- Step 3: Supports cancellation and refundable --}} @else @php $cancelDate = $cancelByDate ? \Carbon\Carbon::parse($cancelByDate) : null; $now = \Carbon\Carbon::now(); $underCancellation = $cancellationPolicy['under_cancellation'] ?? false; @endphp {{-- Under Cancellation Message --}} @if($underCancellation)
Partially Refundable (Cancellation fee may apply)
@else
Fully Refundable before cancellation deadline
@endif {{-- Cancel by date --}} @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 {{-- Detailed Cancellation Rules --}} @if(!empty($cancellationDetails))
Cancellation Charges: @foreach($cancellationDetails as $rule) @php $ruleDate = \Carbon\Carbon::parse($rule['from'])->format('M d, Y h:i A'); // Create user-friendly message if(isset($rule['percent'])) { $chargeMsg = "{$rule['percent']}% of the total booking amount will be charged."; } elseif(isset($rule['flat_fee'])) { $currency = $rule['currency'] ?? ''; $chargeMsg = "A fixed fee of {$currency} " . number_format($rule['flat_fee'], 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 {{-- No Show Fee --}} @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['flat_fee'])) { $currency = $noShowFee['currency'] ?? ''; $noShowMsg = "A fixed charge of {$currency} " . number_format($noShowFee['flat_fee'],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
Cancellation {{ $supportsCancellation ? 'Allowed' : 'Not Allowed' }}
Amendments {{ $supportsAmendment ? 'Allowed' : 'Not Allowed' }}
Payment Type {{ $paymentType }}
@php $rateComments = $rate['rate_comments'] ?? []; // Nice readable labels for each parameter $commentLabels = [ "remarks" => "Remarks", "policies" => "Hotel Policies", "pax_comments" => "Important Note", "mealplan" => "Meal Plan", "mandatory_fees" => "Mandatory Fees", "comments" => "Comments", "checkout_time" => "Checkout Time", "checkin_special_instructions"=> "Check-in Special Instructions", "checkin_min_age" => "Minimum Check-in Age", "checkin_instructions" => "Check-in Instructions", "checkin_end_time" => "Check-in End Time", "checkin_begin_time" => "Check-in Start Time", "MandatoryFee" => "Mandatory Fee", "MandatoryTax" => "Mandatory Tax", ]; @endphp @if(!empty($rateComments))
Rate Information
@foreach($rateComments as $key => $value) @if(!empty($value) && isset($commentLabels[$key]))
{{ $commentLabels[$key] }}:
{!! $value !!}
@endif @endforeach
@endif @if (!empty($remarks))
Terms & Conditions:
{!! $remarks !!}
@endif
@if(!$loop->last)
@endif @endforeach
agency_id !="") action="{{ route('employeeBooking.Confirm') }}" @else action="{{ route('Booking.Confirm') }}" @endif method="POST">

Guest Details

@foreach($Personcount as $roomIndex => $room)

Room {{ $roomIndex+1 }}

{{-- Adults --}} @for($i = 0; $i < $room['adults']; $i++)
Adult {{ $i+1 }}
@if($i == 0 && $roomIndex == 0) Main Guest @endif
@if($i == 0 && $roomIndex == 0)
@endif
@endfor {{-- Children --}} @for($j = 0; $j < $room['childrens']; $j++)
Child {{ $j+1 }}
@endfor
@endforeach
@endif @endsection