@extends('layouts.admin-simple') @section('title', 'Material Details - ' . $item->item_code) @section('breadcrumb') @endsection @section('page-title')

{{ $item->item_code }} - Detailed Analysis

{{ $item->item_description }}

arrow_back Back to Report
@endsection @section('content')
info Material Information
Material Code: {{ $item->item_code }}
Description: {{ $item->item_description }}
Category: {{ $item->category->category_name ?? 'Unknown' }}
Unit of Measure: {{ $item->unit_of_measure }}
Total Quantity: {{ number_format($totalQuantity, 2) }} {{ $item->unit_of_measure }}
Total Value: AED {{ number_format($totalValue, 2) }}
FOC Estimated Value: AED {{ number_format($estimatedFocValue, 2) }}
Purchase History: {{ $pricingHistory->count() }} purchase operations
Storage Locations: Warehouse: {{ $warehouseInventory->groupBy('location')->count() }} divisions | Projects: {{ $projectSummary->count() }} projects | FOC: {{ $focSummary->count() }} sources
attach_money Purchase Price History ({{ $pricingHistory->count() }} records)
@forelse($pricingHistory as $purchase) @empty @endforelse
Date Operation Supplier Quantity Unit Price (Original) Unit Price (د.إ) Total Value (د.إ) Batch
{{ $purchase->date->format('d M, Y') }} {{ $purchase->operation_number }} {{ $purchase->supplier }} {{ number_format($purchase->quantity, 2) }} {{ $purchase->currency }} {{ number_format($purchase->original_unit_price, 2) }} AED {{ number_format($purchase->unit_price, 2) }} AED {{ number_format($purchase->total_price, 2) }} {{ $purchase->batch_number ?: '-' }}
No purchase history found
@if($projectSummary->count() > 0)
business Materials on Projects ({{ $projectSummary->count() }} projects)
@foreach($projectSummary as $project) @endforeach
Project Name Available Quantity Allocated Quantity Available for Transfer Total Value Batches
{{ $project['project_name'] }} {{ number_format($project['total_quantity'], 2) }} {{ $item->unit_of_measure }} {{ number_format($project['allocated_quantity'], 2) }} {{ $item->unit_of_measure }} {{ number_format($project['available_for_transfer'], 2) }} {{ $item->unit_of_measure }} AED {{ number_format($project['total_value'], 2) }} {{ $project['batches_count'] }}
@endif @if($focSummary->count() > 0)
volunteer_activism FOC Materials ({{ $focSummary->count() }} sources) Free of Charge
@foreach($focSummary as $foc) @endforeach
Source Project Available Quantity Reserved Quantity Net Available Estimated Value Recoverable Value Batches
{{ $foc['project_name'] }} {{ number_format($foc['total_quantity'], 2) }} {{ $item->unit_of_measure }} {{ number_format($foc['reserved_quantity'], 2) }} {{ $item->unit_of_measure }} {{ number_format($foc['net_available'], 2) }} {{ $item->unit_of_measure }} AED {{ number_format($foc['estimated_value'], 2) }} AED {{ number_format($foc['recoverable_value'], 2) }} {{ $foc['batches_count'] }}
@endif
inventory_2 Warehouse Inventory ({{ $warehouseInventory->count() }} batches)
@forelse($warehouseInventory as $inventory) @empty @endforelse
Division Batch Number Quantity Unit Price Total Value Production Date Expiry Date Days to Expiry Status
{{ $inventory['location'] }} {{ $inventory['batch_number'] ?: '-' }} {{ number_format($inventory['quantity_available'], 2) }} {{ $item->unit_of_measure }} AED {{ number_format($inventory['unit_price'], 2) }} AED {{ number_format($inventory['total_value'], 2) }} {{ $inventory['production_date'] ? $inventory['production_date']->format('d M, Y') : '-' }} @if($inventory['expiry_date']) {{ $inventory['expiry_date']->format('d M, Y') }} @else - @endif @if($inventory['days_until_expiry'] !== null) @if($inventory['days_until_expiry'] < 0) Expired ({{ abs($inventory['days_until_expiry']) }} days ago) @elseif($inventory['days_until_expiry'] <= 30) {{ $inventory['days_until_expiry'] }} days @else {{ $inventory['days_until_expiry'] }} days @endif @else - @endif {{ ucfirst(str_replace('_', ' ', $inventory['status'])) }}
No warehouse inventory found
@if($projectInventory->count() > 0)
assignment Detailed Project Allocation ({{ $projectInventory->count() }} allocations)
@foreach($projectInventory as $inventory) @endforeach
Project Name Available Allocated Transferable Unit Price Total Value Status
{{ $inventory['location'] }} {{ number_format($inventory['quantity_available'], 2) }} {{ $item->unit_of_measure }} {{ number_format($inventory['allocated_quantity'], 2) }} {{ $item->unit_of_measure }} {{ number_format($inventory['available_for_transfer'], 2) }} {{ $item->unit_of_measure }} AED {{ number_format($inventory['unit_price'], 2) }} AED {{ number_format($inventory['total_value'], 2) }} {{ ucfirst(str_replace('_', ' ', $inventory['status'])) }}
@endif @if($focInventory->count() > 0)
healing Detailed FOC Inventory ({{ $focInventory->count() }} batches)
@foreach($focInventory as $inventory) @endforeach
Source Condition Available Reserved Net Available Batch Production Expiry Est. Value Status
{{ $inventory['location'] }} @if($inventory['source_type'])
{{ ucfirst($inventory['source_type']) }} @endif
{{ ucfirst($inventory['condition']) }} @if($inventory['damage_severity'])
{{ $inventory['damage_severity'] }} damage @endif
{{ number_format($inventory['quantity_available'], 2) }} {{ $item->unit_of_measure }} {{ number_format($inventory['quantity_reserved'], 2) }} {{ $item->unit_of_measure }} {{ number_format($inventory['net_available'], 2) }} {{ $item->unit_of_measure }} {{ $inventory['batch_number'] ?: '-' }} {{ $inventory['production_date'] ? $inventory['production_date']->format('d M, Y') : '-' }} @if($inventory['expiry_date']) {{ $inventory['expiry_date']->format('d M, Y') }} @if($inventory['days_until_expiry'] !== null) @if($inventory['days_until_expiry'] < 0)
Expired @elseif($inventory['days_until_expiry'] <= 30)
{{ $inventory['days_until_expiry'] }} days @endif @endif @else - @endif
AED {{ number_format($inventory['estimated_value'], 2) }} @if($inventory['recoverable_value'] > 0)
Rec: AED {{ number_format($inventory['recoverable_value'], 2) }} @endif
{{ ucfirst($inventory['status']) }}
@endif
analytics Price Analysis
@if($pricingHistory->count() > 0)
Lowest Purchase Price: AED {{ number_format($pricingHistory->min('unit_price'), 2) }}
Highest Purchase Price: AED {{ number_format($pricingHistory->max('unit_price'), 2) }}
Average Purchase Price: AED {{ number_format($pricingHistory->avg('unit_price'), 2) }}
Current Weighted Average: AED {{ $totalQuantity > 0 ? number_format($totalValue / $totalQuantity, 2) : '0.00' }}
Price Variance: AED {{ number_format($pricingHistory->max('unit_price') - $pricingHistory->min('unit_price'), 2) }}
@else

