110 lines
4.8 KiB
PHP
110 lines
4.8 KiB
PHP
<?php
|
|
require_once 'header.php';
|
|
require_once 'hero.php';
|
|
require_once 'db/config.php';
|
|
|
|
// Fetch featured restaurants and their cuisines
|
|
$stmt = $pdo->query("
|
|
SELECT
|
|
r.id,
|
|
r.name,
|
|
r.description,
|
|
r.image_url,
|
|
GROUP_CONCAT(c.name SEPARATOR ', ') as cuisines
|
|
FROM restaurants r
|
|
LEFT JOIN restaurant_cuisines rc ON r.id = rc.restaurant_id
|
|
LEFT JOIN cuisines c ON rc.cuisine_id = c.id
|
|
WHERE r.is_active = 1
|
|
GROUP BY r.id
|
|
ORDER BY r.id DESC
|
|
LIMIT 6
|
|
");
|
|
$featured_restaurants = $stmt->fetchAll();
|
|
|
|
// Fetch featured cuisines for the filter section
|
|
$stmt = $pdo->query("SELECT * FROM cuisines ORDER BY name ASC LIMIT 12");
|
|
$cuisines = $stmt->fetchAll();
|
|
?>
|
|
|
|
<div class="container my-5">
|
|
<!-- How It Works Section -->
|
|
<section id="how-it-works" class="text-center py-5">
|
|
<h2 class="section-title">How It Works</h2>
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="feature-card card h-100 p-4">
|
|
<div class="feature-icon mb-3"><i class="fas fa-store"></i></div>
|
|
<h3>Choose a Restaurant</h3>
|
|
<p>Browse our extensive list of local restaurants and stores.</p>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="feature-card card h-100 p-4">
|
|
<div class="feature-icon mb-3"><i class="fas fa-utensils"></i></div>
|
|
<h3>Pick Your Meal</h3>
|
|
<p>Select your favorite dishes and add them to your cart.</p>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<div class="feature-card card h-100 p-4">
|
|
<div class="feature-icon mb-3"><i class="fas fa-shipping-fast"></i></div>
|
|
<h3>Fast Delivery</h3>
|
|
<p>Get your food delivered right to your doorstep, fast!</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Featured Restaurants Section -->
|
|
<section id="restaurants" class="py-5">
|
|
<h2 class="section-title text-center">Featured Restaurants</h2>
|
|
<div class="row">
|
|
<?php if (count($featured_restaurants) > 0): ?>
|
|
<?php foreach ($featured_restaurants as $restaurant): ?>
|
|
<div class="col-md-4 mb-4">
|
|
<div class="restaurant-card card h-100">
|
|
<a href="menu.php?restaurant_id=<?php echo $restaurant['id']; ?>">
|
|
<img src="<?php echo htmlspecialchars($restaurant['image_url']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($restaurant['name']); ?>" style="height: 200px; object-fit: cover;">
|
|
</a>
|
|
<div class="card-body">
|
|
<h5 class="card-title"><a href="menu.php?restaurant_id=<?php echo $restaurant['id']; ?>" class="text-dark text-decoration-none"><?php echo htmlspecialchars($restaurant['name']); ?></a></h5>
|
|
<p class="card-text text-muted"><?php echo htmlspecialchars($restaurant['cuisines']); ?></p>
|
|
</div>
|
|
<div class="card-footer bg-white border-top-0">
|
|
<a href="menu.php?restaurant_id=<?php echo $restaurant['id']; ?>" class="btn btn-primary">View Menu</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<div class="col">
|
|
<p class="text-center">No featured restaurants available at the moment.</p>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Cuisines Section -->
|
|
<section id="cuisines" class="py-5 bg-light">
|
|
<h2 class="section-title text-center">Explore by Cuisine</h2>
|
|
<div class="row justify-content-center">
|
|
<?php if (count($cuisines) > 0): ?>
|
|
<?php foreach ($cuisines as $cuisine): ?>
|
|
<div class="col-lg-2 col-md-3 col-sm-4 col-6 mb-4">
|
|
<a href="restaurants.php?cuisine_id=<?php echo $cuisine['id']; ?>" class="cuisine-card">
|
|
<img src="<?php echo htmlspecialchars($cuisine['image_url']); ?>" alt="<?php echo htmlspecialchars($cuisine['name']); ?>">
|
|
<h5 class="mt-2"><?php echo htmlspecialchars($cuisine['name']); ?></h5>
|
|
</a>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php else: ?>
|
|
<div class="col">
|
|
<p class="text-center">No cuisines found.</p>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<?php require_once 'footer.php'; ?>
|