@extends('layouts.app') @section('content')

{{ $product->name }}

Product Details

Edit Product Back to Products
Product Information
Product Name
{{ $product->name }}
Product ID
{{ $product->id }}
Category
@if($product->category) {{ $product->category->name }} @else No Category @endif
Supplier
@if($product->supplier) {{ $product->supplier->name }} @else No Supplier @endif
Purchase Price
BDT{{ number_format($product->purchase_price ?? 0, 2) }}
Sale Price
BDT{{ number_format($product->sale_price ?? 0, 2) }}
Current Stock
{{ $product->quantity }}
Created
{{ $product->created_at->format('M d, Y') }}
Last Updated
{{ $product->updated_at->format('M d, Y') }}
Stock Entries {{ $product->stockEntries->count() }}
@if($product->stockEntries->count() > 0)
@foreach($product->stockEntries as $entry) @endforeach
Date Quantity Purchase Price Supplier
{{ $entry->date ? \Carbon\Carbon::parse($entry->date)->format('M d, Y') : 'N/A' }} {{ $entry->quantity }} BDT{{ number_format($entry->purchase_price ?? 0, 2) }} @if($entry->supplier) {{ $entry->supplier->name }} @else N/A @endif
@else

No stock entries found

@endif
Sales History {{ $product->sales->count() }}
@if($product->sales->count() > 0)
@foreach($product->sales as $sale) @endforeach
Date Quantity Sale Price Customer
{{ $sale->date ? \Carbon\Carbon::parse($sale->date)->format('M d, Y') : 'N/A' }} {{ $sale->quantity }} BDT{{ number_format($sale->sale_price ?? 0, 2) }} {{ $sale->customer_name ?? 'Walk-in' }}
@else

No sales history found

@endif
Quick Stats
Total Stock Entries
{{ $product->stockEntries->count() }}
Total Sales
{{ $product->sales->count() }}
Total Sold Quantity
{{ $product->sales->sum('quantity') }}
Total Revenue
BDT{{ number_format($product->sales->sum(function($sale) { return $sale->quantity * ($sale->sale_price ?? 0); }), 2) }}
@endsection