@extends('app::layouts.app') @section('content') @php $title = trim((string) ($listing->title ?? '')); $displayTitle = $title !== '' ? $title : 'Untitled listing'; $priceLabel = 'Price on request'; if (! is_null($listing->price)) { $priceValue = (float) $listing->price; $formattedPrice = number_format($priceValue, 2, '.', ','); $formattedPrice = rtrim(rtrim($formattedPrice, '0'), '.'); $priceLabel = $priceValue > 0 ? $formattedPrice.' '.($listing->currency ?: 'TRY') : 'Free'; } $locationLabel = collect([$listing->city, $listing->country]) ->filter(fn ($value) => is_string($value) && trim($value) !== '') ->implode(', '); $publishedAt = $listing->created_at?->format('M j, Y') ?? 'Recently'; $postedAgo = $listing->created_at?->diffForHumans() ?? 'Listed recently'; $galleryImages = collect($gallery ?? []) ->filter(fn ($value) => is_string($value) && trim($value) !== '') ->values() ->all(); $initialGalleryImage = $galleryImages[0] ?? null; $galleryCount = count($galleryImages); $description = trim((string) ($listing->description ?? '')); $displayDescription = $description !== '' ? $description : 'No description added for this listing.'; $sellerName = trim((string) ($listing->user?->name ?? 'Marketplace Seller')); $sellerInitial = mb_strtoupper(mb_substr($sellerName, 0, 1)); $sellerMemberText = $listing->user?->created_at ? 'Member since '.$listing->user->created_at->format('M Y') : 'New seller'; $canContactSeller = $listing->user && (! auth()->check() || (int) auth()->id() !== (int) $listing->user_id); $isOwnListing = auth()->check() && (int) auth()->id() === (int) $listing->user_id; $primaryContactHref = null; $primaryContactLabel = 'Call'; if (filled($listing->contact_phone)) { $primaryContactHref = 'tel:'.preg_replace('/\s+/', '', (string) $listing->contact_phone); $primaryContactLabel = 'Call'; } elseif (filled($listing->contact_email)) { $primaryContactHref = 'mailto:'.$listing->contact_email; $primaryContactLabel = 'Email'; } $mapQuery = filled($listing->latitude) && filled($listing->longitude) ? trim((string) $listing->latitude).','.trim((string) $listing->longitude) : $locationLabel; $mapUrl = $mapQuery !== '' ? 'https://www.google.com/maps/search/?api=1&query='.urlencode($mapQuery) : null; $reportEmail = config('mail.from.address', 'support@example.com'); $reportUrl = 'mailto:'.$reportEmail.'?subject='.rawurlencode('Report listing #'.$listing->getKey()); $overviewItems = collect([ ['label' => 'Listing ID', 'value' => '#'.$listing->getKey()], ['label' => 'Category', 'value' => $listing->category?->name ?? 'General'], ['label' => 'Location', 'value' => $locationLabel !== '' ? $locationLabel : 'Not specified'], ['label' => 'Published', 'value' => $publishedAt], ]) ->filter(fn (array $item) => trim((string) $item['value']) !== '') ->values(); $detailItems = collect($presentableCustomFields ?? []) ->map(fn (array $field) => [ 'label' => trim((string) ($field['label'] ?? '')), 'value' => trim((string) ($field['value'] ?? '')), ]) ->filter(fn (array $field) => $field['label'] !== '' && $field['value'] !== '') ->values(); if ($detailItems->isEmpty()) { $detailItems = $overviewItems; } @endphp
@if($galleryImages !== [])
@foreach($galleryImages as $index => $image) @endforeach
@endif

{{ $listing->category?->name ?? 'Marketplace listing' }}

{{ $displayTitle }}

{{ $priceLabel }}

{{ $locationLabel !== '' ? $locationLabel : 'Location not specified' }} {{ $postedAgo }}

@foreach($overviewItems as $item)
{{ $item['label'] }} {{ $item['value'] }}
@endforeach

Listing details

A quick view of the important information.

@foreach($detailItems as $field)
{{ $field['label'] }} {{ $field['value'] }}
@endforeach

Description

Condition notes, usage details, and seller context.

{!! nl2br(e($displayDescription)) !!}
@if(($listingVideos ?? collect())->isNotEmpty())

Videos

Extra media attached to this listing.

@foreach($listingVideos as $video)

{{ $video->titleLabel() }}

@endforeach
@endif
@if(($relatedListings ?? collect())->isNotEmpty() || ($themePillCategories ?? collect())->isNotEmpty()) @endif
@endsection