@php $typeLabels = [ 'job' => 'Job', 'rent' => 'Rental', 'hostel' => 'Hostel', 'service' => 'Service', ]; $fallbackImages = [ 'job' => 'https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1200&q=80', 'rent' => 'https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1200&q=80', 'hostel' => 'https://images.unsplash.com/photo-1555854877-bab0e564b8d5?auto=format&fit=crop&w=1200&q=80', 'service' => 'https://images.unsplash.com/photo-1581578731548-c64695cc6952?auto=format&fit=crop&w=1200&q=80', ]; $raw = $listing?->raw; $type = $listing?->listing_type; $typeLabel = $type ? ($typeLabels[$type] ?? ucfirst((string) $type)) : 'Listing'; $title = $listing?->title ?? 'Listing details'; $fallbackImage = $fallbackImages[$type] ?? $fallbackImages['rent']; $images = collect($listing?->images ?? []) ->pluck('file_path') ->filter() ->map(fn ($path) => asset('storage/'.$path)) ->values(); if ($images->isEmpty()) { $images = collect([$fallbackImage]); } $priceText = function ($item): string { if (! $item) { return 'Price on request'; } if ($item->listing_type === 'job') { return $item->price ? 'Rs. '.number_format((float) $item->price).'/mo' : 'Hiring'; } if ($item->listing_type === 'service') { return $item->price ? 'Starts Rs. '.number_format((float) $item->price) : 'On request'; } return $item->price ? 'Rs. '.number_format((float) $item->price).'/mo' : 'On request'; }; $jsonList = function ($value): array { if (is_array($value)) { return array_values(array_filter($value)); } if (! is_string($value) || trim($value) === '') { return []; } $decoded = json_decode($value, true); return is_array($decoded) ? array_filter($decoded) : []; }; $yesNo = fn ($value): string => $value ? 'Yes' : 'No'; $formatDate = fn ($value): ?string => $value ? \Carbon\Carbon::parse($value)->format('d M Y') : null; $formatTime = fn ($value): ?string => $value ? \Carbon\Carbon::parse($value)->format('h:i A') : null; $location = collect([$listing?->location, $listing?->city, data_get($raw, 'state')])->filter()->implode(', '); $postedAt = $listing?->created_at ? \Carbon\Carbon::parse($listing->created_at)->diffForHumans() : null; $description = data_get($raw, 'job_description') ?: data_get($raw, 'description') ?: 'No written description was added by the provider. Use the verified details and contact options on this page to continue.'; $contactNumber = data_get($raw, 'apply_whatsapp_number') ?: data_get($raw, 'whatsapp_number') ?: data_get($raw, 'contact_number') ?: data_get($raw, 'phone_number'); $whatsappUrl = $contactNumber ? 'https://wa.me/'.preg_replace('/\D+/', '', (string) $contactNumber) : null; $phoneUrl = $contactNumber ? 'tel:'.preg_replace('/\D+/', '', (string) $contactNumber) : null; $existingReview = $existingReview ?? null; $listingReviews = collect($listingReviews ?? []); $reviewCount = $listingReviews->count(); $averageRating = $reviewCount > 0 ? round((float) $listingReviews->avg('rating'), 1) : 0; $ratingBreakdown = collect(range(5, 1))->mapWithKeys(fn ($rating) => [$rating => $listingReviews->where('rating', $rating)->count()]); $specs = []; $highlights = []; if ($type === 'job') { $specs = [ ['Company', data_get($raw, 'company_name')], ['Department', data_get($raw, 'department')], ['Role', data_get($raw, 'role_category') ?: data_get($raw, 'designation')], ['Employment', data_get($raw, 'employment_type')], ['Work type', data_get($raw, 'work_type')], ['Experience', data_get($raw, 'experience_required')], ['Education', data_get($raw, 'education_required') ?: data_get($raw, 'candidate_min_education')], ['Openings', data_get($raw, 'number_of_openings')], ['Salary type', data_get($raw, 'salary_type')], ['Minimum salary', data_get($raw, 'min_salary') ? 'Rs. '.number_format((float) data_get($raw, 'min_salary')) : null], ['Application deadline', $formatDate(data_get($raw, 'application_deadline'))], ['Shift', data_get($raw, 'job_shift')], ['Gender preference', data_get($raw, 'gender_preference')], ['Posted by', data_get($raw, 'job_posted_by')], ]; $highlights = $jsonList(data_get($raw, 'responsibilities')); } elseif ($type === 'rent') { $rooms = $jsonList(data_get($raw, 'room_details')); $specs = [ ['Property kind', data_get($raw, 'property_kind')], ['Property type', data_get($raw, 'property_type')], ['Furnishing', data_get($raw, 'furnishing_status')], ['Address', data_get($raw, 'address')], ['Area / locality', data_get($raw, 'area_locality')], ['Nearest landmark', data_get($raw, 'nearest_landmark')], ['Available for', data_get($raw, 'willing_to_rent_to')], ['Security deposit', data_get($raw, 'security_deposit') ? 'Rs. '.number_format((float) data_get($raw, 'security_deposit')) : null], ['Maintenance', data_get($raw, 'maintenance_type')], ['Available from', $formatDate(data_get($raw, 'available_from'))], ['Lease duration', data_get($raw, 'lease_duration')], ['Area', data_get($raw, 'area_sqft') ? data_get($raw, 'area_sqft').' sqft' : null], ['Parking', data_get($raw, 'parking_type')], ['Pincode', data_get($raw, 'pincode')], ]; foreach ($rooms as $key => $value) { $specs[] = [Str::headline((string) $key), $value]; } $highlights = $jsonList(data_get($raw, 'additional_spaces')); } elseif ($type === 'hostel') { $specs = [ ['Owner', data_get($raw, 'owner_name')], ['Address', data_get($raw, 'address')], ['Area landmark', data_get($raw, 'area_landmark')], ['Total rooms', data_get($raw, 'total_rooms')], ['Bed sharing', data_get($raw, 'bed_sharing_type')], ['Bed capacity', data_get($raw, 'total_bed_capacity')], ['Bathroom', data_get($raw, 'bathroom_type')], ['Security deposit', data_get($raw, 'security_deposit') ? 'Rs. '.number_format((float) data_get($raw, 'security_deposit')) : null], ['Electricity charge type', data_get($raw, 'electricity_charge_type')], ['Electricity charges', data_get($raw, 'electricity_charges') ? 'Rs. '.number_format((float) data_get($raw, 'electricity_charges')) : null], ['WiFi', $yesNo(data_get($raw, 'wifi_available'))], ['Food / mess', $yesNo(data_get($raw, 'food_mess'))], ['Drinking water', $yesNo(data_get($raw, 'drinking_water'))], ['Power backup', $yesNo(data_get($raw, 'power_backup'))], ['Study room', $yesNo(data_get($raw, 'study_room'))], ['CCTV', $yesNo(data_get($raw, 'cctv'))], ['Security guard', $yesNo(data_get($raw, 'security_guard'))], ['Gate opens', $formatTime(data_get($raw, 'gate_open_time'))], ['Gate closes', $formatTime(data_get($raw, 'gate_close_time'))], ]; $highlights = array_values(array_filter([data_get($raw, 'visitor_policy'), data_get($raw, 'house_rules')])); } elseif ($type === 'service') { $specs = [ ['Service type', data_get($raw, 'service_type')], ['Experience', is_numeric(data_get($raw, 'experience_years')) ? data_get($raw, 'experience_years').' '.Str::plural('year', (int) data_get($raw, 'experience_years')) : null], ['Service area', data_get($raw, 'service_area')], ['Phone number', data_get($raw, 'phone_number')], ['Service radius', data_get($raw, 'service_radius') ? data_get($raw, 'service_radius').' km' : null], ['Inspection charge', data_get($raw, 'inspection_charge') ? 'Rs. '.number_format((float) data_get($raw, 'inspection_charge')) : null], ['Hourly rate', data_get($raw, 'hourly_rate') ? 'Rs. '.number_format((float) data_get($raw, 'hourly_rate')) : null], ['Price type', data_get($raw, 'price_type')], ['Pricing unit', data_get($raw, 'pricing_unit')], ]; $highlights = $jsonList(data_get($raw, 'working_days')); } $specs = collect($specs)->filter(fn ($item) => filled($item[1] ?? null))->values(); $highlights = collect($highlights)->filter()->values(); @endphp @include('frontend.partials.head', ['title' => 'Fily | '.$title]) @include('frontend.partials.header')
{{-- --}} @if (! $listing)
inventory_2

