@extends('backend.layouts.layout') @section('content')

Product Details

@php // Separate color variation images from regular gallery images $colorVariationImages = $product->images->whereNotNull('color_code')->groupBy('color_code'); $galleryImages = $product->images->whereNull('color_code'); $hasColorVariations = $colorVariationImages->count() > 0; // Get primary or first image $primaryImage = $product->images->where('is_primary', true)->first() ?? $product->images->whereNull('color_code')->first() ?? $product->images->first(); @endphp @if($hasColorVariations)
Color Variations
@foreach($colorVariationImages as $colorCode => $colorImages) @php $firstColorImage = $colorImages->first(); $colorName = $firstColorImage->color_name ?? 'Color'; $stockQty = $firstColorImage->qty ?? 0; @endphp
{{ $colorName }} Stock: {{ $stockQty }}
@endforeach
@endif
@if($primaryImage)
@if($primaryImage->color_name)
{{ $primaryImage->color_name }} Stock: {{ $primaryImage->qty ?? 0 }}
@endif
@elseif($product->thumbnail) {{ $product->name }} @else

No Images Available

@endif
@if($hasColorVariations || $galleryImages->count() > 0)
@foreach($galleryImages as $image) @endforeach @foreach($colorVariationImages as $colorCode => $colorImages) @php $firstColorImage = $colorImages->first(); $colorName = $firstColorImage->color_name ?? 'Color'; @endphp @foreach($colorImages as $image)
{{ $image->alt_text ?? $colorName }}
@endforeach @endforeach
@endif

{{ $product->name }}

Status: {{ ucfirst($product->status) }} Stock: {{ ucfirst(str_replace('_', ' ', $product->stock_status)) }} @if($product->is_featured) Featured @endif @if($product->is_trending) Trending @endif @if($product->is_hot) Hot @endif @if($product->is_sale) On Sale @endif
SKU: {{ $product->sku_code }} |
@if($product->short_description)

{{ $product->short_description }}


@endif

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

@if($product->compare_price && $product->compare_price > $product->price)

{{ number_format($product->compare_price, 2) }} ({{ round((($product->compare_price - $product->price) / $product->compare_price) * 100) }}% OFF)

@endif
@if($product->cost_price)

Cost Price:
{{ number_format($product->cost_price, 2) }}

@endif

Product Details

@if($product->category) @endif @if($product->childCategory) @endif @if($product->subcategory) @endif @if($product->brand) @endif @if($product->seller) @endif
Category: {{ $product->category->name }}
SubCategory: {{ $product->childCategory->name }}
Sub-Subcategory: {{ $product->subcategory->name }}
Brand: {{ $product->brand->name }}
Seller: {{ $product->seller->name }}
@if($product->weight || $product->dimensions)

Physical Details

@if($product->weight) @endif @if($product->dimensions) @endif
Weight: {{ number_format($product->weight, 2) }} kg
Dimensions: {{ $product->dimensions }}
@endif
Created: {{ $product->created_at->format('d M Y, h:i A') }}
Last Updated: {{ $product->updated_at->format('d M Y, h:i A') }}
@endsection @push('styles') @endpush @push('scripts') @endpush