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

{{ $product->name }}

{{ $product->sku }}

{{ $product->short_description }}

@if($product->category) {{ $product->category->name }} @endif @if($product->brand) {{ $product->brand->name }} @endif @if($product->has_vat && $product->tax) {{ $product->tax->name }} ({{ $product->tax->rate }}%) @else Tax Exempt @endif @if($product->is_featured) Featured @endif @if($product->is_on_sale) On Sale @endif
Edit
KES {{ number_format($product->final_price, 2) }}
Current Price
@if($product->is_discounted) KES {{ number_format($product->sale_price, 2) }} ({{ $product->discount_percent ? $product->discount_percent.'% off' : 'Discounted' }}) @endif
{{ $product->stock }}
Current Stock
{{ Str::title(str_replace('_', ' ', $product->stock_status)) }}
{{ $product->available_stock }}
Available Stock
Reserved: {{ $product->reserved_stock }} | Committed: {{ $product->committed_stock }}
KES {{ number_format($product->profit_margin_percent, 1) }}%
Profit Margin
Profit: KES {{ number_format($product->profit_margin, 2) }}
{{ $product->has_vat && $product->tax ? $product->tax->rate.'%' : '0%' }}
Tax Rate
@if($product->has_vat && $product->tax) {{ $product->tax->name }} @else Tax Exempt @endif
Product Details
Product Name: {{ $product->name }}
SKU: {{ $product->sku }}
Barcode: {{ $product->barcode ?? 'N/A' }}
Reference #: {{ $product->ref_number ?? 'N/A' }}
Category: @if($product->category) {{ $product->category->name }} @else N/A @endif
Brand: {{ $product->brand->name ?? 'N/A' }}
Supplier: {{ $product->supplier->name ?? 'N/A' }}
Unit: {{ $product->unit->name ?? 'N/A' }}
Tax Status: @if($product->has_vat && $product->tax) {{ $product->tax->name }} ({{ $product->tax->rate }}%) @else Tax Exempt @endif
Status: {{ Str::title($product->status) }}
Created: {{ $product->created_at->format('M d, Y H:i') }}
Last Updated: {{ $product->updated_at->format('M d, Y H:i') }}
@if($product->description)
Description:

{{ $product->description }}

@endif
Stock Status
Current Stock {{ $product->stock }}
@php $maxStock = $product->maximum_stock ?: $product->stock * 2; $stockPercentage = $product->stock > 0 ? ($product->stock / $maxStock) * 100 : 0; @endphp
{{ $product->minimum_stock }}
Min Stock
{{ $product->reorder_point }}
Reorder Point
{{ $product->maximum_stock ?? '∞' }}
Max Stock
Quick Actions
@if($product->track_batches)
@endif
@if($product->track_batches)
{{ $batchStats['total_batches'] }}
Total Batches
{{ $batchStats['active_batches'] }}
Active Batches
{{ $batchStats['expiring_soon'] }}
Expiring Soon
{{ $batchStats['expired_batches'] }}
Expired Batches
Recent Batches View All
@if($product->batches->count() > 0)
@foreach($product->batches->take(10) as $batch) @php $batchStatus = 'active'; if($batch->current_quantity <= 0) { $batchStatus = 'empty'; } elseif($batch->expiry_date && $batch->expiry_date < now()) { $batchStatus = 'expired'; } elseif($batch->expiry_date && $batch->expiry_date <= now()->addDays($product->expiry_warning_days ?? 30)) { $batchStatus = 'expiring'; } @endphp @endforeach
Batch # Expiry Date Quantity Cost Price Sale Price Status Actions
{{ $batch->batch_number }} @if($batch->lot_number)
Lot: {{ $batch->lot_number }} @endif
@if($batch->expiry_date) {{ $batch->expiry_date->format('M d, Y') }}
{{ $batch->expiry_date->diffForHumans() }} @else No expiry @endif
{{ $batch->current_quantity }}
/ {{ $batch->initial_quantity }}
KES {{ number_format($batch->batch_cost_price, 2) }} KES {{ number_format($batch->batch_sale_price, 2) }} {{ Str::title($batchStatus) }}
@else
No batches found

This product has no batches yet.

Create First Batch
@endif
@else
Batch Tracking Not Enabled

This product is not configured for batch tracking.

Enable Batch Tracking
@endif
Recent Stock Movements
@if($stockMovements->count() > 0)
@foreach($stockMovements as $movement)
{{ $movement->reason }}

@if($movement->batch) Batch: {{ $movement->batch->batch_number }} @endif

{{ $movement->notes ?? 'No notes' }}

{{ $movement->movement_type == 'in' ? '+' : '-' }}{{ $movement->quantity }}
{{ $movement->created_at->format('M d, H:i') }}
@endforeach
@else

No stock movements recorded yet.

@endif
Stock Analytics
Stock Distribution
{{ $product->stock }}
Total Stock
{{ $product->available_stock }}
Available
{{ $product->reserved_stock + $product->committed_stock }}
Reserved/Committed
Reorder Status
@if($product->shouldReorder())
Reorder Needed!

Stock is below reorder point. Suggested reorder quantity: {{ $product->getReorderQuantity() }}

@else
Stock Level OK

Current stock is above reorder point.