Open a listing to see full details

Choose an approved listing from the marketplace to view photos, price, contact information, and all provider details.

Browse listings
@else
@if ($images->count() > 1) @endif
{{ $typeLabel }}

{{ $title }}

{{ $priceText($listing) }}

location_on{{ $location ?: 'Location on request' }} verifiedAdmin approved @if ($postedAt) schedulePosted {{ $postedAt }} @endif

{{ $description }}

{{ $typeLabel }} overview

Review the complete details below, including pricing, location, contact information, and provider-added specifications for this approved {{ strtolower($typeLabel) }} ad.

Important information

@forelse ($specs as [$label, $value])
{{ $label }}

{{ $value }}

@empty

The provider has not added extra structured details.

@endforelse

Customer rating and comments

{{ $reviewCount }} {{ Str::plural('review', $reviewCount) }}
{{ number_format($averageRating, 1) }}
{{ str_repeat('★', (int) round($averageRating)) }}{{ str_repeat('☆', 5 - (int) round($averageRating)) }}

Based on {{ $reviewCount }} {{ Str::plural('review', $reviewCount) }}

@foreach ($ratingBreakdown as $rating => $count) @php $percent = $reviewCount > 0 ? ($count / $reviewCount) * 100 : 0; @endphp
{{ $rating }} star
{{ $count }}
@endforeach
@forelse ($listingReviews as $review) @php $reviewerName = $review->customer?->name ?: 'Customer'; @endphp
{{ strtoupper(substr($reviewerName, 0, 1)) }}

{{ $reviewerName }}

{{ $review->created_at?->diffForHumans() }}{{ $review->status === 'pending' ? ' · Pending admin review' : '' }}

{{ str_repeat('★', (int) $review->rating) }}{{ str_repeat('☆', 5 - (int) $review->rating) }}

{{ $review->review ?: 'No comment added.' }}

@empty

No customer comments yet. Be the first to rate this ad.

@endforelse
@if ($highlights->isNotEmpty())

{{ $type === 'job' ? 'Responsibilities' : 'Additional notes' }}

@foreach ($highlights as $highlight)
check_circle{{ $highlight }}
@endforeach
@endif
@endif
@if ($images->isNotEmpty()) @endif @include('frontend.partials.footer')