78 lines
2.7 KiB
PHP
78 lines
2.7 KiB
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
// Fetch venues from the database
|
|
$stmt = db()->query("SELECT * FROM venues ORDER BY name ASC");
|
|
$venues = $stmt->fetchAll();
|
|
|
|
function render_venue_card($venue) {
|
|
$features = json_decode($venue['features'], true);
|
|
$status_badge = $venue['is_booked']
|
|
? '<span class="badge badge-booked">Booked</span>'
|
|
: '<span class="badge badge-available">Available</span>';
|
|
|
|
$features_html = '';
|
|
if (!empty($features)) {
|
|
$features_html .= '<ul class="features-list mt-3">';
|
|
foreach ($features as $feature) {
|
|
$features_html .= '<li><i data-feather="check-circle"></i>' . htmlspecialchars($feature) . '</li>';
|
|
}
|
|
$features_html .= '</ul>';
|
|
}
|
|
|
|
return <<<HTML
|
|
<div class="col-lg-4 col-md-6 mb-4">
|
|
<div class="card venue-card h-100">
|
|
<img src="{$venue['image_url']}" class="card-img-top" alt="Image of {$venue['name']}">
|
|
<div class="card-body d-flex flex-column">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<h5 class="card-title">{$venue['name']}</h5>
|
|
{$status_badge}
|
|
</div>
|
|
<p class="card-text text-muted">Capacity: {$venue['capacity']} guests</p>
|
|
{$features_html}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
HTML;
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Our Venues - EventManager</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<?php include __DIR__ . '/index.php'; ?>
|
|
|
|
<main class="container">
|
|
<h1 class="page-title text-center">Our Venues</h1>
|
|
<div class="row">
|
|
<?php foreach ($venues as $venue):
|
|
echo render_venue_card($venue);
|
|
endforeach; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="footer">
|
|
<p>© <?php echo date("Y"); ?> EventManager. All Rights Reserved.</p>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="https://unpkg.com/feather-icons"></script>
|
|
<script>
|
|
feather.replace()
|
|
</script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|