@extends('layouts.app') @section('title', 'Property Listings') @section('content')

Latest Properties

{{-- ✅ Usage Feedback --}} @if(auth()->check() && auth()->user()->plan)

You’ve used {{ auth()->user()->properties()->count() }} of {{ auth()->user()->plan->listing_limit ?? '∞' }} listings.

@endif @if($properties->isEmpty())

No properties available at the moment. Please check back later.

@else
@foreach ($properties as $property) @php $imageArray = is_array($property->images) ? $property->images : json_decode($property->images, true) ?? []; $firstImage = $imageArray[0] ?? $property->image_url; $displayImage = $firstImage ?? asset('storage/default_blurred.jpg'); $agent = $property->agent; $isVerified = $agent && $agent->is_verified; $canWhatsapp = $agent && optional($agent->plan)->can_whatsapp; $phone = preg_replace('/[^0-9]/', '', $agent->phone_number ?? ''); @endphp
{{-- 🌟 Featured Tag --}} @if($property->is_featured) 🌟 Featured @endif {{ $property->title }}

{{ $property->title }}

{{ ucfirst($property->type) }} • {{ $property->city ?? 'Unknown City' }}

₦{{ number_format($property->price, 0) }}

{{-- Agent Info --}} @if($agent)

👤 Agent: {{ $agent->name ?? 'Unknown' }} @if($agent && $agent->isVerified()) ✔ Verified Agent @else ⛔ Unverified @endif

@if($agent->phone_number)

📞 {{ $agent->phone_number }}

@endif @else

Agent info unavailable.

@endif {{-- ✅ WhatsApp Contact --}} @if($canWhatsapp && $phone) 💬 Contact via WhatsApp @else

WhatsApp not available.

@endif {{-- View Details --}} View Details →
@endforeach
{{ $properties->links() }}
@endif
@endsection