halaman histori

This commit is contained in:
hildaaaevs 2025-05-25 01:05:47 +07:00
parent ed9c5a5b8b
commit ea5d4f3cde
5 changed files with 49 additions and 44 deletions

View File

@ -252,14 +252,15 @@ public static function table(Table $table): Table
EditAction::make(),
DeleteAction::make()
])
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->defaultSort('created_at', 'desc');
}
]);
}
// ->bulkActions([
//Tables\Actions\BulkActionGroup::make([
//Tables\Actions\DeleteBulkAction::make(),
//]),
// ])
//->defaultSort('created_at', 'desc');
public static function getRelations(): array
{

View File

@ -2,12 +2,20 @@
namespace App\Livewire;
use App\Models\Reservasii;
use Livewire\Component;
class Histori extends Component
{
public function render()
{
return view('livewire.histori');
$bookings = Reservasii::with(['detail.paketFoto'])
->where('user_id', auth()->id())
->latest()
->get();
return view('livewire.histori', [
'bookings' => $bookings
]);
}
}

View File

@ -10,15 +10,18 @@ class SuccesPage extends Component
public $booking;
public $bookingName;
public function mount()
public function mount($id = null)
{
if (!auth()->check()) {
return redirect()->route('login');
}
// Ambil booking terakhir dari user yang sedang login
// Ambil booking berdasarkan ID jika ada, jika tidak ambil yang terakhir
$this->booking = Reservasii::with(['user', 'detail.paketFoto'])
->where('user_id', auth()->id())
->when($id, function($query) use ($id) {
return $query->where('id', $id);
})
->latest()
->first();

View File

@ -8,47 +8,40 @@
<thead>
<tr>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Order</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Date</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Order Status</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Payment Status</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Order Amount</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Tanggal</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Waktu</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Paket Foto</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Status Pembayaran</th>
<th scope="col" class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase">Total</th>
<th scope="col" class="px-6 py-3 text-end text-xs font-medium text-gray-500 uppercase">Action</th>
</tr>
</thead>
<tbody>
@forelse($bookings as $booking)
<tr class="odd:bg-white even:bg-gray-100 dark:odd:bg-slate-900 dark:even:bg-slate-800">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">20</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">18-02-2024</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"><span class="bg-orange-500 py-1 px-3 rounded text-white shadow">Pending</span></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"><span class="bg-green-500 py-1 px-3 rounded text-white shadow">Paid</span></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">12,000.00</td>
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">{{ $booking->id }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">{{ \Carbon\Carbon::parse($booking->tanggal)->format('d-m-Y') }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">{{ \Carbon\Carbon::parse($booking->waktu)->format('H:i') }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">
@foreach($booking->detail as $detail)
<div>{{ $detail->paketFoto->nama_paket_foto }}</div>
@endforeach
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">
<span class="bg-{{ $booking->tipe_pembayaran == 'full' ? 'green' : 'orange' }}-500 py-1 px-3 rounded text-white shadow">
{{ ucfirst($booking->tipe_pembayaran) }}
</span>
</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">Rp {{ number_format($booking->total, 0, ',', '.') }}</td>
<td class="px-6 py-4 whitespace-nowrap text-end text-sm font-medium">
<a href="#" class="bg-slate-600 text-white py-2 px-4 rounded-md hover:bg-slate-500">View Details</a>
<a href="{{ route('booking.success', $booking->id) }}" class="bg-slate-600 text-white py-2 px-4 rounded-md hover:bg-slate-500">View Details</a>
</td>
</tr>
<tr class="odd:bg-white even:bg-gray-100 dark:odd:bg-slate-900 dark:even:bg-slate-800">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">20</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">18-02-2024</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"><span class="bg-orange-500 py-1 px-3 rounded text-white shadow">Pending</span></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"><span class="bg-green-500 py-1 px-3 rounded text-white shadow">Paid</span></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">12,000.00</td>
<td class="px-6 py-4 whitespace-nowrap text-end text-sm font-medium">
<a href="#" class="bg-slate-600 text-white py-2 px-4 rounded-md hover:bg-slate-500">View Details</a>
</td>
@empty
<tr>
<td colspan="7" class="px-6 py-4 text-center text-sm text-gray-500">Tidak ada data reservasi</td>
</tr>
<tr class="odd:bg-white even:bg-gray-100 dark:odd:bg-slate-900 dark:even:bg-slate-800">
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-800 dark:text-gray-200">20</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">18-02-2024</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"><span class="bg-orange-500 py-1 px-3 rounded text-white shadow">Pending</span></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200"><span class="bg-green-500 py-1 px-3 rounded text-white shadow">Paid</span></td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-800 dark:text-gray-200">12,000.00</td>
<td class="px-6 py-4 whitespace-nowrap text-end text-sm font-medium">
<a href="#" class="bg-slate-600 text-white py-2 px-4 rounded-md hover:bg-slate-500">View Details</a>
</td>
</tr>
@endforelse
</tbody>
</table>
</div>

View File

@ -41,6 +41,6 @@
Route::get('/booking/{id}', BookingPage::class)->name('booking');
Route::get('/histori', Histori::class);
Route::get('/cart', CartPage::class);
Route::get('/success', SuccesPage::class)->name('booking.success');
Route::get('/success/{id?}', SuccesPage::class)->name('booking.success');
Route::get('/cancel', CancelPage::class);
});