@extends('layouts.bootstrap') @section('title', 'Product: ' . $product->name) @section('header')

{{ $product->name }}

@if(auth()->user()->canManage()) Edit @endif Back to Products
@endsection @section('content')
Product Details
@if($product->isComplete()) Complete ({{ $product->getCompletionPercentage() }}%) @else Incomplete ({{ $product->getCompletionPercentage() }}%) @if(auth()->user()->canManage()) Complete Details @endif @endif
Name: {{ $product->name }}
Category: @if($product->category) {{ $product->category->name }} @else Not specified Missing @endif
Subcategory: @if($product->subcategory) {{ $product->subcategory->name }} @else Not specified Missing @endif
Country of Origin: @if($product->country_of_origin) {{ $product->country_of_origin }} @else Not specified Missing @endif
@if($product->measurement_unit) @else @endif
Price: @if($product->price) ${{ number_format($product->price, 2) }} @else Not specified Missing @endif
Measurement Unit: {{ $product->measurement_unit }}
Measurement Unit: Not specified Missing
Created By: {{ $product->creator->name }}
Updated By: {{ $product->updater->name }}
Created: {{ $product->created_at->format('M d, Y H:i') }}
Updated: {{ $product->updated_at->format('M d, Y H:i') }}
@if($product->description)
Description:

{{ $product->description }}

@endif
Quick Stats

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

Current Price

{{ $history->count() }}
Changes
{{ $product->created_at->diffInDays(now()) }}
Days Old
@if($history->count() > 0)
Change History
@foreach($history as $audit) @endforeach
Date Action Changed By Changes Reason
{{ $audit->created_at->format('M d, Y H:i') }} {{ ucfirst($audit->action) }} {{ $audit->user->name }} @if($audit->field_changes) @foreach($audit->field_changes as $field => $value) @if($field !== 'updated_at' && $field !== 'updated_by')
{{ ucfirst(str_replace('_', ' ', $field)) }}: @if($audit->action === 'updated' && isset($audit->field_changes[$field])) {{ $value }} @else {{ $value }} @endif
@endif @endforeach
@endif
@if($audit->reason) {{ $audit->reason }} @else - @endif
@endif @endsection