@forelse($bookings as $booking)
@php
$bStatus = strtolower($booking->status ?? 'pending');
$reviewRecord = DB::table('reviews')->where('booking_id', $booking->id)->first();
// 👑 REAL TIME FIX: Native pure PHP date parser string token interpolation
$formattedIn = $booking->check_in_date ? date('d M Y h:i A', strtotime($booking->check_in_date)) : 'N/A';
$formattedOut = $booking->check_out_date ? date('d M Y h:i A', strtotime($booking->check_out_date)) : 'N/A';
@endphp
@php
$roomImage = asset('assets/img/room-image-five.png');
if ($booking->room && $booking->room->images) {
$imagesArray = is_array($booking->room->images) ? $booking->room->images : json_decode($booking->room->images, true);
if (!empty($imagesArray) && is_array($imagesArray)) {
$roomImage = asset(reset($imagesArray));
} else {
$roomImage = asset($booking->room->images);
}
}
@endphp
{{ $booking->room->room_type ?? 'Room' }}
In: {{ $formattedIn }}
Out: {{ $formattedOut }}
{{ str_replace('_', ' ', strtoupper($bStatus)) }}
Amount Paid
₹{{ number_format($booking->total_price, 2) }}
@if(($bStatus == 'confirmed' || $bStatus == 'checked_in' || $bStatus == 'checked_out') && !$reviewRecord)
@elseif($reviewRecord)
@php
$ratingLabels = [
1 => 'Poor',
2 => 'Average',
3 => 'Good',
4 => 'Very Good',
5 => 'Excellent'
];
$currentLabel = $ratingLabels[$reviewRecord->rating] ?? 'Rated';
@endphp
Review Submitted:
{!! str_repeat('', $reviewRecord->rating) !!}
{{ strtoupper($currentLabel) }}
@if($reviewRecord->comment)
"{{ $reviewRecord->comment }}"
@endif
@endif
No recent bookings found.
Book Now