Pengulangan untuk home blade

This commit is contained in:
Stephen Gesityan 2025-05-11 17:21:04 +07:00
parent d167f80959
commit 3a02bf8c96
4 changed files with 84 additions and 78 deletions

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\pages;
use App\Http\Controllers\Controller;
use App\Models\Venue;
use Illuminate\Http\Request;
class HomeController extends Controller
@ -13,6 +14,7 @@ class HomeController extends Controller
// }
public function index() {
return view('pages.home');
$venues = Venue::paginate(10);
return view('pages.home', compact('venues'));
}
}

View File

@ -158,6 +158,7 @@ public function destroy($id)
Storage::disk('public')->delete($venue->image);
}
$venue->tables()->delete();
$venue->delete();
return redirect()->route('superadmin.venue.index')

View File

@ -22,15 +22,19 @@
<div class="flex justify-between items-start">
<div>
<p class="text-sm font-medium text-gray-500">Pendapatan Hari Ini</p>
<p class="text-2xl font-bold text-gray-800">Rp{{ number_format($todayRevenue, 0, ',', '.') }}</p>
<p class="text-2xl font-bold text-gray-800">Rp{{ number_format($todayRevenue, 0, ',', '.') }}
</p>
</div>
<div class="text-green-500 p-2 bg-green-50 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
</div>
<p class="text-xs text-gray-500 mt-2">Pendapatan Bulan Ini: Rp{{ number_format($monthlyRevenue, 0, ',', '.') }}</p>
<p class="text-xs text-gray-500 mt-2">Pendapatan Bulan Ini:
Rp{{ number_format($monthlyRevenue, 0, ',', '.') }}</p>
</div>
<!-- Today's Bookings -->
@ -41,14 +45,18 @@
<p class="text-2xl font-bold text-gray-800">{{ $todayBookings }}</p>
</div>
<div class="text-blue-500 p-2 bg-blue-50 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
</svg>
</div>
</div>
<div class="flex mt-2 space-x-4">
<p class="text-xs text-gray-500">Pending: <span class="font-semibold text-amber-500">{{ $pendingBookings }}</span></p>
<p class="text-xs text-gray-500">Paid: <span class="font-semibold text-green-500">{{ $paidBookings }}</span></p>
<p class="text-xs text-gray-500">Pending: <span
class="font-semibold text-amber-500">{{ $pendingBookings }}</span></p>
<p class="text-xs text-gray-500">Paid: <span
class="font-semibold text-green-500">{{ $paidBookings }}</span></p>
</div>
</div>
@ -60,14 +68,18 @@
<p class="text-2xl font-bold text-gray-800">{{ $totalTables }}</p>
</div>
<div class="text-purple-500 p-2 bg-purple-50 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h7" />
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 6h16M4 12h16M4 18h7" />
</svg>
</div>
</div>
<div class="flex mt-2 space-x-4">
<p class="text-xs text-gray-500">Tersedia: <span class="font-semibold text-green-500">{{ $availableTables }}</span></p>
<p class="text-xs text-gray-500">Digunakan: <span class="font-semibold text-red-500">{{ $usedTables }}</span></p>
<p class="text-xs text-gray-500">Tersedia: <span
class="font-semibold text-green-500">{{ $availableTables }}</span></p>
<p class="text-xs text-gray-500">Digunakan: <span
class="font-semibold text-red-500">{{ $usedTables }}</span></p>
</div>
</div>
@ -76,16 +88,20 @@
<div class="flex justify-between items-start">
<div>
<p class="text-sm font-medium text-gray-500">Penggunaan Meja</p>
<p class="text-2xl font-bold text-gray-800">{{ $totalTables > 0 ? round(($usedTables / $totalTables) * 100) : 0 }}%</p>
<p class="text-2xl font-bold text-gray-800">
{{ $totalTables > 0 ? round(($usedTables / $totalTables) * 100) : 0 }}%</p>
</div>
<div class="text-amber-500 p-2 bg-amber-50 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
</svg>
</div>
</div>
<div class="w-full bg-gray-200 rounded-full h-2.5 mt-3">
<div class="bg-amber-500 h-2.5 rounded-full" style="width: {{ $totalTables > 0 ? ($usedTables / $totalTables) * 100 : 0 }}%"></div>
<div class="bg-amber-500 h-2.5 rounded-full"
style="width: {{ $totalTables > 0 ? ($usedTables / $totalTables) * 100 : 0 }}%"></div>
</div>
</div>
</div>
@ -102,7 +118,8 @@
<div class="bg-white rounded-xl shadow-sm p-6">
<div class="flex justify-between items-center mb-4">
<h2 class="font-semibold text-lg">Booking Terbaru</h2>
<a href="{{ route('admin.bookings.index') }}" class="text-sm text-blue-600 hover:underline">Lihat Semua</a>
<a href="{{ route('admin.bookings.index') }}" class="text-sm text-blue-600 hover:underline">Lihat
Semua</a>
</div>
@if($recentBookings->isEmpty())
@ -112,8 +129,10 @@
@foreach($recentBookings as $booking)
<div class="flex items-center p-3 border border-gray-100 rounded-lg hover:bg-gray-50 transition">
<div class="p-2 mr-3 bg-gray-100 rounded-lg">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-gray-500" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" />
</svg>
</div>
<div class="flex-1">
@ -145,7 +164,7 @@
@push('scripts')
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener('DOMContentLoaded', function () {
// Booking Chart
var bookingData = @json($lastWeekBookings);

View File

@ -64,43 +64,27 @@ class="w-full py-3 md:px-6 rounded-lg text-sm bg-primary text-white font-semibol
terendah</span></p>
</div>
</div>
<div class="px-4 lg:px-44 flex flex-col md:flex-row space-y-6 md:space-y-0 md:space-x-4">
<a href="/venue/capitano" class="md:min-h-48 md:flex md:flex-col">
<div>
<img src="{{ asset('images/billiard2.jpg') }}" alt="Ayo Logo" class="w-full rounded-t-lg">
</div>
<div class="md:flex-grow px-4 py-2 border border-gray-400 rounded-b-lg">
<div class="px-4 lg:px-44">
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
@forelse ($venues as $venue)
<a href="/venue/{{ ($venue->name) }}"
class="flex flex-col h-full border border-gray-400 rounded-lg overflow-hidden">
<img src="{{ $venue->image }}" alt="{{ $venue->name }}" class="w-full h-48 object-cover">
<div class="flex-grow px-4 py-2">
<h3 class="text-sm text-gray-400 font-semibold mb-2">Venue</h3>
<h1 class="text-xl text-gray-800 font-semibold">Capitano Billiard</h1>
<h1 class="text-xl text-gray-800 font-semibold">{{ $venue->name }}</h1>
<p class="text-sm text-gray-500">Genteng</p>
<p class="mt-10 text-gray-500 text-sm">Mulai: <span class="font-bold text-gray-800">Rp30,000
</span><span class="text-gray-400 font-thin text-sm">/ jam</span></p>
<p class="mt-10 text-gray-500 text-sm">Mulai:
<span class="font-bold text-gray-800">Rp30,000</span>
<span class="text-gray-400 font-thin text-sm">/ jam</span>
</p>
</div>
</a>
<a href="/venue/osing" class="md:min-h-48 md:flex md:flex-col">
<div>
<img src="{{ asset('images/billiard3.jpg') }}" alt="Ayo Logo" class="w-full rounded-t-lg">
@empty
<p class="text-center col-span-full text-gray-500">Belum ada venue tersedia.</p>
@endforelse
</div>
<div class="md:flex-grow px-4 py-2 border border-gray-400 rounded-b-lg">
<h3 class="text-sm text-gray-400 font-semibold mb-2">Venue</h3>
<h1 class="text-xl text-gray-800 font-semibold">Osing Billiard Center</h1>
<p class="text-sm text-gray-500">Lidah</p>
<p class="mt-10 text-gray-500 text-sm">Mulai: <span class="font-bold text-gray-800">Rp25,000
</span><span class="text-gray-400 font-thin text-sm">/ jam</span></p>
</div>
</a>
<a href="/venue/das" class="md:min-h-48 md:flex md:flex-col">
<div>
<img src="{{ asset('images/billiard4.jpg') }}" alt="Ayo Logo" class="w-full rounded-t-lg">
</div>
<div class="md:flex-grow px-4 py-2 border border-gray-400 rounded-b-lg">
<h3 class="text-sm text-gray-400 font-semibold mb-2">Venue</h3>
<h1 class="text-xl text-gray-800 font-semibold">DAS Game & Billiard</h1>
<p class="text-sm text-gray-500">Jalen</p>
<p class="mt-10 text-gray-500 text-sm">Mulai: <span class="font-bold text-gray-800">Rp20,000
</span><span class="text-gray-400 font-thin text-sm">/ jam</span></p>
</div>
</a>
</div>
</div>
@endsection