@extends('user.layout') @section('styles') @endsection @section('content') @php $vehicle = $offer->vehicle; $seller = $offer->seller; $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; $status = $offer->status ?? 'pending'; $statusLabel = match ($status) { 'accepted' => 'Contact Available', 'contact_requested' => 'Contact Available', 'expired' => 'Expired', 'not_selected' => 'Not Selected', 'rejected' => 'Rejected', default => 'Pending', }; $statusBadgeClass = match ($status) { 'accepted' => 'success', 'contact_requested' => 'success', 'expired' => 'secondary', 'not_selected' => 'danger', 'rejected' => 'danger', default => 'warning', }; $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', ]; @endphp
@if (session('success'))
{{ session('success') }}
@endif @if (session('warning'))
{{ session('warning') }}
@endif
{{-- Left Side --}}
{{-- Gallery --}}

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

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

{{ __($statusLabel) }}
{{ __('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(in_array($offer->status, ['accepted', 'contact_requested']))
{{ __('Contact Available') }}
@php $sellerImage = !empty($seller?->profile_image) ? asset($seller->profile_image) : asset('assets/admin/img/propics/blank_user.jpg'); @endphp
Seller

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

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

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

@endif
{{ __('Your Offer Details') }}
{{ __('Offer Status') }}
{{ __($statusLabel) }} @if(in_array($offer->status, ['accepted', 'contact_requested']))
{{ __('You can now contact the seller directly.') }}
@endif
{{ __('Offer Price') }}
@if(!empty($offer->offer_price)) ${{ number_format($offer->offer_price, 2) }} @else - @endif
{{ __('Sent On') }}
{{ optional($offer->created_at)->format('d M Y h:i A') }}
@if(!empty($offer->accepted_at))
{{ __('Contact Available Since') }}
{{ optional($offer->accepted_at)->format('d M Y h:i A') }}
@endif @if(!empty($offer->rejected_at))
{{ __('Updated On') }}
{{ optional($offer->rejected_at)->format('d M Y h:i A') }}
@endif
{{ __('Message') }}
{{ !empty($offer->message) ? $offer->message : '-' }}
{{ __('Back to My Offers') }} @if(!in_array($offer->status, ['accepted', 'contact_requested', 'expired']))
@csrf @method('DELETE')
@endif
@endsection @section('scripts') @endsection