No pricing data available

@endif
donut_large Material Distribution
@if($warehouseInventory->count() > 0)
store Warehouse Inventory
@foreach($warehouseInventory->groupBy('location') as $location => $items)
{{ $location }}
{{ $items->count() }} batches
{{ number_format($items->sum('quantity_available'), 2) }} {{ $item->unit_of_measure }}
AED {{ number_format($items->sum('total_value'), 2) }}
@endforeach
@endif @if($projectSummary->count() > 0)
business Project Allocations
@foreach($projectSummary as $project)
{{ $project['project_name'] }}
{{ $project['batches_count'] }} allocations
{{ number_format($project['total_quantity'], 2) }} {{ $item->unit_of_measure }}
AED {{ number_format($project['total_value'], 2) }}
{{ number_format($project['available_for_transfer'], 2) }} transferable
@endforeach
@endif @if($focSummary->count() > 0)
volunteer_activism FOC Materials
@foreach($focSummary as $foc)
{{ $foc['project_name'] }}
{{ $foc['batches_count'] }} batches
{{ number_format($foc['total_quantity'], 2) }} {{ $item->unit_of_measure }}
AED {{ number_format($foc['recoverable_value'], 2) }} recoverable
{{ number_format($foc['net_available'], 2) }} available
@endforeach
@endif @if($warehouseInventory->count() == 0 && $projectSummary->count() == 0 && $focSummary->count() == 0)

No material distribution data available

@endif
@endsection @push('styles') @endpush @push('scripts') @endpush