@extends('layout.app') @section('title', 'Asset History - ' . $asset->asset_no) @section('content')
{{-- Asset Overview Card --}}
Asset Overview
Serial Number: {{ $asset->asset_no }}
Product: {{ $asset->product->product_name }}
Brand: {{ $asset->brand->name ?? 'N/A' }}
Purchase Rate: {{ number_format($asset->purchase_rate, 2) }}
Current Status: @php $statusMapping = [ 'in_stock' => ['label' => 'In Stock', 'class' => 'bg-success'], 'fitted' => ['label' => 'Fitted', 'class' => 'bg-info'], 'retreading' => ['label' => 'Retreading', 'class' => 'bg-warning'], 'scrapped' => ['label' => 'Scrapped', 'class' => 'bg-danger'], 'lost' => ['label' => 'Lost', 'class' => 'bg-dark'], ]; $currStatus = $statusMapping[$asset->status] ?? ['label' => $asset->status, 'class' => 'bg-secondary']; @endphp {{ $currStatus['label'] }}
Total Lifecycle KM: {{ number_format($asset->total_lifecycle_km) }} KM
{{-- Repair History Card --}}
Repair & Retreading History
@forelse($asset->repairs as $repair) @empty @endforelse
Date Type Cost
{{ date('d-M-Y', strtotime($repair->date)) }} {{ $repair->repair_type }} {{ number_format($repair->cost, 2) }}
No repairs recorded.
{{-- Fitment History Card --}}
Fitment & Usage History
@forelse($asset->fitments as $fit) @empty @endforelse
Vehicle Position In Date In KM Out KM Life KM Status
{{ $fit->vehicle->vehicle_no ?? 'N/A' }} {{ $fit->position->name ?? 'N/A' }} {{ date('d-M-Y', strtotime($fit->fitment_date)) }} {{ number_format($fit->current_km) }} {{ $fit->old_km ? number_format($fit->old_km) : '-' }} @if($fit->km_life) {{ number_format($fit->km_life) }} KM @elseif($fit->status == 'fitted') Ongoing @else - @endif @if($fit->status == 'fitted') Active @else Removed @endif
No fitment history found for this asset.
@endsection