@extends('layouts.admin') @section('title', $vehicle->name) @section('header-back')Back@endsection @section('header-title', $vehicle->name) @section('content') @php $statusColors = ['available' => 'bg-emerald-400/20 text-emerald-100 ring-emerald-300/30', 'reserved' => 'bg-amber-400/20 text-amber-100 ring-amber-300/30', 'on_trip' => 'bg-blue-300/20 text-blue-100 ring-blue-200/30', 'under_maintenance' => 'bg-orange-400/20 text-orange-100 ring-orange-300/30', 'inactive' => 'bg-white/15 text-white/80 ring-white/20']; $vehicleImages = collect([$vehicle->image_path, $vehicle->image_path_2, $vehicle->image_path_3, $vehicle->image_path_4])->filter(); $complianceDocuments = [ ['Insurance', $vehicle->insurance_expiry, $vehicle->insurance_document_path], ['Permit', $vehicle->permit_expiry, $vehicle->permit_document_path], ['Fitness certificate', $vehicle->fitness_expiry, $vehicle->fitness_document_path], ['Pollution certificate', $vehicle->pollution_expiry, $vehicle->pollution_document_path], ]; @endphp
@if($vehicle->image_path){{ $vehicle->name }}@else@endif

{{ $vehicle->registration_number }}

{{ str($vehicle->status)->replace('_', ' ')->title() }}

{{ $vehicle->vehicle_type }} ยท {{ trim($vehicle->brand.' '.$vehicle->model) ?: 'Brand/model not provided' }}

{{ $vehicle->seating_capacity }} seats

Edit vehicle

Current reading

{{ number_format($vehicle->current_km) }} km

Seating capacity

{{ $vehicle->seating_capacity }} seats

Buy date

{{ $vehicle->buy_date ? $vehicle->buy_date->format('d M Y') : 'Not set' }}

Last updated

{{ $vehicle->updated_at->format('d M Y, h:i A') }}

Compliance documents

Vehicle certificates and expiry dates

@foreach($complianceDocuments as [$label, $expiry, $path]) @php $isExpired = $expiry && $expiry->isPast(); $expiresSoon = $expiry && ! $isExpired && now()->diffInDays($expiry, false) <= 30; @endphp
@if($expiry) {{ $isExpired ? 'Expired' : ($expiresSoon ? 'Expiring soon' : 'Valid') }} @endif

{{ $label }}

{{ $expiry ? 'Expires '.$expiry->format('d M Y') : 'Expiry date not added' }}

@if($path) View document @else

No document uploaded

@endif
@endforeach

Vehicle images

Main image and any optional gallery photos

@if($vehicleImages->isNotEmpty())
@foreach($vehicleImages as $imagePath){{ $vehicle->name }}@endforeach
@else

No vehicle image uploaded

@endif

Vehicle notes

{{ $vehicle->notes ?: 'No notes have been added.' }}

@endsection