diff --git a/app/Http/Controllers/ClubController.php b/app/Http/Controllers/ClubController.php index d6ffb3b..b2f743f 100644 --- a/app/Http/Controllers/ClubController.php +++ b/app/Http/Controllers/ClubController.php @@ -51,12 +51,14 @@ class ClubController extends Controller 'club_name' => $club->club_name, 'slug' => $club->slug, 'logo' => $club->logo, + 'cover_image' => $club->cover_image, 'gps_lat' => (float) $club->gps_lat, 'gps_long' => (float) $club->gps_long, 'distance' => round($distance, 2), // distance in kilometers 'owner_name' => $club->owner ? $club->owner->full_name : 'N/A', 'owner_email' => $club->owner ? $club->owner->email : null, 'owner_mobile' => $club->owner ? $club->owner->mobile : null, + 'address' => $club->address, ]; }); @@ -133,10 +135,12 @@ class ClubController extends Controller 'club_name' => $club->club_name, 'slug' => $club->slug, 'logo' => $club->logo, + 'cover_image' => $club->cover_image, 'gps_lat' => $club->gps_lat ? (float) $club->gps_lat : null, 'gps_long' => $club->gps_long ? (float) $club->gps_long : null, 'distance' => $distance !== null ? round($distance, 2) : null, 'owner_name' => $club->owner ? $club->owner->full_name : 'N/A', + 'address' => $club->address, ]; }); @@ -175,10 +179,12 @@ class ClubController extends Controller 'club_name' => $club->club_name, 'slug' => $club->slug, 'logo' => $club->logo, + 'cover_image' => $club->cover_image, 'gps_lat' => $club->gps_lat ? (float) $club->gps_lat : null, 'gps_long' => $club->gps_long ? (float) $club->gps_long : null, 'distance' => null, 'owner_name' => $club->owner ? $club->owner->full_name : 'N/A', + 'address' => $club->address, ]; }); diff --git a/resources/views/clubs/explore.blade.php b/resources/views/clubs/explore.blade.php index fb678fc..e01a10d 100644 --- a/resources/views/clubs/explore.blade.php +++ b/resources/views/clubs/explore.blade.php @@ -249,14 +249,14 @@ document.addEventListener('DOMContentLoaded', function() { if (!navigator.geolocation) { showAlert('Geolocation is not supported by your browser', 'danger'); document.getElementById('loadingSpinner').style.display = 'none'; + // If no geolocation, fetch all clubs + fetchAllClubs(); } else { // Automatically start watching user's location + // This will fetch clubs once location is detected startWatchingLocation(); } - // Initial load: fetch all clubs since 'all' is default - fetchAllClubs(); - // Category buttons document.querySelectorAll('.category-btn').forEach(btn => { btn.addEventListener('click', function() { @@ -331,8 +331,8 @@ function startWatchingLocation() { updateLocationDisplay(userLocation.latitude, userLocation.longitude); - // Fetch nearby clubs - fetchNearbyClubs(userLocation.latitude, userLocation.longitude); + // Fetch all clubs with location-based sorting (since 'all' is default) + fetchAllClubs(); // Stop watching after first successful location if (watchId) { @@ -497,16 +497,37 @@ function displayClubs(clubs) { clubs.forEach(club => { const card = document.createElement('div'); card.className = 'col'; + + // Prepare cover image + let coverImageHtml = ''; + if (club.cover_image) { + coverImageHtml = `${club.club_name}`; + } else { + coverImageHtml = `
+ +
`; + } + + // Prepare logo + let logoHtml = ''; + if (club.logo) { + logoHtml = `${club.club_name} logo`; + } else { + logoHtml = `
+ ${club.club_name.charAt(0)} +
`; + } + card.innerHTML = `
- ${club.club_name} + ${coverImageHtml}
- ${club.club_name} logo + ${logoHtml}
diff --git a/routes/web.php b/routes/web.php index 4bc87c2..12ed806 100644 --- a/routes/web.php +++ b/routes/web.php @@ -82,7 +82,9 @@ Route::middleware(['auth'])->group(function () { // Platform Admin routes (Super Admin only) Route::middleware(['auth', 'verified', 'role:super-admin'])->prefix('admin')->name('admin.')->group(function () { - Route::get('/', [App\Http\Controllers\Admin\PlatformController::class, 'index'])->name('platform.index'); + Route::get('/', function () { + return redirect()->route('admin.platform.clubs'); + })->name('platform.index'); // All Clubs Management Route::get('/clubs', [App\Http\Controllers\Admin\PlatformController::class, 'clubs'])->name('platform.clubs');