@extends('app::layouts.app') @section('content') @php $title = trim((string) ($listing->title ?? '')); $displayTitle = ($title !== '' && preg_match('/[\pL\pN]/u', $title)) ? $title : 'Untitled listing'; $city = trim((string) ($listing->city ?? '')); $country = trim((string) ($listing->country ?? '')); $location = implode(', ', array_filter([$city, $country], fn ($value) => $value !== '')); $description = trim((string) ($listing->description ?? '')); $displayDescription = ($description !== '' && preg_match('/[\pL\pN]/u', $description)) ? $description : 'No description provided.'; $hasPrice = !is_null($listing->price); $priceValue = $hasPrice ? (float) $listing->price : null; @endphp

{{ $displayTitle }}

@if($hasPrice) @if($priceValue > 0) {{ number_format($priceValue, 0) }} {{ $listing->currency ?? 'USD' }} @else Free @endif @else Price on request @endif
@auth
@csrf
@if($listing->user && (int) $listing->user->id !== (int) auth()->id())
@csrf
@if($existingConversationId) Open chat @else
@csrf
@endif @endif @else Log in to save @endauth

{{ $location !== '' ? $location : 'Location not specified' }}

Posted {{ $listing->created_at?->diffForHumans() ?? 'recently' }}

Description

{{ $displayDescription }}

@if(($presentableCustomFields ?? []) !== [])

Listing details

@foreach($presentableCustomFields as $field)

{{ $field['label'] }}

{{ $field['value'] }}

@endforeach
@endif

Contact Seller

@if($listing->user)

Name: {{ $listing->user->name }}

@endif @if($listing->contact_phone)

Phone: {{ $listing->contact_phone }}

@endif @if($listing->contact_email)

Email: {{ $listing->contact_email }}

@endif @if(!$listing->contact_phone && !$listing->contact_email)

No contact details provided.

@endif
@endsection