fiks bug route

This commit is contained in:
alfinfadli16 2025-06-13 03:53:55 +07:00
parent 660d53ad8a
commit f2d6d8c549
9 changed files with 34 additions and 12 deletions

View File

@ -26,4 +26,14 @@ public function transactions(Request $request)
return view('admin.reports.transactions', compact('transactions', 'request'));
}
public function updateStatus($id)
{
$sewa = Sewa::findOrFail($id);
$sewa->status = 'completed';
$sewa->save();
return redirect()->route('admin.reports.transactions')
->with('success', 'Status transaksi berhasil diperbarui menjadi completed');
}
}

View File

@ -235,7 +235,7 @@ class="border border-gray-300 rounded-md px-3 py-2 w-24 focus:outline-none focus
<!-- Tombol Submit dan Batal -->
<div class="flex justify-end space-x-4 pt-6 border-t">
<a href="{{ route('paket') }}" class="px-4 py-2 bg-gray-300 text-gray-800 rounded-md hover:bg-gray-400 transition duration-300">
<a href="{{ route('paket.index') }}" class="px-4 py-2 bg-gray-300 text-gray-800 rounded-md hover:bg-gray-400 transition duration-300">
Batal
</a>
<button type="submit" class="px-6 py-2 bg-blue-700 text-white rounded-md hover:bg-blue-800 transition duration-300">

View File

@ -28,7 +28,6 @@
<thead>
<tr class="bg-gray-100">
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 border-b">No</th>
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 border-b">ID Sewa</th>
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 border-b">Tanggal Sewa</th>
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 border-b">Pelanggan</th>
<th class="py-3 px-4 text-left text-sm font-semibold text-gray-600 border-b">Paket</th>
@ -43,7 +42,6 @@
@foreach($transactions as $index => $sewa)
<tr class="border-b hover:bg-gray-50">
<td class="py-3 px-4 text-sm text-gray-800">{{ $transactions->firstItem() + $index }}</td>
<td class="py-3 px-4 text-sm text-gray-800">#{{ $sewa->id }}</td>
<td class="py-3 px-4 text-sm text-gray-800">{{ \Carbon\Carbon::parse($sewa->created_at)->format('d M Y H:i') }}</td>
<td class="py-3 px-4 text-sm text-gray-800">{{ $sewa->user->nama }}</td>
<td class="py-3 px-4 text-sm text-gray-800">{{ $sewa->paket->nama_paket }}</td>
@ -71,9 +69,13 @@
</td>
<td class="py-3 px-4 text-center text-sm">
@if($sewa->status !== 'completed' && $sewa->status !== 'dibatalkan')
<a href="{{ route('admin.riwayat.show-update-payment', $sewa->id) }}" class="bg-indigo-500 hover:bg-indigo-600 text-white px-3 py-1 rounded-md">
Update Pembayaran
</a>
<form action="{{ route('admin.riwayat.update-status', $sewa->id) }}" method="POST" class="inline">
@csrf
@method('PUT')
<button type="submit" class="bg-indigo-500 hover:bg-indigo-600 text-white px-3 py-1 rounded-md">
Selesaikan Pembayaran
</button>
</form>
@else
<span class="text-gray-500">Tidak Ada Aksi</span>
@endif

View File

@ -57,7 +57,7 @@
<!-- Barang Stats -->
<div class="bg-gradient-to-br from-purple-50 to-purple-100 rounded-xl shadow-lg p-6 transform hover:scale-105 transition-all duration-300">
<a href="{{ route('paket') }}" class="block">
<a href="{{ route('paket.index') }}" class="block">
<div class="flex items-center">
<div class="p-3 rounded-full bg-purple-500 text-white mr-4 shadow-md">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">

View File

@ -134,7 +134,7 @@ class="w-full rounded-lg border-gray-300 focus:border-blue-500 focus:ring-blue-5
<!-- Tombol Submit -->
<div class="mt-6 flex justify-end space-x-3">
<a href="{{ route('paket') }}"
<a href="{{ route('paket.index') }}"
class="px-4 py-2 bg-gray-500 text-white rounded-lg hover:bg-gray-600 transition duration-200">
Batal
</a>

View File

@ -24,7 +24,7 @@
<a href="{{ route('pengguna') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('pengguna*') ? 'bg-blue-800 text-white' : '' }}">
Manajemen User
</a>
<a href="{{ route('paket') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('paket*') ? 'bg-blue-800 text-white' : '' }}">
<a href="{{ route('paket.index') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('paket*') ? 'bg-blue-800 text-white' : '' }}">
Manajemen Paket
</a>
<a href="{{ route('input-stock') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('input-stock*') ? 'bg-blue-800 text-white' : '' }}">

View File

@ -19,7 +19,7 @@
Input Stock
</a>
@endif
<a href="{{ route('paket') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('paket*') ? 'bg-blue-800 text-white' : '' }}">
<a href="{{ route('paket.index') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('paket*') ? 'bg-blue-800 text-white' : '' }}">
Paket
</a>
@if(auth()->user()->tipe_pengguna === 'user')
@ -35,11 +35,19 @@
Laporan Transaksi
</a>
@endif
@if(auth()->user()->tipe_pengguna === 'user')
<a href="{{ route('riwayat') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('riwayat') ? 'bg-blue-800 text-white' : '' }}">
Riwayat
</a>
@endif
@if(auth()->user()->tipe_pengguna === 'admin')
<a href="{{ route('contact.index') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('contact.index') ? 'bg-blue-800 text-white' : '' }}">
Hubungi Kami
</a>
@else
<a href="{{ route('contact.show') }}" class="block py-3 px-4 text-gray-800 font-semibold mb-1 hover:bg-gray-100 {{ request()->routeIs('contact.*') ? 'bg-blue-800 text-white' : '' }}">
Hubungi Kami
</a>
@endif
</nav>
</div>

View File

@ -126,7 +126,7 @@ class="w-full bg-gray-500 text-white px-3 py-1 rounded hover:bg-gray-600">
Pesan Sekarang
</a>
@else
<a href="{{ route('paket') }}" class="mt-4 inline-block bg-blue-800 text-white py-2 px-4 rounded hover:bg-blue-900 transition duration-200">
<a href="{{ route('paket.index') }}" class="mt-4 inline-block bg-blue-800 text-white py-2 px-4 rounded hover:bg-blue-900 transition duration-200">
Lihat Paket
</a>
@endif

View File

@ -98,7 +98,7 @@
Route::delete('/barang/{id}', [BarangController::class, 'destroy'])->name('barang.destroy');
// Paket (untuk semua user)
Route::get('/paket', [PaketController::class, 'index'])->name('paket');
Route::get('/paket', [PaketController::class, 'index'])->name('paket.index');
// Khusus Admin
Route::middleware(['admin'])->group(function () {
@ -219,3 +219,5 @@
// Route untuk data pengguna biasa
Route::get('/users', [UserController::class, 'index'])->name('users');
Route::delete('/users/{id}', [UserController::class, 'destroy'])->name('users.destroy');
Route::put('/admin/riwayat/{id}/update-status', [App\Http\Controllers\Admin\ReportController::class, 'updateStatus'])->name('admin.riwayat.update-status');