@extends('layouts.app') @section('title', $product->name) @section('content')
{{-- Breadcrumb --}}
{{-- Product Images --}}
{{ $product->name }}
@if($product->images->count() > 0)
@foreach($product->images as $image) @endforeach
@endif
{{-- Product Info --}}
@if($product->brand) {{ $product->brand->name }} @endif

{{ $product->name }}

@auth
@csrf
@endauth
{{-- Rating --}}
@for($i = 1; $i <= 5; $i++) @endfor
({{ $product->reviews->where('is_approved', true)->count() }} reviews)
{{-- Price --}}
@if($product->sale_price) ${{ number_format($product->sale_price, 2) }} ${{ number_format($product->price, 2) }} {{ round((($product->price - $product->sale_price) / $product->price) * 100) }}% OFF @else ${{ number_format($product->price, 2) }} @endif
{{-- Stock & Condition --}}
{{ $product->isInStock() ? '✓ In Stock (' . $product->stock_quantity . ' available)' : '✗ Out of Stock' }} Condition: {{ $product->condition }}
{{-- Part Numbers --}} @if($product->part_number || $product->oem_number)
@if($product->part_number)

Part Number: {{ $product->part_number }}

@endif @if($product->oem_number)

OEM Number: {{ $product->oem_number }}

@endif
@endif {{-- Car Compatibility --}} @if($product->carYears->count() > 0)

Compatible Vehicles:

@foreach($product->carYears->take(10) as $carYear) {{ $carYear->model->make->name }} {{ $carYear->model->name }} {{ $carYear->year }} @endforeach @if($product->carYears->count() > 10) +{{ $product->carYears->count() - 10 }} more @endif
@endif {{-- Add to Cart --}} @if($product->isInStock())
@csrf
@endif {{-- Vendor --}}
{{-- Tabs: Description, Specs, Reviews --}}
{!! nl2br(e($product->description ?? $product->short_description ?? 'No description available.')) !!}
{{-- Related Products --}} @if($relatedProducts->count() > 0)

Related Products

@foreach($relatedProducts as $product) @include('components.product-card', ['product' => $product]) @endforeach
@endif
@push('scripts') @endpush @endsection