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

+58
View File
@@ -0,0 +1,58 @@
@extends('layouts.app')
@section('title', 'Record Payment')
@section('content')
<div class="mb-8">
<a href="{{ route('payments.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 Payments
</a>
<h2 class="text-3xl font-bold text-gray-800">Record Payment</h2>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-200 p-8">
<form action="{{ route('payments.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">Rental</label>
<select name="rental_id" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-cyan-500">
<option value="">Select a rental</option>
@foreach($rentals as $rental)
<option value="{{ $rental->id }}">{{ $rental->car->brand }} {{ $rental->car->model }} - {{ $rental->customer->name }}</option>
@endforeach
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Amount (BHD)</label>
<input type="number" name="amount" 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-cyan-500">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Method</label>
<select name="method" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-cyan-500">
<option value="cash">Cash</option>
<option value="card">Card</option>
<option value="bank_transfer">Bank Transfer</option>
<option value="online">Online</option>
<option value="other">Other</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-2">Status</label>
<select name="status" required class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-cyan-500">
<option value="completed">Completed</option>
<option value="pending">Pending</option>
<option value="failed">Failed</option>
</select>
</div>
<div class="md:col-span-2">
<label class="block text-sm font-medium text-gray-700 mb-2">Transaction ID (Optional)</label>
<input type="text" name="transaction_id" class="w-full px-4 py-3 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-cyan-500">
</div>
</div>
<div class="mt-6">
<button type="submit" class="bg-cyan-600 text-white px-8 py-3 rounded-xl hover:bg-cyan-700">Record Payment</button>
</div>
</form>
</div>
@endsection
+50
View File
@@ -0,0 +1,50 @@
@extends('layouts.app')
@section('title', 'Payments')
@section('content')
<div class="flex justify-between items-center mb-6">
<div>
<h2 class="text-xl font-bold text-gray-800">Payments</h2>
<p class="text-gray-500 text-sm">Track payments</p>
</div>
<a href="{{ route('payments.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> Record Payment
</a>
</div>
<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">Rental</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase">Amount</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase">Method</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase">Status</th>
<th class="px-5 py-3 text-left text-xs font-semibold text-gray-600 uppercase">Date</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-100">
@forelse($payments as $payment)
<tr class="hover:bg-gray-50">
<td class="px-5 py-4 text-gray-800 text-sm">{{ $payment->rental->car->brand }} {{ $payment->rental->car->model }}</td>
<td class="px-5 py-4 font-medium text-gray-800 text-sm"> BHD {{ number_format($payment->amount, 0) }}</td>
<td class="px-5 py-4 text-gray-600 text-sm capitalize">{{ $payment->method }}</td>
<td class="px-5 py-4">
<span class="px-2.5 py-1 rounded-full text-xs font-medium
{{ $payment->status == 'completed' ? 'bg-green-100 text-green-700' :
($payment->status == 'pending' ? 'bg-amber-100 text-amber-700' : 'bg-red-100 text-red-700') }}">
{{ ucfirst($payment->status) }}
</span>
</td>
<td class="px-5 py-4 text-gray-600 text-sm">{{ $payment->created_at->format('M d, Y') }}</td>
</tr>
@empty
<tr>
<td colspan="5" class="px-5 py-8 text-center text-gray-500">No payments recorded</td>
</tr>
@endforelse
</tbody>
</table>
</div>
@endsection
+65
View File
@@ -0,0 +1,65 @@
@extends('layouts.app')
@section('title', 'Payment Details')
@section('content')
<div class="mb-6">
<a href="{{ route('payments.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 Payments
</a>
</div>
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-bold text-gray-800">Payment #{{ $payment->id }}</h2>
<span class="px-3 py-1 rounded-full text-sm font-medium
{{ $payment->status == 'completed' ? 'bg-green-100 text-green-700' :
($payment->status == 'pending' ? 'bg-amber-100 text-amber-700' : 'bg-red-100 text-red-700') }}">
{{ ucfirst($payment->status) }}
</span>
</div>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-gray-500 text-sm">Amount</p>
<p class="text-2xl font-bold text-gray-800"> BHD {{ number_format($payment->amount, 0) }}</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-gray-500 text-sm">Method</p>
<p class="font-semibold text-gray-800 capitalize">{{ $payment->method }}</p>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-gray-500 text-sm">Rental</p>
<a href="{{ route('rentals.show', $payment->rental) }}" class="font-semibold text-blue-600 hover:underline">
{{ $payment->rental->car->brand }} {{ $payment->rental->car->model }}
</a>
</div>
<div class="bg-gray-50 rounded-lg p-4">
<p class="text-gray-500 text-sm">Date</p>
<p class="font-semibold text-gray-800">{{ $payment->created_at->format('M d, Y') }}</p>
</div>
</div>
@if($payment->transaction_id)
<div class="border-t pt-4">
<p class="text-gray-500 text-sm mb-1">Transaction ID</p>
<p class="text-gray-700 font-mono">{{ $payment->transaction_id }}</p>
</div>
@endif
@if($payment->notes)
<div class="border-t pt-4 mt-4">
<p class="text-gray-500 text-sm mb-1">Notes</p>
<p class="text-gray-700">{{ $payment->notes }}</p>
</div>
@endif
<div class="flex gap-3 mt-6">
<form action="{{ route('payments.destroy', $payment) }}" method="POST">
@csrf
@method('DELETE')
<button type="submit" class="bg-red-600 text-white px-4 py-2 rounded-lg hover:bg-red-700 text-sm" onclick="return confirm('Delete this payment?')">Delete Payment</button>
</form>
</div>
</div>
@endsection