@extends('layouts.app') @section('title', $product->details->first()?->title ?? 'Product Details') @section('content')
{{-- Breadcrumb --}}

{{ $product->details->first()?->title ?? 'Untitled Product' }}

{{-- Product Header --}}
{{-- Product Image --}}
@if($product->images->isNotEmpty()) {{ $product->details->first()?->title ?? 'Product' }} @else
@endif
{{-- Product Info --}}
{{ ucfirst($product->product_type) }} {{ ucfirst(str_replace('_', ' ', $product->listing_type)) }} @if($product->is_promoted) Promoted @endif @if($product->is_special_offer) Special Offer @endif @if($product->is_free_product) Free @endif
{{ currency_symbol() }}{{ number_format($product->price, 2) }} @if($product->price_discounted > 0 && $product->price_discounted < $product->price) {{ currency_symbol() }}{{ number_format($product->price, 2) }} {{ currency_symbol() }}{{ number_format($product->price_discounted, 2) }} @endif
SKU: {{ $product->sku ?? 'N/A' }} | Currency: {{ $product->currency ?? 'NGN' }}
Status @if($product->is_rejected) Rejected @elseif($product->is_draft) Draft @elseif($product->status) Approved @else Pending @endif
Active {{ $product->is_active ? 'Active' : 'Inactive' }}
Stock {{ $product->stock > 0 ? $product->stock . ' available' : 'Out of stock' }}
Seller {{ $product->seller?->username ?? 'Unknown' }}
{{-- Quick Actions --}}
@if(!$product->is_deleted)
@csrf @method('PATCH')
@csrf @method('PATCH')
@csrf @method('PATCH')
@csrf @method('DELETE')
@else
@csrf @method('PATCH')
@endif
{{-- Stats Row --}}
@php $detailStats = [ ['label' => 'Total Orders', 'value' => $stats['total_orders'] ?? 0, 'icon' => 'fa-shopping-bag', 'color' => 'primary'], ['label' => 'Total Revenue', 'value' => '' . number_format($stats['total_revenue'] ?? 0, 2), 'icon' => 'fa-money-bill-wave', 'color' => 'success'], ['label' => 'Total Quantity Sold', 'value' => $stats['total_quantity'] ?? 0, 'icon' => 'fa-boxes', 'color' => 'info'], ['label' => 'Average Rating', 'value' => number_format($stats['average_rating'] ?? 0, 1) . ' ★', 'icon' => 'fa-star', 'color' => 'warning'], ['label' => 'Total Reviews', 'value' => $stats['total_reviews'] ?? 0, 'icon' => 'fa-comments', 'color' => 'secondary'], ['label' => 'Wishlist Count', 'value' => $stats['wishlist_count'] ?? 0, 'icon' => 'fa-heart', 'color' => 'danger'], ['label' => 'Pageviews', 'value' => $stats['pageviews'] ?? 0, 'icon' => 'fa-eye', 'color' => 'info'], ['label' => 'Affiliate Earnings', 'value' => '' . number_format($stats['affiliate_earnings'] ?? 0, 2), 'icon' => 'fa-link', 'color' => 'warning'], ]; @endphp @foreach($detailStats as $stat)

{{ $stat['label'] }}

{{ $stat['value'] }}
@endforeach
{{-- Tabs --}}
{{-- Overview Tab --}}
@include('admin.products.partials.tab-overview', ['product' => $product])
{{-- Images Tab --}}
@include('admin.products.partials.tab-images', ['product' => $product])
{{-- Sales Tab --}}
@include('admin.products.partials.tab-sales', ['salesData' => $salesData, 'stats' => $stats])
{{-- Reviews Tab --}}
@include('admin.products.partials.tab-reviews', ['product' => $product, 'reviewsSummary' => $reviewsSummary])
{{-- Timeline Tab --}}
@include('admin.products.partials.tab-timeline', ['timeline' => $timeline])
{{-- Digital Files Tab --}} @if($product->product_type === 'digital')
@include('admin.products.partials.tab-files', ['product' => $product])
@endif {{-- Licenses Tab --}} @if($product->listing_type === 'license_key')
@include('admin.products.partials.tab-licenses', ['product' => $product])
@endif
{{-- Reject Modal --}} {{-- Update Stock Modal --}} @endsection @push('styles') @endpush @push('scripts') @endpush