@endif
Quick Stock Actions
Price Details
@if($product->wholesale_price) @endif @if($product->has_vat && $product->tax) @endif @if($product->is_discounted) @endif
Cost Price: KES {{ number_format($product->cost_price, 2) }}
Sale Price: KES {{ number_format($product->sale_price, 2) }}
Wholesale Price: KES {{ number_format($product->wholesale_price, 2) }}
Final Price (Excl. Tax): KES {{ number_format($product->final_price, 2) }}
Tax Amount ({{ $product->tax->rate }}%): KES {{ number_format($product->final_price * ($product->tax->rate / 100), 2) }}
Final Price (Incl. Tax): KES {{ number_format($product->final_price * (1 + $product->tax->rate / 100), 2) }}
Discount: KES {{ number_format($product->discount_amount, 2) }} @if($product->discount_percent) ({{ $product->discount_percent }}%) @endif
Profit Margin: {{ number_format($product->profit_margin_percent, 1) }}%
KES {{ number_format($product->profit_margin, 2) }}
Tax Status: @if($product->has_vat && $product->tax) {{ $product->tax->name }} ({{ $product->tax->rate }}%) @else Tax Exempt @endif
Last Price Update: @if($product->price_last_updated_at) {{ $product->price_last_updated_at->format('M d, Y H:i') }} @else Never @endif
Recent Price Changes
@if($product->priceHistories->count() > 0)
@foreach($product->priceHistories as $history)
{{ Str::title(str_replace('_', ' ', $history->price_type)) }}

{{ $history->change_reason }} @if($history->notes) - {{ $history->notes }} @endif

KES {{ number_format($history->old_price, 2) }} → KES {{ number_format($history->new_price, 2) }}
{{ $history->created_at->format('M d, H:i') }}
@endforeach
@else

No price changes recorded yet.

@endif
Tax Details
@if($product->has_vat && $product->tax) @else @endif
Tax Status: {{ $product->has_vat ? 'Taxable' : 'Tax Exempt' }}
Tax Name: {{ $product->tax->name }}
Tax Rate: {{ $product->tax->rate }}%
Tax Code: {{ $product->tax->code ?? 'N/A' }}
Tax Description: {{ $product->tax->description ?? 'No description' }}
Is Active: {{ $product->tax->is_active ? 'Active' : 'Inactive' }}
Tax Exempt Product

This product is not subject to any taxes.

Configure Tax
@if($product->has_vat && $product->tax)
Quick Actions
@endif
Tax Calculator
@if($product->has_vat && $product->tax && isset($taxExamples))
Description Amount (KES)
Unit Price (Excl. Tax) {{ number_format($product->final_price, 2) }}
Tax Rate ({{ $product->tax->rate }}%) {{ $product->tax->rate }}%
Tax Amount per Unit {{ number_format($taxExamples['single_unit']['tax_amount'], 2) }}
Unit Price (Incl. Tax) {{ number_format($taxExamples['single_unit']['price_with_tax'], 2) }}
Total Price for 1 unit(s) {{ number_format($product->final_price, 2) }}
Total Tax Amount {{ number_format($taxExamples['single_unit']['tax_amount'], 2) }}
Total Amount (Incl. Tax) {{ number_format($taxExamples['single_unit']['price_with_tax'], 2) }}
Tax calculations are based on the final price after discounts.
@else
No Tax Calculator Available

This product is tax-exempt.

Configure Tax
@endif
@if($product->has_vat && $product->tax && isset($taxExamples))
Common Tax Examples
Single Unit Sale
Unit Price: KES {{ number_format($taxExamples['single_unit']['price_excl_tax'], 2) }}
Tax ({{ $product->tax->rate }}%): KES {{ number_format($taxExamples['single_unit']['tax_amount'], 2) }}

Total: KES {{ number_format($taxExamples['single_unit']['price_with_tax'], 2) }}
Bulk Sale (10 Units)
Subtotal: KES {{ number_format($taxExamples['ten_units']['price_excl_tax'], 2) }}
Tax ({{ $product->tax->rate }}%): KES {{ number_format($taxExamples['ten_units']['tax_amount'], 2) }}

Total: KES {{ number_format($taxExamples['ten_units']['price_with_tax'], 2) }}
Note: Tax is calculated on the final sale price. Discounts and promotions are applied before tax calculation.
@endif
@if($product->has_expiry)
Expiry Summary
@if($expirySummary['alert_level'] == 'critical') Expired Stock Detected @elseif($expirySummary['alert_level'] == 'warning') Stock Expiring Soon @else Expiry Status Normal @endif

@if($expirySummary['alert_level'] == 'critical') {{ $expirySummary['expired_quantity'] }} units have expired. @elseif($expirySummary['alert_level'] == 'warning') {{ $expirySummary['expiring_soon_quantity'] }} units expiring within {{ $product->expiry_warning_days }} days. @else All stock is valid. @endif

{{ $expirySummary['valid_quantity'] }}
Valid Stock Quantity
Expired: {{ $expirySummary['expired_quantity'] }} Expiring: {{ $expirySummary['expiring_soon_quantity'] }}
@if($expirySummary['alert_level'] != 'normal')
Recommended Action: Consider setting discounts for expiring stock.
@endif
Expiry Settings
Expiry Tracking: {{ $product->has_expiry ? 'Enabled' : 'Disabled' }}
Batch Tracking: {{ $product->track_batches ? 'Enabled' : 'Disabled' }}
Expiry Warning Days: {{ $product->expiry_warning_days }} days
Last Expiry Check: @if($product->stock_last_updated_at) {{ $product->stock_last_updated_at->format('M d, Y H:i') }} @else Never @endif
Expiry Distribution
{{ $expirySummary['valid_quantity'] }}
Valid
{{ $expirySummary['expiring_soon_quantity'] }}
Expiring Soon
{{ $expirySummary['expired_quantity'] }}
Expired
@endif
@if($product->has_expiry) @endif @endsection @section('script') @endsection