@extends('layouts.master') @section('body_id', 'room_details_page') @section('content')
Verified Accomodation

{{ $room->room_type }}

Located In: {{ $room->hotel->hotel_name ?? 'Independent Property' }}

@php if (is_array($room->images)) { $gallery = $room->images; } else { $gallery = json_decode($room->images, true); } $primaryImg = (!empty($gallery) && is_array($gallery)) ? $gallery[0] : 'assets/img/hotel-facility-one.jpg'; @endphp
{{ $room->room_type }}
@if(is_array($gallery) && count($gallery) > 1)
@foreach($gallery as $imgItem)
@endforeach
@endif

Room Overview & Comforts

{{ $room->description ?? 'Experience world-class luxury setup with fully functional features optimized for corporate executives and holiday tourists alike.' }}

@if(!empty($room->amenities))
@php $roomAmenities = is_array($room->amenities) ? $room->amenities : json_decode($room->amenities, true); @endphp @if(is_array($roomAmenities)) @foreach($roomAmenities as $roomAmenity)
{{ $roomAmenity }}
@endforeach @endif
@endif
@if(isset($room->hotel))

Hotel Profile: {{ $room->hotel->hotel_name }}

@if(!empty($room->hotel->cover_image)) {{ $room->hotel->hotel_name }} @else Hotel Default Cover @endif
Full Address: {{ $room->hotel->address }}
Region/City: {{ $room->hotel->city }}, {{ $room->hotel->state }}
Support No: {{ $room->hotel->user->phone_number ?? 'Contact Desk Available' }}
Help Desk: {{ $room->hotel->user->email ?? 'N/A' }}
Verification: @if(($room->hotel->status ?? 0) == 1) Approved Property @else Verification Pending @endif
@if(!empty($room->hotel->description))

"{{ $room->hotel->description }}"

@endif @if(!empty($room->hotel->amenities)) @php $hotelAmenities = is_array($room->hotel->amenities) ? $room->hotel->amenities : json_decode($room->hotel->amenities, true); @endphp @if(is_array($hotelAmenities))
Shared Hotel Facilities:
@foreach($hotelAmenities as $hotelAmenity)
{{ $hotelAmenity }}
@endforeach
@endif @endif
@endif

Guest Reviews & Ratings

@php // Dynamic Database fetch operation tracking reviews matching this current room track $roomReviews = \DB::table('reviews') ->join('users', 'reviews.user_id', '=', 'users.id') ->select('reviews.*', 'users.full_name') ->where('reviews.room_id', $room->id) ->where('reviews.status', 1) ->latest() ->get(); $totalReviewsCount = $roomReviews->count(); $avgRatingScore = $totalReviewsCount > 0 ? round($roomReviews->avg('rating'), 1) : 0; $ratingTexts = [ 5 => 'Excellent', 4 => 'Very Good', 3 => 'Good', 2 => 'Average', 1 => 'Poor' ]; @endphp @if($totalReviewsCount > 0)

{{ $avgRatingScore }}

{!! str_repeat('', floor($avgRatingScore)) !!}{!! $avgRatingScore - floor($avgRatingScore) >= 0.5 ? '' : '' !!}

{{ $ratingTexts[round($avgRatingScore)] ?? 'Good Stay' }}

Based on {{ $totalReviewsCount }} stays
Comfort Breakdown Metrics
@foreach([5, 4, 3, 2, 1] as $starRow) @php $rowCount = $roomReviews->where('rating', $starRow)->count(); $rowPercent = $totalReviewsCount > 0 ? ($rowCount / $totalReviewsCount) * 100 : 0; @endphp
{{ $starRow }} Star
{{ $rowCount }}
@endforeach
@foreach($roomReviews as $revRow)
{{ strtoupper(substr($revRow->full_name, 0, 1)) }}
{{ $revRow->full_name }}
{{ \Carbon\Carbon::parse($revRow->created_at)->format('d M, Y') }}
{!! str_repeat('', $revRow->rating) !!} {{ $ratingTexts[$revRow->rating] ?? 'Stay' }}

"{{ $revRow->comment ?? 'Guest profile submitted rating parameter without textual remarks context node.' }}"

@endforeach
@else
No Reviews Available Yet

There are currently no verified guest reviews for this specific accommodation. Be the first to share your experience after your stay!

100% Authentic & Verified Guest Reviews
@endif
@endsection