2026-02-19 22:05:20 +00:00

75 lines
3.8 KiB
PHP

@extends('layouts.app')
@section('title', 'Fleet')
@section('content')
<div class="flex justify-between items-center mb-6">
<div>
<h2 class="text-xl font-bold text-gray-800">Fleet Management</h2>
<p class="text-gray-500 text-sm">Manage your car fleet</p>
</div>
<a href="{{ route('cars.create') }}" class="bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 flex items-center gap-2 text-sm font-medium">
<i class="fas fa-plus"></i> Add Car
</a>
</div>
@if(session('success'))
<div class="bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg mb-4 text-sm">
{{ session('success') }}
</div>
@endif
<div class="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
<table class="w-full">
<thead class="bg-gray-50 border-b border-gray-200">
<tr>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Car</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">License Plate</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Daily Rate</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Status</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($cars as $car)
<tr class="hover:bg-gray-50">
<td class="px-5 py-4">
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-lg bg-blue-100 flex items-center justify-center">
<i class="fas fa-car text-blue-600"></i>
</div>
<div>
<p class="font-medium text-gray-800">{{ $car->brand }} {{ $car->model }}</p>
<p class="text-sm text-gray-500">{{ $car->year }} {{ $car->color }}</p>
</div>
</div>
</td>
<td class="px-5 py-4 text-gray-600 text-sm">{{ $car->license_plate }}</td>
<td class="px-5 py-4 text-gray-600 text-sm"> BHD {{ number_format($car->daily_rate, 0) }}/day</td>
<td class="px-5 py-4">
<span class="px-2.5 py-1 rounded-full text-xs font-medium
{{ $car->status == 'available' ? 'bg-green-100 text-green-700' :
($car->status == 'rented' ? 'bg-amber-100 text-amber-700' : 'bg-red-100 text-red-700') }}">
{{ ucfirst($car->status) }}
</span>
</td>
<td class="px-5 py-4">
<a href="{{ route('cars.show', $car) }}" class="text-blue-600 hover:text-blue-800 mr-3 text-sm"><i class="fas fa-eye"></i></a>
<a href="{{ route('cars.edit', $car) }}" class="text-gray-600 hover:text-gray-800 mr-3 text-sm"><i class="fas fa-edit"></i></a>
<form action="{{ route('cars.destroy', $car) }}" method="POST" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="text-red-600 hover:text-red-800 text-sm" onclick="return confirm('Are you sure?')"><i class="fas fa-trash"></i></button>
</form>
</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-5 py-8 text-center text-gray-500">No cars yet. Add your first car!</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@endsection