@extends('layouts.app') @section('style') @endsection @section('content')
{{ $product->name }}
SKU {{ $product->sku }}
Current Cost Price ${{ number_format($product->cost_price, 2) }}
Current Sale Price ${{ number_format($product->sale_price, 2) }}
{{ number_format($product->profit_margin, 1) }}%
Profit Margin
Total Changes
{{ $priceHistories->total() }}
All time
Last 30 Days
{{ PriceHistory::where('product_id', $product->id) ->where('created_at', '>=', now()->subDays(30)) ->count() }}
Recent changes
Highest Price
${{ number_format(PriceHistory::where('product_id', $product->id) ->where('price_type', 'sale_price') ->max('new_price') ?? $product->sale_price, 2) }}
Sale price
Lowest Price
${{ number_format(PriceHistory::where('product_id', $product->id) ->where('price_type', 'sale_price') ->min('new_price') ?? $product->sale_price, 2) }}
Sale price
Price History
@if($priceHistories->isEmpty())
No price history found

This product's prices haven't been changed yet.

@else
@foreach($priceHistories as $history) @php $change = $history->new_price - $history->old_price; $percentChange = $history->old_price > 0 ? ($change / $history->old_price) * 100 : 0; @endphp @endforeach
Date & Time Price Type Old Price New Price Change Changed By Reason Notes
{{ $history->created_at->format('Y-m-d') }}
{{ $history->created_at->format('H:i:s') }}
{{ $history->price_type_label }} ${{ number_format($history->old_price, 2) }} ${{ number_format($history->new_price, 2) }}
@if($change > 0) +${{ number_format($change, 2) }} +{{ number_format($percentChange, 1) }}% @elseif($change < 0) -${{ number_format(abs($change), 2) }} {{ number_format($percentChange, 1) }}% @else No Change @endif
{{ $history->user->name ?? 'System' }} {{ $history->change_reason }} @if($history->notes) {{ $history->notes }} @else - @endif
Showing {{ $priceHistories->firstItem() }} to {{ $priceHistories->lastItem() }} of {{ $priceHistories->total() }} entries
@endif
@endsection @section('script') @endsection