Checkpointt
This commit is contained in:
parent
cbbd272b15
commit
2d82a9489e
|
@ -15,7 +15,15 @@ class BookingsController extends Controller
|
|||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = Booking::with(['table', 'user']);
|
||||
// Ambil venue_id dari admin yang sedang login
|
||||
// Sesuaikan dengan struktur database kamu:
|
||||
$adminVenueId = auth()->user()->venue_id; // Asumsi admin punya kolom venue_id
|
||||
|
||||
// Query booking dengan filter venue terlebih dahulu
|
||||
$query = Booking::with(['table', 'user'])
|
||||
->whereHas('table', function ($q) use ($adminVenueId) {
|
||||
$q->where('venue_id', $adminVenueId);
|
||||
});
|
||||
|
||||
// Search functionality
|
||||
if ($request->has('search') && !empty($request->search)) {
|
||||
|
@ -70,14 +78,30 @@ public function index(Request $request)
|
|||
|
||||
public function show($id)
|
||||
{
|
||||
$booking = Booking::with(['table', 'user'])->findOrFail($id);
|
||||
// Pastikan booking yang dilihat adalah milik venue admin
|
||||
$adminVenueId = auth()->user()->venue_id;
|
||||
|
||||
$booking = Booking::with(['table', 'user'])
|
||||
->whereHas('table', function ($q) use ($adminVenueId) {
|
||||
$q->where('venue_id', $adminVenueId);
|
||||
})
|
||||
->findOrFail($id);
|
||||
|
||||
return view('admin.bookings.show', compact('booking'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$booking = Booking::findOrFail($id);
|
||||
$tables = Table::all();
|
||||
$adminVenueId = auth()->user()->venue_id;
|
||||
|
||||
// Pastikan booking yang diedit adalah milik venue admin
|
||||
$booking = Booking::whereHas('table', function ($q) use ($adminVenueId) {
|
||||
$q->where('venue_id', $adminVenueId);
|
||||
})->findOrFail($id);
|
||||
|
||||
// Hanya tampilkan tables dari venue admin
|
||||
$tables = Table::where('venue_id', $adminVenueId)->get();
|
||||
|
||||
return view('admin.bookings.edit', compact('booking', 'tables'));
|
||||
}
|
||||
|
||||
|
@ -89,7 +113,18 @@ public function update(Request $request, $id)
|
|||
'end_time' => 'required|date|after:start_time',
|
||||
]);
|
||||
|
||||
$booking = Booking::findOrFail($id);
|
||||
$adminVenueId = auth()->user()->venue_id;
|
||||
|
||||
// Pastikan booking yang diupdate adalah milik venue admin
|
||||
$booking = Booking::whereHas('table', function ($q) use ($adminVenueId) {
|
||||
$q->where('venue_id', $adminVenueId);
|
||||
})->findOrFail($id);
|
||||
|
||||
// Validasi tambahan: pastikan table_id yang dipilih juga milik venue admin
|
||||
$table = Table::where('id', $request->table_id)
|
||||
->where('venue_id', $adminVenueId)
|
||||
->firstOrFail();
|
||||
|
||||
$booking->update($request->all());
|
||||
|
||||
return redirect()->route('admin.bookings.index')
|
||||
|
@ -98,7 +133,12 @@ public function update(Request $request, $id)
|
|||
|
||||
public function complete($id)
|
||||
{
|
||||
$booking = Booking::findOrFail($id);
|
||||
$adminVenueId = auth()->user()->venue_id;
|
||||
|
||||
$booking = Booking::whereHas('table', function ($q) use ($adminVenueId) {
|
||||
$q->where('venue_id', $adminVenueId);
|
||||
})->findOrFail($id);
|
||||
|
||||
$booking->status = 'selesai';
|
||||
$booking->save();
|
||||
|
||||
|
@ -108,7 +148,12 @@ public function complete($id)
|
|||
|
||||
public function cancel($id)
|
||||
{
|
||||
$booking = Booking::findOrFail($id);
|
||||
$adminVenueId = auth()->user()->venue_id;
|
||||
|
||||
$booking = Booking::whereHas('table', function ($q) use ($adminVenueId) {
|
||||
$q->where('venue_id', $adminVenueId);
|
||||
})->findOrFail($id);
|
||||
|
||||
$booking->status = 'cancelled';
|
||||
$booking->save();
|
||||
|
||||
|
@ -118,7 +163,10 @@ public function cancel($id)
|
|||
|
||||
public function export(Request $request)
|
||||
{
|
||||
$adminVenueId = auth()->user()->venue_id;
|
||||
$filename = 'bookings-' . Carbon::now()->format('Y-m-d') . '.xlsx';
|
||||
return Excel::download(new BookingsExport($request), $filename);
|
||||
|
||||
// Pass venue_id ke export class jika diperlukan
|
||||
return Excel::download(new BookingsExport($request, $adminVenueId), $filename);
|
||||
}
|
||||
}
|
|
@ -55,7 +55,7 @@ public function store(Request $request)
|
|||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|string|max:255',
|
||||
'brand' => 'required|string|max:255',
|
||||
'status' => 'required|in:Available,Booked,Unavailable',
|
||||
// 'status' => 'required|in:Available,Booked,Unavailable',
|
||||
'price_per_hour' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
|
@ -68,7 +68,7 @@ public function store(Request $request)
|
|||
Table::create([
|
||||
'name' => $request->name,
|
||||
'brand' => $request->brand,
|
||||
'status' => $request->status,
|
||||
// 'status' => $request->status,
|
||||
'price_per_hour' => $request->price_per_hour,
|
||||
'venue_id' => auth()->user()->venue_id,
|
||||
]);
|
||||
|
@ -101,7 +101,7 @@ public function update(Request $request, $id)
|
|||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required|string|max:255',
|
||||
'brand' => 'required|string|max:255',
|
||||
'status' => 'required|in:Available,Booked,Unavailable',
|
||||
// 'status' => 'required|in:Available,Booked,Unavailable',
|
||||
'price_per_hour' => 'required|numeric|min:0',
|
||||
]);
|
||||
|
||||
|
@ -116,7 +116,7 @@ public function update(Request $request, $id)
|
|||
$table->update([
|
||||
'name' => $request->name,
|
||||
'brand' => $request->brand,
|
||||
'status' => $request->status,
|
||||
// 'status' => $request->status,
|
||||
'price_per_hour' => $request->price_per_hour,
|
||||
]);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ public function index()
|
|||
{
|
||||
$bookings = Booking::where('user_id', Auth::id())
|
||||
->with(['table.venue'])
|
||||
->orderBy('start_time', 'desc')
|
||||
->orderBy('created_at', 'desc')
|
||||
->paginate(10);
|
||||
|
||||
return view('pages.booking-history', compact('bookings'));
|
||||
|
|
|
@ -33,7 +33,7 @@ class="form-input w-full rounded-md border-gray-300 focus:border-blue-500 focus:
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="w-full md:w-1/4">
|
||||
{{-- <div class="w-full md:w-1/4">
|
||||
<label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
|
||||
<select name="status" id="status"
|
||||
class="form-select w-full rounded-md border-gray-300 focus:border-blue-500 focus:ring focus:ring-blue-200">
|
||||
|
@ -43,7 +43,7 @@ class="form-select w-full rounded-md border-gray-300 focus:border-blue-500 focus
|
|||
<option value="cancelled" {{ request('status') == 'cancelled' ? 'selected' : '' }}>Dibatalkan
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="w-full md:w-1/4">
|
||||
<label for="date_from" class="block text-sm font-medium text-gray-700 mb-1">Dari Tanggal</label>
|
||||
|
|
|
@ -49,19 +49,19 @@ class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none foc
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{-- <div>
|
||||
<label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
|
||||
<select id="status" name="status"
|
||||
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 @error('status') border-red-500 @enderror">
|
||||
<option value="Available" {{ old('status') === 'Available' ? 'selected' : '' }}>Available</option>
|
||||
<option value="Booked" {{ old('status') === 'Booked' ? 'selected' : '' }}>Booked</option>
|
||||
<option value="Unavailable" {{ old('status') === 'Unavailable' ? 'selected' : '' }}>Unavailable
|
||||
<option value="Available" {{ old('status')==='Available' ? 'selected' : '' }}>Available</option>
|
||||
<option value="Booked" {{ old('status')==='Booked' ? 'selected' : '' }}>Booked</option>
|
||||
<option value="Unavailable" {{ old('status')==='Unavailable' ? 'selected' : '' }}>Unavailable
|
||||
</option>
|
||||
</select>
|
||||
@error('status')
|
||||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="flex justify-end space-x-3">
|
||||
<a href="{{ route('admin.tables.index') }}"
|
||||
|
|
|
@ -50,7 +50,7 @@ class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none foc
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{{-- <div>
|
||||
<label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
|
||||
<select id="status" name="status"
|
||||
class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 @error('status') border-red-500 @enderror">
|
||||
|
@ -58,12 +58,13 @@ class="w-full border border-gray-300 rounded-lg px-4 py-2 focus:outline-none foc
|
|||
Available</option>
|
||||
<option value="Booked" {{ old('status', $table->status) === 'Booked' ? 'selected' : '' }}>Booked
|
||||
</option>
|
||||
<option value="Unavailable" {{ old('status', $table->status) === 'Unavailable' ? 'selected' : '' }}>Unavailable</option>
|
||||
<option value="Unavailable" {{ old('status', $table->status) === 'Unavailable' ? 'selected' : ''
|
||||
}}>Unavailable</option>
|
||||
</select>
|
||||
@error('status')
|
||||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||||
<p class="text-red-500 text-xs mt-1">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class="flex justify-end space-x-3">
|
||||
<a href="{{ route('admin.tables.index') }}"
|
||||
|
|
|
@ -52,14 +52,29 @@ class="flex items-center space-x-2 text-sm font-medium text-gray-700 hover:text-
|
|||
|
||||
<div x-show="open" @click.away="open = false" x-transition
|
||||
class="absolute right-0 mt-2 w-40 bg-white rounded-lg shadow-lg py-2 z-50">
|
||||
|
||||
<a href="{{ route('booking.history') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
Riwayat Booking
|
||||
</a>
|
||||
<a href="{{ route('account.settings') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
Pengaturan Akun
|
||||
</a>
|
||||
|
||||
@if (Auth::user()->role === 'user')
|
||||
<a href="{{ route('account.settings') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
Pengaturan Akun
|
||||
</a>
|
||||
@elseif (Auth::user()->role === 'admin')
|
||||
<a href="{{ url('/admin') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
Halaman Admin
|
||||
</a>
|
||||
@elseif (Auth::user()->role === 'superadmin')
|
||||
<a href="{{ url('/superadmin') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
Halaman Superadmin
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if (Auth::user()->email_verified_at === null)
|
||||
<a href="{{ route('verification.notice') }}"
|
||||
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
||||
|
@ -67,6 +82,7 @@ class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
|
|||
Verifikasi Email
|
||||
</a>
|
||||
@endif
|
||||
|
||||
<form method="POST" action="{{ route('logout') }}">
|
||||
@csrf
|
||||
<button type="submit"
|
||||
|
|
|
@ -21,7 +21,7 @@ class="fixed inset-0 bg-black bg-opacity-50 z-40 flex items-center justify-cente
|
|||
class="w-full h-full object-cover rounded-lg mb-4 mt-8" />
|
||||
|
||||
<h1 class="text-xl text-gray-800 font-semibold">{{ $venue['name'] }}</h1>
|
||||
<p class="text-sm text-gray-500">{{ $venue['location'] ?? 'Lokasi tidak tersedia' }}</p>
|
||||
<p class="text-sm text-gray-500">{{ $venue['description'] ?? 'Tidak ada deskripsi.' }}</p>
|
||||
@if($venue['status'] === 'open')
|
||||
{{-- Venue sedang buka - tampilkan jam operasional --}}
|
||||
<p class="text-sm text-gray-600 mt-1">
|
||||
|
@ -147,21 +147,33 @@ class="border rounded-lg shadow-md p-4 mb-4">
|
|||
</select>
|
||||
|
||||
<h4 class="font-semibold mb-2 mt-4">Pilih Durasi Main:</h4>
|
||||
<select class="w-full border p-2 rounded-lg" x-model="selectedDuration">
|
||||
<option value="">-- Pilih Durasi --</option>
|
||||
<option value="1">1 Jam</option>
|
||||
<option value="2">2 Jam</option>
|
||||
<option value="3">3 Jam</option>
|
||||
</select>
|
||||
@if ($venue['status'] === 'open')
|
||||
<select class="w-full border p-2 rounded-lg" x-model="selectedDuration">
|
||||
<option value="">-- Pilih Durasi --</option>
|
||||
<option value="1">1 Jam</option>
|
||||
<option value="2">2 Jam</option>
|
||||
<option value="3">3 Jam</option>
|
||||
{{-- <option value="4">4 Jam</option>
|
||||
<option value="5">5 Jam</option> --}}
|
||||
</select>
|
||||
@else
|
||||
<select class="w-full border p-2 rounded-lg bg-gray-100 text-gray-400 cursor-not-allowed" disabled>
|
||||
<option value="">Venue sedang tutup</option>
|
||||
</select>
|
||||
@endif
|
||||
|
||||
<button class="mt-3 px-4 py-2 bg-green-500 text-white rounded-lg w-full" :disabled="!selectedTime || !selectedDuration || isLoading"
|
||||
@click="initiateBooking('{{ $table['id'] }}', '{{ addslashes($table['name']) }}')">
|
||||
<template x-if="isLoading">
|
||||
<span>Loading...</span>
|
||||
</template>
|
||||
<template x-if="!isLoading">
|
||||
<span>Confirm Booking</span>
|
||||
</template>
|
||||
<button
|
||||
class="mt-3 px-4 py-2 rounded-lg w-full
|
||||
{{ $venue['status'] === 'open' ? 'bg-green-500 text-white' : 'bg-gray-400 text-gray-700 cursor-not-allowed' }}"
|
||||
:disabled="!selectedTime || !selectedDuration || isLoading || '{{ $venue['status'] }}' !== 'open'"
|
||||
@click="initiateBooking('{{ $table['id'] }}', '{{ addslashes($table['name']) }}')">
|
||||
|
||||
<template x-if="isLoading">
|
||||
<span>Loading...</span>
|
||||
</template>
|
||||
<template x-if="!isLoading">
|
||||
<span>Confirm Booking</span>
|
||||
</template>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -194,12 +206,12 @@ function showToast(message, type = 'info', duration = 5000) {
|
|||
|
||||
toast.className = `${bgColor} text-white px-6 py-4 rounded-lg shadow-lg flex items-center space-x-3 min-w-80 transform transition-all duration-300 translate-x-full opacity-0`;
|
||||
toast.innerHTML = `
|
||||
<i class="fas ${icon}"></i>
|
||||
<span class="flex-1">${message}</span>
|
||||
<button onclick="this.parentElement.remove()" class="text-white hover:text-gray-200">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
`;
|
||||
<i class="fas ${icon}"></i>
|
||||
<span class="flex-1">${message}</span>
|
||||
<button onclick="this.parentElement.remove()" class="text-white hover:text-gray-200">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
`;
|
||||
|
||||
toastContainer.appendChild(toast);
|
||||
|
||||
|
@ -235,20 +247,20 @@ function showModal(title, message, type = 'info', callback = null) {
|
|||
}[type] || 'fa-info-circle';
|
||||
|
||||
modal.innerHTML = `
|
||||
<div class="bg-white rounded-lg p-6 max-w-md w-full shadow-2xl transform transition-all">
|
||||
<div class="flex items-center space-x-3 mb-4">
|
||||
<i class="fas ${icon} text-2xl ${iconColor}"></i>
|
||||
<h3 class="text-lg font-semibold text-gray-800">${title}</h3>
|
||||
</div>
|
||||
<p class="text-gray-600 mb-6">${message}</p>
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button onclick="this.closest('.fixed').remove(); ${callback ? callback + '()' : ''}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors">
|
||||
OK
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
<div class="bg-white rounded-lg p-6 max-w-md w-full shadow-2xl transform transition-all">
|
||||
<div class="flex items-center space-x-3 mb-4">
|
||||
<i class="fas ${icon} text-2xl ${iconColor}"></i>
|
||||
<h3 class="text-lg font-semibold text-gray-800">${title}</h3>
|
||||
</div>
|
||||
<p class="text-gray-600 mb-6">${message}</p>
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button onclick="this.closest('.fixed').remove(); ${callback ? callback + '()' : ''}"
|
||||
class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors">
|
||||
OK
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(modal);
|
||||
|
||||
|
@ -267,22 +279,22 @@ function showConfirmModal(title, message, onConfirm, onCancel = null) {
|
|||
modal.className = 'fixed inset-0 bg-black bg-opacity-50 z-50 flex items-center justify-center p-4';
|
||||
|
||||
modal.innerHTML = `
|
||||
<div class="bg-white rounded-lg p-6 max-w-md w-full shadow-2xl transform transition-all">
|
||||
<div class="flex items-center space-x-3 mb-4">
|
||||
<i class="fas fa-question-circle text-2xl text-yellow-500"></i>
|
||||
<h3 class="text-lg font-semibold text-gray-800">${title}</h3>
|
||||
</div>
|
||||
<p class="text-gray-600 mb-6">${message}</p>
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button id="cancelBtn" class="bg-gray-300 text-gray-700 px-4 py-2 rounded-md hover:bg-gray-400 transition-colors">
|
||||
Batal
|
||||
</button>
|
||||
<button id="confirmBtn" class="bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 transition-colors">
|
||||
Ya, Hapus
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
<div class="bg-white rounded-lg p-6 max-w-md w-full shadow-2xl transform transition-all">
|
||||
<div class="flex items-center space-x-3 mb-4">
|
||||
<i class="fas fa-question-circle text-2xl text-yellow-500"></i>
|
||||
<h3 class="text-lg font-semibold text-gray-800">${title}</h3>
|
||||
</div>
|
||||
<p class="text-gray-600 mb-6">${message}</p>
|
||||
<div class="flex justify-end space-x-3">
|
||||
<button id="cancelBtn" class="bg-gray-300 text-gray-700 px-4 py-2 rounded-md hover:bg-gray-400 transition-colors">
|
||||
Batal
|
||||
</button>
|
||||
<button id="confirmBtn" class="bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 transition-colors">
|
||||
Ya, Hapus
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(modal);
|
||||
|
||||
|
|
|
@ -1,186 +1,188 @@
|
|||
@extends('layouts.super-admin')
|
||||
|
||||
@section('content')
|
||||
<div class="mb-6 flex justify-between items-center">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-gray-800">Manajemen Admin</h1>
|
||||
<p class="text-gray-600">Kelola admin untuk setiap venue</p>
|
||||
<div class="p-6">
|
||||
<div class="mb-6 flex justify-between items-center">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-gray-800">Manajemen Admin</h1>
|
||||
<p class="text-gray-600">Kelola admin untuk setiap venue</p>
|
||||
</div>
|
||||
<a href="{{ route('superadmin.admin.create') }}"
|
||||
class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 flex items-center">
|
||||
<i class="fas fa-plus mr-2"></i>
|
||||
Tambah Admin
|
||||
</a>
|
||||
</div>
|
||||
<a href="{{ route('superadmin.admin.create') }}"
|
||||
class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 flex items-center">
|
||||
<i class="fas fa-plus mr-2"></i>
|
||||
Tambah Admin
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@if(session('success'))
|
||||
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-6" role="alert">
|
||||
<p>{{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
@if(session('success'))
|
||||
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-6" role="alert">
|
||||
<p>{{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Filter and Search -->
|
||||
<div class="bg-white rounded-lg shadow mb-6 p-4">
|
||||
<form action="{{ route('superadmin.admin.index') }}" method="GET">
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex-grow">
|
||||
<label for="search" class="block text-sm font-medium text-gray-700 mb-1">Cari</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<i class="fas fa-search text-gray-400"></i>
|
||||
<!-- Filter and Search -->
|
||||
<div class="bg-white rounded-lg shadow mb-6 p-4">
|
||||
<form action="{{ route('superadmin.admin.index') }}" method="GET">
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex-grow">
|
||||
<label for="search" class="block text-sm font-medium text-gray-700 mb-1">Cari</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<i class="fas fa-search text-gray-400"></i>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" value="{{ request('search') }}"
|
||||
class="pl-10 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
placeholder="Cari nama atau email">
|
||||
</div>
|
||||
<input type="text" id="search" name="search" value="{{ request('search') }}"
|
||||
class="pl-10 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
placeholder="Cari nama atau email">
|
||||
</div>
|
||||
<div class="md:w-64">
|
||||
<label for="venue_filter" class="block text-sm font-medium text-gray-700 mb-1">Filter Venue</label>
|
||||
<select id="venue_filter" name="venue_id"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
||||
<option value="">Semua Venue</option>
|
||||
@foreach($venues as $venue)
|
||||
<option value="{{ $venue->id }}" {{ request('venue_id') == $venue->id ? 'selected' : '' }}>
|
||||
{{ $venue->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="self-end">
|
||||
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 text-sm">
|
||||
Cari
|
||||
</button>
|
||||
<a href="{{ route('superadmin.admin.index') }}"
|
||||
class="px-4 py-2 border border-gray-300 rounded-md bg-white hover:bg-gray-50 text-sm ml-2">
|
||||
Reset Filter
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:w-64">
|
||||
<label for="venue_filter" class="block text-sm font-medium text-gray-700 mb-1">Filter Venue</label>
|
||||
<select id="venue_filter" name="venue_id"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
||||
<option value="">Semua Venue</option>
|
||||
@foreach($venues as $venue)
|
||||
<option value="{{ $venue->id }}" {{ request('venue_id') == $venue->id ? 'selected' : '' }}>
|
||||
{{ $venue->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="self-end">
|
||||
<button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 text-sm">
|
||||
Cari
|
||||
</button>
|
||||
<a href="{{ route('superadmin.admin.index') }}"
|
||||
class="px-4 py-2 border border-gray-300 rounded-md bg-white hover:bg-gray-50 text-sm ml-2">
|
||||
Reset Filter
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Admin Table -->
|
||||
<div class="bg-white rounded-lg shadow overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Nama
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Email
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Venue
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Status
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Terdaftar
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Aksi
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
@forelse($admins as $admin)
|
||||
<tr>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<div
|
||||
class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600">
|
||||
<i class="fas fa-user"></i>
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
<div class="text-sm font-medium text-gray-900">{{ $admin->name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="text-sm text-gray-900">{{ $admin->email }}</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="text-sm text-gray-900">
|
||||
@if($admin->venue)
|
||||
{{ $admin->venue->name }}
|
||||
@else
|
||||
<span class="text-gray-400">Tidak ada venue</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {{ $admin->email_verified_at ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800' }}">
|
||||
{{ $admin->email_verified_at ? 'Terverifikasi' : 'Belum Verifikasi' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $admin->created_at->format('d M Y') }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<button type="button" data-admin-id="{{ $admin->id }}" data-admin-name="{{ $admin->name }}"
|
||||
class="text-red-600 hover:text-red-800 delete-admin-btn">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="px-6 py-4 text-center text-gray-500">
|
||||
Tidak ada data admin ditemukan
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Admin Table -->
|
||||
<div class="bg-white rounded-lg shadow overflow-hidden">
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full divide-y divide-gray-200">
|
||||
<thead class="bg-gray-50">
|
||||
<tr>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Nama
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Email
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Venue
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Status
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Terdaftar
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Aksi
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white divide-y divide-gray-200">
|
||||
@forelse($admins as $admin)
|
||||
<tr>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="flex items-center">
|
||||
<div
|
||||
class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600">
|
||||
<i class="fas fa-user"></i>
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
<div class="text-sm font-medium text-gray-900">{{ $admin->name }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="text-sm text-gray-900">{{ $admin->email }}</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<div class="text-sm text-gray-900">
|
||||
@if($admin->venue)
|
||||
{{ $admin->venue->name }}
|
||||
@else
|
||||
<span class="text-gray-400">Tidak ada venue</span>
|
||||
@endif
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap">
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full {{ $admin->email_verified_at ? 'bg-green-100 text-green-800' : 'bg-yellow-100 text-yellow-800' }}">
|
||||
{{ $admin->email_verified_at ? 'Terverifikasi' : 'Belum Verifikasi' }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
||||
{{ $admin->created_at->format('d M Y') }}
|
||||
</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<button type="button" data-admin-id="{{ $admin->id }}" data-admin-name="{{ $admin->name }}"
|
||||
class="text-red-600 hover:text-red-800 delete-admin-btn">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr>
|
||||
<td colspan="6" class="px-6 py-4 text-center text-gray-500">
|
||||
Tidak ada data admin ditemukan
|
||||
</td>
|
||||
</tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- Pagination -->
|
||||
<div class="px-6 py-4 border-t border-gray-200">
|
||||
{{ $admins->links() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
<div class="px-6 py-4 border-t border-gray-200">
|
||||
{{ $admins->links() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Delete Admin Confirmation Modal -->
|
||||
<div id="deleteAdminModal" tabindex="-1" aria-hidden="true"
|
||||
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-modal md:h-full">
|
||||
<div class="relative w-full h-full max-w-md md:h-auto">
|
||||
<div class="relative bg-white rounded-lg shadow">
|
||||
<div class="flex items-center justify-between p-4 border-b">
|
||||
<h3 class="text-xl font-semibold text-gray-900">
|
||||
Konfirmasi Hapus
|
||||
</h3>
|
||||
<button type="button"
|
||||
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center"
|
||||
data-modal-hide="deleteAdminModal">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="p-6 text-center">
|
||||
<i class="fas fa-exclamation-triangle text-5xl text-yellow-400 mb-4"></i>
|
||||
<h3 class="mb-5 text-lg font-normal text-gray-500">Apakah Anda yakin ingin menghapus admin <span
|
||||
id="admin-name-to-delete" class="font-medium"></span>?</h3>
|
||||
<form id="deleteAdminForm" method="POST" action="">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit"
|
||||
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
|
||||
Ya, saya yakin
|
||||
<!-- Delete Admin Confirmation Modal -->
|
||||
<div id="deleteAdminModal" tabindex="-1" aria-hidden="true"
|
||||
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-modal md:h-full">
|
||||
<div class="relative w-full h-full max-w-md md:h-auto">
|
||||
<div class="relative bg-white rounded-lg shadow">
|
||||
<div class="flex items-center justify-between p-4 border-b">
|
||||
<h3 class="text-xl font-semibold text-gray-900">
|
||||
Konfirmasi Hapus
|
||||
</h3>
|
||||
<button type="button"
|
||||
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center"
|
||||
data-modal-hide="deleteAdminModal">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
<button type="button" data-modal-hide="deleteAdminModal"
|
||||
class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10">
|
||||
Batal
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="p-6 text-center">
|
||||
<i class="fas fa-exclamation-triangle text-5xl text-yellow-400 mb-4"></i>
|
||||
<h3 class="mb-5 text-lg font-normal text-gray-500">Apakah Anda yakin ingin menghapus admin <span
|
||||
id="admin-name-to-delete" class="font-medium"></span>?</h3>
|
||||
<form id="deleteAdminForm" method="POST" action="">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<button type="submit"
|
||||
class="text-white bg-red-600 hover:bg-red-800 focus:ring-4 focus:outline-none focus:ring-red-300 font-medium rounded-lg text-sm inline-flex items-center px-5 py-2.5 text-center mr-2">
|
||||
Ya, saya yakin
|
||||
</button>
|
||||
<button type="button" data-modal-hide="deleteAdminModal"
|
||||
class="text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 rounded-lg border border-gray-200 text-sm font-medium px-5 py-2.5 hover:text-gray-900 focus:z-10">
|
||||
Batal
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,219 +1,227 @@
|
|||
@extends('layouts.super-admin')
|
||||
|
||||
@section('content')
|
||||
<div class="mb-6 flex justify-between items-center">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-gray-800">Manajemen Venue</h1>
|
||||
<p class="text-gray-600">Kelola semua venue dalam sistem</p>
|
||||
<div class="p-6">
|
||||
<div class="mb-6 flex justify-between items-center">
|
||||
<div>
|
||||
<h1 class="text-3xl font-bold text-gray-800">Manajemen Venue</h1>
|
||||
<p class="text-gray-600">Kelola semua venue dalam sistem</p>
|
||||
</div>
|
||||
<a href="{{ route('superadmin.venue.create') }}"
|
||||
class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 flex items-center">
|
||||
<i class="fas fa-plus mr-2"></i>
|
||||
Tambah Venue
|
||||
</a>
|
||||
</div>
|
||||
<a href="{{ route('superadmin.venue.create') }}"
|
||||
class="px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 flex items-center">
|
||||
<i class="fas fa-plus mr-2"></i>
|
||||
Tambah Venue
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Flash Messages -->
|
||||
@if(session('success'))
|
||||
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-6" role="alert">
|
||||
<p>{{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
<!-- Flash Messages -->
|
||||
@if(session('success'))
|
||||
<div class="bg-green-100 border-l-4 border-green-500 text-green-700 p-4 mb-6" role="alert">
|
||||
<p>{{ session('success') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(session('error'))
|
||||
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-6" role="alert">
|
||||
<p>{{ session('error') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-6" role="alert">
|
||||
<p>{{ session('error') }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Filter and Search -->
|
||||
<div class="bg-white rounded-lg shadow mb-6 p-4">
|
||||
<form action="{{ route('superadmin.venue.index') }}" method="GET">
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex-grow">
|
||||
<label for="search" class="block text-sm font-medium text-gray-700 mb-1">Cari</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<i class="fas fa-search text-gray-400"></i>
|
||||
<!-- Filter and Search -->
|
||||
<div class="bg-white rounded-lg shadow mb-6 p-4">
|
||||
<form action="{{ route('superadmin.venue.index') }}" method="GET">
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<div class="flex-grow">
|
||||
<label for="search" class="block text-sm font-medium text-gray-700 mb-1">Cari</label>
|
||||
<div class="relative">
|
||||
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
||||
<i class="fas fa-search text-gray-400"></i>
|
||||
</div>
|
||||
<input type="text" id="search" name="search" value="{{ request('search') }}"
|
||||
class="pl-10 block w-full rounded-md border-gray-300 shadow-sm focus:border-green-500 focus:ring-green-500"
|
||||
placeholder="Cari nama venue atau lokasi">
|
||||
</div>
|
||||
<input type="text" id="search" name="search" value="{{ request('search') }}"
|
||||
class="pl-10 block w-full rounded-md border-gray-300 shadow-sm focus:border-green-500 focus:ring-green-500"
|
||||
placeholder="Cari nama venue atau lokasi">
|
||||
</div>
|
||||
<div>
|
||||
<label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
|
||||
<select id="status" name="status"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-green-500 focus:ring-green-500">
|
||||
<option value="">Semua Status</option>
|
||||
<option value="active" {{ request('status') == 'active' ? 'selected' : '' }}>Aktif</option>
|
||||
<option value="inactive" {{ request('status') == 'inactive' ? 'selected' : '' }}>Tidak Aktif
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="self-end">
|
||||
<button type="submit"
|
||||
class="px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700 text-sm">
|
||||
Filter
|
||||
</button>
|
||||
<a href="{{ route('superadmin.venue.index') }}"
|
||||
class="px-4 py-2 border border-gray-300 rounded-md bg-white hover:bg-gray-50 text-sm ml-2">
|
||||
Reset
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status</label>
|
||||
<select id="status" name="status"
|
||||
class="block w-full rounded-md border-gray-300 shadow-sm focus:border-green-500 focus:ring-green-500">
|
||||
<option value="">Semua Status</option>
|
||||
<option value="active" {{ request('status') == 'active' ? 'selected' : '' }}>Aktif</option>
|
||||
<option value="inactive" {{ request('status') == 'inactive' ? 'selected' : '' }}>Tidak Aktif</option>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Venue Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
@forelse($venues as $venue)
|
||||
<div class="bg-white rounded-lg shadow overflow-hidden">
|
||||
<div class="relative">
|
||||
@php
|
||||
// Tentukan path gambar yang akan ditampilkan
|
||||
$imagePath = null;
|
||||
|
||||
if ($venue->image) {
|
||||
// Cek apakah file gambar ada di storage
|
||||
if (Storage::disk('public')->exists($venue->image)) {
|
||||
$imagePath = asset('storage/' . $venue->image);
|
||||
}
|
||||
// Cek apakah file gambar ada di public folder
|
||||
elseif (file_exists(public_path($venue->image))) {
|
||||
$imagePath = asset($venue->image);
|
||||
}
|
||||
// Cek jika path sudah lengkap dengan storage/
|
||||
elseif (file_exists(public_path('storage/' . $venue->image))) {
|
||||
$imagePath = asset('storage/' . $venue->image);
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback ke placeholder jika gambar tidak ditemukan
|
||||
if (!$imagePath) {
|
||||
$imagePath = asset('images/venue-placeholder.jpg');
|
||||
}
|
||||
@endphp
|
||||
|
||||
<img src="{{ $imagePath }}" alt="{{ $venue->name }}" class="w-full h-48 object-cover"
|
||||
onerror="this.src='{{ asset('images/venue-placeholder.jpg') }}'; this.onerror=null;">
|
||||
|
||||
<div class="absolute top-3 right-3 flex gap-2">
|
||||
<a href="{{ route('superadmin.venue.edit', $venue->id) }}"
|
||||
class="p-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors duration-200">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<button type="button" onclick="confirmDelete({{ $venue->id }})"
|
||||
class="p-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors duration-200">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-5">
|
||||
<h3 class="text-xl font-semibold text-gray-900 mb-2">{{ $venue->name }}</h3>
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-map-marker-alt text-gray-500 mr-2"></i>
|
||||
<span class="text-gray-600 truncate" title="{{ $venue->address }}">{{ $venue->address }}</span>
|
||||
</div>
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-phone text-gray-500 mr-2"></i>
|
||||
<span class="text-gray-600">{{ $venue->phone }}</span>
|
||||
</div>
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-clock text-gray-500 mr-2"></i>
|
||||
<span class="text-gray-600">
|
||||
{{ $venue->open_time ?? '00:00' }} - {{ $venue->close_time ?? '23:59' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center mb-4">
|
||||
<i
|
||||
class="fas fa-circle {{ $venue->status == 'active' ? 'text-green-500' : 'text-red-500' }} mr-2"></i>
|
||||
<span
|
||||
class="text-sm font-medium {{ $venue->status == 'active' ? 'text-green-700' : 'text-red-700' }}">
|
||||
{{ $venue->status == 'active' ? 'Aktif' : 'Tidak Aktif' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@if($venue->description)
|
||||
<div class="mb-4">
|
||||
<p class="text-gray-600 text-sm line-clamp-2">{{ Str::limit($venue->description, 100) }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="border-t pt-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="text-sm text-gray-500">
|
||||
<span class="font-medium">{{ $venue->created_at->format('d M Y') }}</span>
|
||||
</div>
|
||||
<a href="{{ route('superadmin.venue.edit', $venue->id) }}"
|
||||
class="text-green-600 hover:text-green-800 flex items-center text-sm transition-colors duration-200">
|
||||
Detail
|
||||
<i class="fas fa-arrow-right ml-1"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="self-end">
|
||||
<button type="submit" class="px-4 py-2 bg-green-600 text-white rounded-md hover:bg-green-700 text-sm">
|
||||
Filter
|
||||
</button>
|
||||
<a href="{{ route('superadmin.venue.index') }}"
|
||||
class="px-4 py-2 border border-gray-300 rounded-md bg-white hover:bg-gray-50 text-sm ml-2">
|
||||
Reset
|
||||
</a>
|
||||
@empty
|
||||
<div class="col-span-3 bg-white rounded-lg shadow p-8 text-center">
|
||||
<div class="max-w-sm mx-auto">
|
||||
<i class="fas fa-building text-gray-300 text-6xl mb-4"></i>
|
||||
<h3 class="text-xl font-semibold text-gray-900 mb-2">Belum ada venue</h3>
|
||||
<p class="text-gray-500 mb-6">Mulai tambahkan venue baru untuk mengelola bisnis Anda dengan lebih baik
|
||||
</p>
|
||||
<a href="{{ route('superadmin.venue.create') }}"
|
||||
class="px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 inline-flex items-center transition-colors duration-200">
|
||||
<i class="fas fa-plus mr-2"></i>
|
||||
Tambah Venue Pertama
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
@if($venues->hasPages())
|
||||
<div class="mt-8">
|
||||
<div class="bg-white px-4 py-3 border border-gray-200 rounded-lg">
|
||||
{{ $venues->appends(request()->query())->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Venue Grid -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
@forelse($venues as $venue)
|
||||
<div class="bg-white rounded-lg shadow overflow-hidden">
|
||||
<div class="relative">
|
||||
@php
|
||||
// Tentukan path gambar yang akan ditampilkan
|
||||
$imagePath = null;
|
||||
|
||||
if ($venue->image) {
|
||||
// Cek apakah file gambar ada di storage
|
||||
if (Storage::disk('public')->exists($venue->image)) {
|
||||
$imagePath = asset('storage/' . $venue->image);
|
||||
}
|
||||
// Cek apakah file gambar ada di public folder
|
||||
elseif (file_exists(public_path($venue->image))) {
|
||||
$imagePath = asset($venue->image);
|
||||
}
|
||||
// Cek jika path sudah lengkap dengan storage/
|
||||
elseif (file_exists(public_path('storage/' . $venue->image))) {
|
||||
$imagePath = asset('storage/' . $venue->image);
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback ke placeholder jika gambar tidak ditemukan
|
||||
if (!$imagePath) {
|
||||
$imagePath = asset('images/venue-placeholder.jpg');
|
||||
}
|
||||
@endphp
|
||||
|
||||
<img src="{{ $imagePath }}" alt="{{ $venue->name }}" class="w-full h-48 object-cover"
|
||||
onerror="this.src='{{ asset('images/venue-placeholder.jpg') }}'; this.onerror=null;">
|
||||
|
||||
<div class="absolute top-3 right-3 flex gap-2">
|
||||
<a href="{{ route('superadmin.venue.edit', $venue->id) }}"
|
||||
class="p-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors duration-200">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<button type="button" onclick="confirmDelete({{ $venue->id }})"
|
||||
class="p-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors duration-200">
|
||||
<i class="fas fa-trash-alt"></i>
|
||||
<!-- Delete Venue Confirmation Modal -->
|
||||
<div id="deleteVenueModal" tabindex="-1" aria-hidden="true"
|
||||
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-modal md:h-full bg-gray-900 bg-opacity-50">
|
||||
<div class="relative w-full h-full max-w-md md:h-auto mx-auto flex items-center justify-center min-h-screen">
|
||||
<div class="relative bg-white rounded-lg shadow-xl max-w-md w-full">
|
||||
<div class="flex items-center justify-between p-5 border-b border-gray-200">
|
||||
<h3 class="text-xl font-semibold text-gray-900">
|
||||
Konfirmasi Hapus
|
||||
</h3>
|
||||
<button type="button" onclick="closeDeleteModal()"
|
||||
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center transition-colors duration-200">
|
||||
<i class="fas fa-times w-5 h-5"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-5">
|
||||
<h3 class="text-xl font-semibold text-gray-900 mb-2">{{ $venue->name }}</h3>
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-map-marker-alt text-gray-500 mr-2"></i>
|
||||
<span class="text-gray-600 truncate" title="{{ $venue->address }}">{{ $venue->address }}</span>
|
||||
</div>
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-phone text-gray-500 mr-2"></i>
|
||||
<span class="text-gray-600">{{ $venue->phone }}</span>
|
||||
</div>
|
||||
<div class="flex items-center mb-2">
|
||||
<i class="fas fa-clock text-gray-500 mr-2"></i>
|
||||
<span class="text-gray-600">
|
||||
{{ $venue->open_time ?? '00:00' }} - {{ $venue->close_time ?? '23:59' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex items-center mb-4">
|
||||
<i class="fas fa-circle {{ $venue->status == 'active' ? 'text-green-500' : 'text-red-500' }} mr-2"></i>
|
||||
<span class="text-sm font-medium {{ $venue->status == 'active' ? 'text-green-700' : 'text-red-700' }}">
|
||||
{{ $venue->status == 'active' ? 'Aktif' : 'Tidak Aktif' }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@if($venue->description)
|
||||
<div class="mb-4">
|
||||
<p class="text-gray-600 text-sm line-clamp-2">{{ Str::limit($venue->description, 100) }}</p>
|
||||
<div class="p-6 text-center">
|
||||
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100 mb-4">
|
||||
<i class="fas fa-exclamation-triangle text-red-600 text-xl"></i>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="border-t pt-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<div class="text-sm text-gray-500">
|
||||
<span class="font-medium">{{ $venue->created_at->format('d M Y') }}</span>
|
||||
<h3 class="mb-2 text-lg font-semibold text-gray-900">Hapus Venue</h3>
|
||||
<p class="mb-6 text-sm text-gray-500">
|
||||
Apakah Anda yakin ingin menghapus venue ini? Semua data terkait dengan venue ini akan ikut
|
||||
terhapus
|
||||
dan tidak dapat dikembalikan.
|
||||
</p>
|
||||
<form id="deleteVenueForm" method="POST" action="" class="space-y-4">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<div class="flex justify-center space-x-3">
|
||||
<button type="submit"
|
||||
class="px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-lg hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 transition-colors duration-200">
|
||||
Ya, Hapus
|
||||
</button>
|
||||
<button type="button" onclick="closeDeleteModal()"
|
||||
class="px-4 py-2 bg-white text-gray-700 text-sm font-medium rounded-lg border border-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-500 transition-colors duration-200">
|
||||
Batal
|
||||
</button>
|
||||
</div>
|
||||
<a href="{{ route('superadmin.venue.edit', $venue->id) }}"
|
||||
class="text-green-600 hover:text-green-800 flex items-center text-sm transition-colors duration-200">
|
||||
Detail
|
||||
<i class="fas fa-arrow-right ml-1"></i>
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
<div class="col-span-3 bg-white rounded-lg shadow p-8 text-center">
|
||||
<div class="max-w-sm mx-auto">
|
||||
<i class="fas fa-building text-gray-300 text-6xl mb-4"></i>
|
||||
<h3 class="text-xl font-semibold text-gray-900 mb-2">Belum ada venue</h3>
|
||||
<p class="text-gray-500 mb-6">Mulai tambahkan venue baru untuk mengelola bisnis Anda dengan lebih baik</p>
|
||||
<a href="{{ route('superadmin.venue.create') }}"
|
||||
class="px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 inline-flex items-center transition-colors duration-200">
|
||||
<i class="fas fa-plus mr-2"></i>
|
||||
Tambah Venue Pertama
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
<!-- Pagination -->
|
||||
@if($venues->hasPages())
|
||||
<div class="mt-8">
|
||||
<div class="bg-white px-4 py-3 border border-gray-200 rounded-lg">
|
||||
{{ $venues->appends(request()->query())->links() }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<!-- Delete Venue Confirmation Modal -->
|
||||
<div id="deleteVenueModal" tabindex="-1" aria-hidden="true"
|
||||
class="fixed top-0 left-0 right-0 z-50 hidden w-full p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-modal md:h-full bg-gray-900 bg-opacity-50">
|
||||
<div class="relative w-full h-full max-w-md md:h-auto mx-auto flex items-center justify-center min-h-screen">
|
||||
<div class="relative bg-white rounded-lg shadow-xl max-w-md w-full">
|
||||
<div class="flex items-center justify-between p-5 border-b border-gray-200">
|
||||
<h3 class="text-xl font-semibold text-gray-900">
|
||||
Konfirmasi Hapus
|
||||
</h3>
|
||||
<button type="button" onclick="closeDeleteModal()"
|
||||
class="text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center transition-colors duration-200">
|
||||
<i class="fas fa-times w-5 h-5"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="p-6 text-center">
|
||||
<div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-red-100 mb-4">
|
||||
<i class="fas fa-exclamation-triangle text-red-600 text-xl"></i>
|
||||
</div>
|
||||
<h3 class="mb-2 text-lg font-semibold text-gray-900">Hapus Venue</h3>
|
||||
<p class="mb-6 text-sm text-gray-500">
|
||||
Apakah Anda yakin ingin menghapus venue ini? Semua data terkait dengan venue ini akan ikut terhapus
|
||||
dan tidak dapat dikembalikan.
|
||||
</p>
|
||||
<form id="deleteVenueForm" method="POST" action="" class="space-y-4">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
<div class="flex justify-center space-x-3">
|
||||
<button type="submit"
|
||||
class="px-4 py-2 bg-red-600 text-white text-sm font-medium rounded-lg hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 transition-colors duration-200">
|
||||
Ya, Hapus
|
||||
</button>
|
||||
<button type="button" onclick="closeDeleteModal()"
|
||||
class="px-4 py-2 bg-white text-gray-700 text-sm font-medium rounded-lg border border-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-500 transition-colors duration-200">
|
||||
Batal
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue