88 lines
3.1 KiB
PHP
88 lines
3.1 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/includes/bootstrap.php';
|
|
|
|
$projectName = $_SERVER['PROJECT_NAME'] ?? 'CineReserve';
|
|
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
|
|
$stmt = db()->query(
|
|
"SELECT b.*, s.show_time, m.title
|
|
FROM bookings b
|
|
JOIN shows s ON s.id = b.show_id
|
|
JOIN movies m ON m.id = s.movie_id
|
|
ORDER BY b.created_at DESC
|
|
LIMIT 50"
|
|
);
|
|
$bookings = $stmt->fetchAll();
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title><?= h($projectName) ?> — Admin bookings</title>
|
|
<?php if ($projectDescription): ?>
|
|
<meta name="description" content="<?= h($projectDescription) ?>" />
|
|
<meta property="og:description" content="<?= h($projectDescription) ?>" />
|
|
<meta property="twitter:description" content="<?= h($projectDescription) ?>" />
|
|
<?php endif; ?>
|
|
<?php if ($projectImageUrl): ?>
|
|
<meta property="og:image" content="<?= h($projectImageUrl) ?>" />
|
|
<meta property="twitter:image" content="<?= h($projectImageUrl) ?>" />
|
|
<?php endif; ?>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time(); ?>">
|
|
</head>
|
|
<body>
|
|
<div class="app-shell">
|
|
<nav class="navbar navbar-light">
|
|
<div class="container">
|
|
<a class="navbar-brand fw-semibold" href="/"> <?= h($projectName) ?></a>
|
|
<a class="btn btn-outline-dark btn-sm" href="/">Back to dashboard</a>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container my-4">
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h1 class="h4 mb-0">Bookings overview</h1>
|
|
<span class="text-muted small">Last 50 bookings</span>
|
|
</div>
|
|
<div class="surface">
|
|
<?php if (!$bookings): ?>
|
|
<div class="alert alert-light border mb-0">No bookings yet.</div>
|
|
<?php else: ?>
|
|
<div class="table-responsive">
|
|
<table class="table align-middle mb-0">
|
|
<thead>
|
|
<tr>
|
|
<th>Code</th>
|
|
<th>Movie</th>
|
|
<th>Showtime</th>
|
|
<th>Seats</th>
|
|
<th>Status</th>
|
|
<th>Check-in</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($bookings as $booking): ?>
|
|
<tr>
|
|
<td><a class="text-decoration-none" href="admin_booking.php?code=<?= h($booking['booking_code']) ?>"><?= h($booking['booking_code']) ?></a></td>
|
|
<td><?= h($booking['title']) ?></td>
|
|
<td><?= h(date('M d, H:i', strtotime($booking['show_time']))) ?></td>
|
|
<td><?= h($booking['seats']) ?></td>
|
|
<td><span class="badge-soft"><?= h($booking['status']) ?></span></td>
|
|
<td><?= $booking['checked_in'] ? 'Checked in' : 'Pending' ?></td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
</html>
|