@extends('admin.layouts.home') @section('title', 'Product Details') @section('styles') @endsection @section('content')

Product Details

Back to Products
@if($product->images && count(json_decode($product->images)) > 0) {{ $product->name }} @elseif($product->thumbnail) {{ $product->name }} @else
@endif
@if($product->images && count(json_decode($product->images)) > 1)
@foreach(json_decode($product->images) as $index => $image) {{ $product->name }} image {{ $index + 1 }} @endforeach
@endif
Product Information

{{ $product->name }}

@php $statusClass = [ 'active' => 'bg-success', 'inactive' => 'bg-danger', 'pending' => 'bg-warning text-dark', ][$product->status] ?? 'bg-secondary'; @endphp {{ ucfirst($product->status) }} SKU: {{ $product->sku ?? 'N/A' }}

${{ number_format($product->price, 2) }}

Category

{{ $product->category->name ?? 'Uncategorized' }}

Store

@if($product->store) {{ $product->store->name }} @else N/A @endif

Stock

@if($product->stock > 10) {{ $product->stock }} in stock @elseif($product->stock > 0) {{ $product->stock }} in stock (Low) @else Out of stock @endif

Orders

{{ $product->orders_count ?? 0 }} orders

Description

{{ $product->description ?? 'No description available.' }}

Created At

{{ $product->created_at->format('M d, Y H:i') }}

Last Updated

{{ $product->updated_at->format('M d, Y H:i') }}

@if($product->specifications)
Specifications
@foreach(json_decode($product->specifications, true) ?? [] as $key => $value) @endforeach
{{ $key }} {{ $value }}
@endif
@if($product->reviews->isEmpty())
No reviews yet for this product.
@else @foreach($product->reviews as $review)
@if($review->user && $review->user->avatar) {{ $review->user->name }} @else
@endif
{{ $review->user->name ?? 'Anonymous' }}
@for($i = 1; $i <= 5; $i++) @if($i <= $review->rating) @else @endif @endfor
{{ $review->created_at->format('M d, Y') }}
@csrf @method('DELETE')

{{ $review->review }}

@endforeach @endif
Order history for this product will be displayed here.
@if(count($relatedProducts) > 0)
Related Products
@foreach($relatedProducts as $relatedProduct)
@endforeach
@endif
@endsection @section('scripts') @endsection