@extends('layouts.storefront') @section('title', ($vehicle->meta_title ?: $vehicle->make?->name.' '.$vehicle->model?->name.' '.$vehicle->year).' | '.Setting::get('site.name', 'Monaralk')) @section('description', $vehicle->meta_description ?: \Illuminate\Support\Str::limit(strip_tags($vehicle->description ?? ''), 155)) @section('canonical', route('vehicles.show', $vehicle)) @section('og:type', 'product') @if ($vehicle->ogImage) @section('og:image', $vehicle->ogImage) @section('og:image:alt', $vehicle->listingTitle()) @if ($vehicle->coverImage?->path_og) @section('og:image:width', 1200) @section('og:image:height', 630) @endif @endif @section('og:price:amount', number_format((float) $vehicle->price, 0, '.', '')) @section('og:price:currency', 'LKR') @php $conditionSchema = match ($vehicle->condition?->value) { 'new' => 'https://schema.org/NewCondition', 'certified_pre_owned' => 'https://schema.org/UsedCondition', default => 'https://schema.org/UsedCondition', }; $jsonLd = array_filter([ '@context' => 'https://schema.org', '@type' => 'Car', 'name' => $vehicle->listingTitle(), 'url' => route('vehicles.show', $vehicle), 'description' => $vehicle->meta_description ?: \Illuminate\Support\Str::limit(strip_tags($vehicle->description ?? ''), 155), 'sku' => $vehicle->slug, 'brand' => filled($vehicle->make?->name) ? ['@type' => 'Brand', 'name' => $vehicle->make->name] : null, 'model' => $vehicle->model?->name, 'vehicleModelDate' => (string) $vehicle->year, 'vehicleConfiguration' => $vehicle->trim, 'bodyType' => $vehicle->bodyType?->name, 'color' => $vehicle->exteriorColor?->name, 'fuelType' => $vehicle->fuelType?->name, 'vehicleTransmission' => $vehicle->transmission?->name, 'itemCondition' => $conditionSchema, 'mileageFromOdometer' => ['@type' => 'QuantitativeValue', 'value' => (int) $vehicle->mileage_km, 'unitCode' => 'KMT'], 'image' => $gallery->map(fn ($image) => \Illuminate\Support\Facades\Storage::disk('public')->url($image->path_1600w ?: $image->path))->all(), 'offers' => [ '@type' => 'Offer', 'url' => route('vehicles.show', $vehicle), 'priceCurrency' => 'LKR', 'price' => number_format((float) $vehicle->price, 0, '.', ''), 'availability' => $vehicle->isSold() ? 'https://schema.org/SoldOut' : 'https://schema.org/InStock', 'itemCondition' => $conditionSchema, 'seller' => ['@type' => 'Organization', 'name' => Setting::get('site.name', 'Monaralk')], ], ], fn ($value) => $value !== null && $value !== ''); @endphp @push('head') @endpush @section('content') @php $title = trim(implode(' ', array_filter([ $vehicle->make?->name, $vehicle->model?->name, $vehicle->trim, ]))); $imageUrls = $gallery->map(fn ($image) => \Illuminate\Support\Facades\Storage::disk('public')->url($image->path_1600w ?: $image->path))->values(); $imageAlts = $gallery->map(fn ($image) => $image->alt ?: $title)->values(); $specRows = array_filter([ __('Year') => $vehicle->year, __('Body type') => $vehicle->bodyType?->name, __('Mileage') => number_format($vehicle->mileage_km).' km', __('Condition') => $vehicle->condition?->label(), __('Transmission') => $vehicle->transmission?->name, __('Fuel') => $vehicle->fuelType?->name, __('Exterior colour') => $vehicle->exteriorColor?->name, __('Interior colour') => $vehicle->interiorColor?->name, __('Location') => $vehicle->location, ], fn ($value) => filled($value)); $provenanceRows = array_filter([ __('VIN') => $vehicle->vin, __('Registration') => $vehicle->registration_number, __('Owners') => $vehicle->owners_count, __('Accident history') => $vehicle->accident_history, __('Warranty') => $vehicle->warranty, __('Last serviced') => optional($vehicle->last_service_date)?->isoFormat('D MMM YYYY'), ], fn ($value) => filled($value)); $financeRows = array_filter([ __('Deposit') => $vehicle->finance_deposit !== null ? 'LKR '.number_format((float) $vehicle->finance_deposit) : null, __('Term') => $vehicle->finance_term_months ? $vehicle->finance_term_months.' '.__('months') : null, __('APR') => $vehicle->finance_apr !== null ? rtrim(rtrim(number_format((float) $vehicle->finance_apr, 2), '0'), '.').'%' : null, ], fn ($value) => filled($value)); @endphp
@forelse ($gallery as $index => $image) @if ($image->path_1600w_webp) @endif {{ $imageAlts[$index] }} @empty
@endforelse @if ($imageUrls->count() > 1) @endif
@if ($gallery->count() > 1)
@foreach ($gallery as $index => $image) @endforeach
@endif
@if ($imageUrls->count() > 1) @endif
{{ $title }}

{{ $title }}

@if ($vehicle->is_featured) {{ __('Featured') }} @endif @if ($vehicle->isSold()) {{ __('Sold') }} @endif

{{ $vehicle->year }} {{ number_format($vehicle->mileage_km) }} km {{ $vehicle->fuelType?->name ?? '—' }} {{ $vehicle->transmission?->name ?? '—' }} @if ($vehicle->location) {{ $vehicle->location }} @endif

{{ $vehicle->formattedPrice }}

{{ number_format($vehicle->views_count) }} {{ __('views') }}

@foreach ($specRows as $label => $value)
{{ $label }}
{{ $value }}
@endforeach
@if ($vehicle->features->isNotEmpty())

{{ __('Features') }}

    @foreach ($vehicle->features as $feature)
  • {{ $feature->name }}
  • @endforeach
@endif @if ($provenanceRows !== [] || $financeRows !== [])
@if ($provenanceRows !== [])

{{ __('Provenance') }}

@foreach ($provenanceRows as $label => $value)
{{ $label }}
{{ $value }}
@endforeach
@endif @if ($financeRows !== [])

{{ __('Finance') }}

@foreach ($financeRows as $label => $value)
{{ $label }}
{{ $value }}
@endforeach
@endif
@endif @if (filled($vehicle->description))

{{ __('Description') }}

{!! nl2br(e($vehicle->description)) !!}
@endif
@if ($related->isNotEmpty())

{{ __('Similar cars') }}

@foreach ($related as $item) @endforeach
@endif
@endsection @push('scripts') @endpush