Initial commit - Car Rental Management System

This commit is contained in:
Innovator committed 2026-02-19 22:05:20 +00:00
commit f72173377a
100 files changed
+15201

No files matched your search

+63
View File
@@ -0,0 +1,63 @@
@extends('layouts.app')
@section('title', 'Add Car')
@section('content')
<div class="mb-8">
<a href="{{ route('cars.index') }}" class="text-blue-600 hover:text-blue-800 flex items-center gap-2 mb-4">
<i class="fas fa-arrow-left"></i> Back to Fleet
</a>
<h2 class="text-3xl font-bold text-gray-800">Add New Car</h2>
<p class="text-gray-500">Add a new car to your fleet</p>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
<form action="{{ route('cars.store') }}" method="POST">
@csrf
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Brand</label>
<input type="text" name="brand" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Model</label>
<input type="text" name="model" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Year</label>
<input type="text" name="year" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">License Plate</label>
<input type="text" name="license_plate" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Color</label>
<input type="text" name="color" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Daily Rate (BHD)</label>
<input type="number" name="daily_rate" step="0.01" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Status</label>
<select name="status" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="available">Available</option>
<option value="maintenance">Maintenance</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Mileage</label>
<input type="number" name="mileage" value="0" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div class="md:col-span-2">
<label class="block text-sm font-medium text-gray-700 mb-2">Notes</label>
<textarea name="notes" rows="3" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
</div>
</div>
<div class="mt-6">
<button type="submit" class="bg-blue-600 text-white px-8 py-3 rounded-xl hover:bg-blue-700">Add Car</button>
</div>
</form>
</div>
@endsection
+64
View File
@@ -0,0 +1,64 @@
@extends('layouts.app')
@section('title', 'Edit Car')
@section('content')
<div class="mb-8">
<a href="{{ route('cars.index') }}" class="text-blue-600 hover:text-blue-800 flex items-center gap-2 mb-4">
<i class="fas fa-arrow-left"></i> Back to Fleet
</a>
<h2 class="text-3xl font-bold text-gray-800">Edit Car</h2>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
<form action="{{ route('cars.update', $car) }}" method="POST">
@csrf
@method('PUT')
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Brand</label>
<input type="text" name="brand" value="{{ $car->brand }}" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Model</label>
<input type="text" name="model" value="{{ $car->model }}" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Year</label>
<input type="text" name="year" value="{{ $car->year }}" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">License Plate</label>
<input type="text" name="license_plate" value="{{ $car->license_plate }}" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Color</label>
<input type="text" name="color" value="{{ $car->color }}" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Daily Rate (BHD)</label>
<input type="number" name="daily_rate" step="0.01" value="{{ $car->daily_rate }}" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Status</label>
<select name="status" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
<option value="available" {{ $car->status == 'available' ? 'selected' : '' }}>Available</option>
<option value="rented" {{ $car->status == 'rented' ? 'selected' : '' }}>Rented</option>
<option value="maintenance" {{ $car->status == 'maintenance' ? 'selected' : '' }}>Maintenance</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Mileage</label>
<input type="number" name="mileage" value="{{ $car->mileage }}" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">
</div>
<div class="md:col-span-2">
<label class="block text-sm font-medium text-gray-700 mb-2">Notes</label>
<textarea name="notes" rows="3" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500">{{ $car->notes }}</textarea>
</div>
</div>
<div class="mt-6">
<button type="submit" class="bg-blue-600 text-white px-8 py-3 rounded-xl hover:bg-blue-700">Update Car</button>
</div>
</form>
</div>
@endsection
+74
View File
@@ -0,0 +1,74 @@
@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
+101
View File
@@ -0,0 +1,101 @@
@extends('layouts.app')
@section('title', $car->brand . ' ' . $car->model)
@section('content')
<div class="mb-8">
<a href="{{ route('cars.index') }}" class="text-blue-600 hover:text-blue-800 flex items-center gap-2 mb-4">
<i class="fas fa-arrow-left"></i> Back to Fleet
</a>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Car Details -->
<div class="lg:col-span-2">
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
<div class="flex items-center gap-4 mb-6">
<div class="w-16 h-16 rounded-xl bg-gradient-to-br from-blue-400 to-blue-600 flex items-center justify-center">
<i class="fas fa-car text-white text-2xl"></i>
</div>
<div>
<h2 class="text-2xl font-bold text-gray-800">{{ $car->brand }} {{ $car->model }}</h2>
<p class="text-gray-500">{{ $car->year }} • {{ $car->color }} • {{ $car->license_plate }}</p>
</div>
</div>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div class="bg-gray-50 rounded-lg p-4 text-center">
<p class="text-sm text-gray-500">Daily Rate</p>
<p class="text-xl font-bold text-gray-800"> BHD {{ number_format($car->daily_rate, 0) }}</p>
</div>
<div class="bg-gray-50 rounded-lg p-4 text-center">
<p class="text-sm text-gray-500">Mileage</p>
<p class="text-xl font-bold text-gray-800">{{ number_format($car->mileage) }} km</p>
</div>
<div class="bg-gray-50 rounded-lg p-4 text-center">
<p class="text-sm text-gray-500">Status</p>
<span class="px-3 py-1 rounded-full text-sm 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>
</div>
</div>
@if($car->notes)
<div class="border-t pt-4">
<p class="text-sm text-gray-500 mb-1">Notes</p>
<p class="text-gray-700">{{ $car->notes }}</p>
</div>
@endif
</div>
</div>
<!-- Quick Actions -->
<div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 p-6">
<h3 class="font-semibold text-gray-800 mb-4">Quick Actions</h3>
<a href="{{ route('rentals.create') }}?car_id={{ $car->id }}" class="block w-full bg-amber-500 text-white text-center py-3 rounded-xl mb-3 hover:bg-amber-600">New Rental</a>
<a href="{{ route('services.create') }}?car_id={{ $car->id }}" class="block w-full bg-purple-500 text-white text-center py-3 rounded-xl mb-3 hover:bg-purple-600">Schedule Service</a>
<a href="{{ route('cars.edit', $car) }}" class="block w-full bg-gray-100 text-gray-700 text-center py-3 rounded-xl hover:bg-gray-200">Edit Car</a>
</div>
</div>
</div>
<!-- Rentals & Services -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mt-6">
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 p-6">
<h3 class="font-semibold text-gray-800 mb-4">Recent Rentals</h3>
@forelse($car->rentals->take(5) as $rental)
<div class="flex justify-between items-center py-3 border-b last:border-0">
<div>
<p class="font-medium text-gray-800">{{ $rental->customer->name }}</p>
<p class="text-sm text-gray-500">{{ $rental->start_date->format('M d') }} - {{ $rental->end_date->format('M d, Y') }}</p>
</div>
<span class="px-2 py-1 rounded text-xs font-medium
{{ $rental->status == 'active' ? 'bg-green-100 text-green-700' :
($rental->status == 'pending' ? 'bg-amber-100 text-amber-700' : 'bg-gray-100 text-gray-700') }}">
{{ $rental->status }}
</span>
</div>
@empty
<p class="text-gray-500 text-center py-4">No rentals yet</p>
@endforelse
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 p-6">
<h3 class="font-semibold text-gray-800 mb-4">Service History</h3>
@forelse($car->services->take(5) as $service)
<div class="flex justify-between items-center py-3 border-b last:border-0">
<div>
<p class="font-medium text-gray-800 capitalize">{{ str_replace('_', ' ', $service->type) }}</p>
<p class="text-sm text-gray-500">{{ $service->service_date->format('M d, Y') }}</p>
</div>
<span class="text-gray-800 font-medium"> BHD {{ number_format($service->cost, 0) }}</span>
</div>
@empty
<p class="text-gray-500 text-center py-4">No services yet</p>
@endforelse
</div>
</div>
@endsection