@push('title') View Product: {{ $product->name }} @endpush

Products / View Details

@can('update_product_management') @endcan
{{-- General Information --}}
General Information
Product Name
{{ $product->name }}
Product Code
{{ $product->code }}
Brand
{{ $product->brand->name ?? 'N/A' }}
Category
{{ $product->category->name ?? 'N/A' }}
Variation
{{ $product->variation->name ?? 'Single' }}
Status
@if($product->status == \App\Models\Product::RECEIVED) Received @elseif($product->status == \App\Models\Product::ORDERED) Ordered @else Pending @endif {{ ucfirst($product->product_type) }}
{{-- Inventory Configuration --}}
Inventory Configuration
Base Unit
{{ $product->baseUnit->name ?? 'N/A' }}
Sale Unit
{{ $product->saleUnit->name ?? 'N/A' }}
Purchase Unit
{{ $product->purchaseUnit->name ?? 'N/A' }}
Default Warehouse
{{ $product->warehouse->name ?? 'N/A' }}
Primary Supplier
{{ $product->supplier->name ?? 'N/A' }}
{{-- Stock & Batch Details --}}
Stock & Batch Details
@php $allBatches = $systemWideBatches->sortByDesc('id'); @endphp @foreach($allBatches as $batch) @php $pv = $batch->productVariation; @endphp @endforeach @if($allBatches->count() == 0) @endif
Warehouse Variation Barcode Batch No Cost (LKR) Retail (LKR) Wholesale (LKR) Stock
{{ $batch->warehouse->name ?? 'N/A' }} @if($batch->warehouse_id == $product->warehouse_id) Current @endif {{ $pv->variation_id ? ($pv->variationType->name ?? 'N/A') : 'Default' }} {{ $pv->barcode ?? 'N/A' }} {{ $batch->batch_no }} {{ number_format($batch->cost_price, 2) }} {{ number_format($batch->retail_price, 2) }} {{ number_format($batch->wholesale_price, 2) }} {{ number_format($batch->current_stock) }} units
No active stock batches found.
@if($product->note)
Additional Notes

{{ $product->note }}

@endif {{-- Price History --}}
Price History
@forelse($product->priceHistories as $history) @php $pv = $history->productVariation; $pb = $history->productBatch; @endphp @empty @endforelse
Date Variation Type Batch No Old Pricing (LKR) New Pricing (LKR) Changed By
{{ $history->created_at->format('Y-m-d H:i') }} {{ ($pv && $pv->variation_id) ? ($pv->variationType->name ?? 'N/A') : 'Default' }} {{ $pb->batch_no ?? 'N/A' }}
Cost: {{ number_format($history->old_cost_price, 2) }}
Retail: {{ number_format($history->old_retail_price, 2) }}
Wholesale: {{ number_format($history->old_wholesale_price, 2) }}
Cost: {{ number_format($history->new_cost_price, 2) }}
Retail: {{ number_format($history->new_retail_price, 2) }}
Wholesale: {{ number_format($history->new_wholesale_price, 2) }}
{{ $history->user->name ?? 'System' }}
No price history found.
{{-- Purchase Returns History --}}
Purchase Returns History
@forelse($purchaseReturns as $returnItem) @empty @endforelse
Date PR Code Warehouse Supplier Variation / Batch Qty Returned Status
{{ date('Y-m-d', strtotime($returnItem->purchaseReturn->return_date)) }} @can('view_purchase_return_management') {{ $returnItem->purchaseReturn->pr_code }} @else {{ $returnItem->purchaseReturn->pr_code }} @endcan {{ $returnItem->purchaseReturn->warehouse->name ?? 'N/A' }} {{ $returnItem->purchaseReturn->supplier->name ?? 'N/A' }}
{{ $returnItem->variationType->name ?? 'Default' }}
@if($returnItem->batch)
Batch: {{ $returnItem->batch->batch_no }}
@endif
-{{ number_format($returnItem->qty, 0) }} @if($returnItem->purchaseReturn->status == \App\Models\PurchaseReturn::SENT) Sent @else Pending @endif
No purchase returns recorded for this product.
{{-- Transfer History --}}
Internal Transfer History
@forelse ($transferItems as $transferItem) @php $transfer = $transferItem->transfer; @endphp @empty @endforelse
Date Reference From To Variation / Batch Qty Status
{{ date('Y-m-d', strtotime($transfer->transfer_date)) }} @can('view_transfers_management') {{ $transfer->reference_no }} @else {{ $transfer->reference_no }} @endcan {{ $transfer->fromWarehouse->name ?? 'N/A' }} {{ $transfer->toWarehouse->name ?? 'N/A' }} {{ $transferItem->variationType->name ?? 'Default' }} @if($transferItem->batch)
Batch: {{ $transferItem->batch->batch_no }}
@endif
{{ number_format($transferItem->quantity, 0) }} @if($transfer->transfer_status == \App\Models\Transfer::COMPLETED) Completed @else Pending @endif
No internal transfers recorded.
{{-- Stock Summary Card --}}
Stock Breakdown by Warehouse
@php $whStockGroups = $systemWideBatches->groupBy('warehouse_id'); @endphp @foreach($whStockGroups as $whId => $batches) @php $wh = $batches->first()->warehouse; @endphp
{{ $wh->name ?? 'Unknown' }}
{{ $batches->count() }} active batches
{{ number_format($batches->sum('current_stock')) }}
@endforeach

Global System-wide Total

{{ number_format($systemWideBatches->sum('current_stock')) }}

{{-- Last Pricing Card --}}
Master Pricing
@foreach($product->variations as $pv) @endforeach
{{ $pv->variation_id ? ($pv->variationType->name ?? 'N/A') : 'Product' }} LKR {{ number_format($pv->price_retail, 2) }}
Calculated based on the latest active batch.
{{-- System Stats --}}
Metadata
Created: {{ $product->created_at->format('Y-M-d H:i') }}
By: {{ $product->createdBy->name ?? 'System' }}
@if($product->updated_at > $product->created_at)
Updated: {{ $product->updated_at->format('Y-M-d H:i') }}
@endif