@extends('layout.app')
@section('title', 'Asset History - ' . $asset->asset_no)
@section('content')
{{-- Asset Overview Card --}}
| 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 --}}
| Date |
Type |
Cost |
@forelse($asset->repairs as $repair)
| {{ date('d-M-Y', strtotime($repair->date)) }} |
{{ $repair->repair_type }} |
{{ number_format($repair->cost, 2) }} |
@empty
| No repairs recorded. |
@endforelse
{{-- Fitment History Card --}}
| Vehicle |
Position |
In Date |
In KM |
Out KM |
Life KM |
Status |
@forelse($asset->fitments as $fit)
| {{ $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
|
@empty
|
No fitment history found for this asset.
|
@endforelse
@endsection