@extends('user.layout') @section('styles') @endsection @section('content') @php $galleryImages = isset($vehicle->images) ? $vehicle->images : collect(); $firstImage = count($galleryImages) > 0 ? $galleryImages->first() : null; $mainImage = !empty($firstImage?->image) ? asset('uploads/vehicles/' . $firstImage->image) : asset('assets/img/noimage.jpg'); $thumbLimit = 6; $stateName = null; if (!empty($vehicle->state)) { $stateName = method_exists($vehicle->state, 'contents') ? optional($vehicle->state->contents()->first())->name : ($vehicle->state->name ?? $vehicle->state->title ?? null); } $cityName = null; if (!empty($vehicle->city)) { $cityName = method_exists($vehicle->city, 'contents') ? optional($vehicle->city->contents()->first())->name : ($vehicle->city->name ?? $vehicle->city->title ?? null); } $countryName = null; if (!empty($vehicle->country)) { $countryName = method_exists($vehicle->country, 'contents') ? optional($vehicle->country->contents()->first())->name : ($vehicle->country->name ?? $vehicle->country->title ?? null); } $categoryName = null; if (!empty($vehicle->category)) { $categoryName = method_exists($vehicle->category, 'categoryContents') ? optional($vehicle->category->categoryContents()->first())->name : ($vehicle->category->name ?? $vehicle->category->title ?? null); } $features = $vehicle->features ?? []; if (!is_array($features)) { $features = []; } $accessories = $vehicle->accessories ?? []; if (!is_array($accessories)) { $accessories = []; } $conditions = $vehicle->conditions ?? []; if (!is_array($conditions)) { $conditions = []; } $featureLabels = [ 'air_conditioning' => 'Air-conditioning', 'cameras' => 'Cameras', 'touch_screen' => 'Touch screen', 'electric_windows' => 'Electric windows', ]; $conditionLabels = [ 'under_warranty' => "It's under warranty.", 'has_debts' => 'Has debts', 'sole_owner' => 'Sole Owner', 'never_shocked' => 'Never shocked', 'not_selected' => 'Not Selected', ]; $offerStatus = $existingOffer->status ?? null; $displayStatus = match ($offerStatus) { 'accepted' => 'Contact Requested', 'expired' => 'Expired', 'not_selected' => 'Not Selected', 'rejected' => 'Rejected', 'pending' => 'Pending', default => null, }; $showSellerContact = !empty($existingOffer) && $existingOffer->status === 'accepted'; @endphp
@if (session('success'))
{{ session('success') }}
@endif @if (session('warning'))
{{ session('warning') }}
@endif @if ($errors->any())
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif
{{-- Gallery --}}

{{ $vehicle->title ?? __('Untitled Vehicle') }}

{{ $vehicle->brand->name ?? '-' }} / {{ $vehicle->model->name ?? '-' }} @if (!empty($vehicle->version?->name)) / {{ $vehicle->version->name }} @endif

{{ __('Active') }}
{{ __('Car Type') }}
{{ ucfirst($vehicle->car_type ?? '-') }}
{{ __('Category') }}
{{ $categoryName ?? '-' }}
{{ __('Year') }}
{{ $vehicle->year ?? '-' }}
{{ __('Mileage') }}
{{ $vehicle->mileage ?? '-' }}
{{ __('Price') }}
@if(!empty($vehicle->price)) {{ !empty($vehicle->currency) ? $vehicle->currency . ' ' : '$' }}{{ number_format($vehicle->price, 0, '.', ',') }} @else - @endif
{{ __('Motor') }}
{{ $vehicle->motor ?? '-' }}
{{ __('Fuel Type') }}
{{ $vehicle->fuel_type ?? '-' }}
{{ __('Transmission') }}
{{ $vehicle->transmision ?? '-' }}
{{ __('Color') }}
{{ $vehicle->color ?? '-' }}
{{ __('Traction') }}
{{ $vehicle->traction ?? '-' }}
{{ __('Title Owner') }}
{{ (int) ($vehicle->is_title_owner ?? 0) === 1 ? __('Yes') : __('No') }}
{{ __('Department') }}
{{ $countryName ?? '-' }}
{{ __('Ciudad') }}
{{ $stateName ?? '-' }}
{{ __('Zona') }}
{{ $cityName ?? '-' }}
{{ __('Address') }}
{{ $vehicle->address ?? '-' }}

{{ __('Description / Details') }}

{{ $vehicle->description ?? '-' }}

{{ __('Accessories / Features') }}

@if (count($accessories) > 0)
    @foreach ($accessories as $item)
  • {{ $featureLabels[$item] ?? ucfirst(str_replace('_', ' ', $item)) }}
  • @endforeach
@else

{{ __('No accessories added.') }}

@endif

{{ __('Conditions') }}

@if (count($conditions) > 0)
    @foreach ($conditions as $item)
  • {{ $conditionLabels[$item] ?? ucfirst(str_replace('_', ' ', $item)) }}
  • @endforeach
@else

{{ __('No conditions added.') }}

@endif
{{-- Right Side --}}
{{-- PRICE --}}
{{ __('Price') }}:
{{ !empty($vehicle->currency) ? $vehicle->currency : 'USD' }} {{ number_format($vehicle->price ?? 0, 0, '.', ',') }}
{{-- LOCATION --}}
{{ $cityName ?? '' }} @if(!empty($stateName)) , {{ $stateName }} @endif
@if($showSellerContact)
{{ __('Seller Contact Information') }}
@php $sellerImage = !empty($vehicle->seller->profile_image) ? asset($vehicle->seller->profile_image) : asset('assets/admin/img/propics/blank_user.jpg'); @endphp
Seller

{{ __('Name') }}:
{{ ($vehicle->seller->first_name ?? '') . ' ' . ($vehicle->seller->last_name ?? '') }}

{{ __('Email') }}:
{{ $vehicle->seller->email ?? '-' }}

{{ __('Phone') }}:
{{ $vehicle->seller->phone ?? '-' }}

@endif
{{ __('Send Offer') }}
@if (!empty($existingOffer))
{{ __('Your latest offer status:') }}
{{ __($displayStatus) }} @if (!empty($existingOffer->offer_price))
{{ __('Amount') }}: ${{ number_format($existingOffer->offer_price, 0, '.', ',') }} @endif @if($existingOffer->status === 'accepted')
{{ __('Seller has requested contact with you.') }} @endif
@endif @if (empty($existingOffer) || in_array($existingOffer->status, ['rejected', 'expired', 'not_selected']))
@csrf
@else
@if($existingOffer->status === 'pending') {{ __('You already have a pending offer for this vehicle.') }} @elseif($existingOffer->status === 'accepted') {{ __('Your offer has been selected. Seller contact information is now available above.') }} @else {{ __('You already interacted with this listing.') }} @endif
@endif {{ __('My Offers') }}
@endsection @section('scripts') @endsection