booking
This commit is contained in:
parent
b173231d6b
commit
a60c7b17bb
89
admin_booking.php
Normal file
89
admin_booking.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?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'] ?? '';
|
||||
|
||||
$code = trim($_GET['code'] ?? '');
|
||||
$booking = null;
|
||||
if ($code !== '') {
|
||||
$stmt = db()->prepare(
|
||||
"SELECT b.*, s.show_time, s.screen, s.format_label, m.title
|
||||
FROM bookings b
|
||||
JOIN shows s ON s.id = b.show_id
|
||||
JOIN movies m ON m.id = s.movie_id
|
||||
WHERE b.booking_code = ?"
|
||||
);
|
||||
$stmt->execute([$code]);
|
||||
$booking = $stmt->fetch();
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title><?= h($projectName) ?> — Booking detail</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="admin_bookings.php">Back to list</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container my-4">
|
||||
<?php if (!$booking): ?>
|
||||
<div class="alert alert-light border">Booking not found.</div>
|
||||
<?php else: ?>
|
||||
<div class="surface">
|
||||
<h1 class="h5 mb-3">Booking <?= h($booking['booking_code']) ?></h1>
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-6">
|
||||
<div class="text-muted small">Customer</div>
|
||||
<div class="fw-semibold"><?= h($booking['customer_name']) ?></div>
|
||||
<div class="text-muted small"><?= h($booking['customer_email']) ?></div>
|
||||
</div>
|
||||
<div class="col-lg-6">
|
||||
<div class="text-muted small">Showtime</div>
|
||||
<div class="fw-semibold"><?= h($booking['title']) ?></div>
|
||||
<div class="text-muted small"><?= h(date('M d, H:i', strtotime($booking['show_time']))) ?> · <?= h($booking['format_label']) ?> · <?= h($booking['screen']) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<div class="text-muted small">Seats</div>
|
||||
<div class="fw-semibold"><?= h($booking['seats']) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-muted small">Total</div>
|
||||
<div class="fw-semibold">$<?= h(number_format((float)$booking['total_price'], 2)) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-muted small">Check-in</div>
|
||||
<div class="fw-semibold"><?= $booking['checked_in'] ? 'Checked in' : 'Pending' ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
87
admin_bookings.php
Normal file
87
admin_bookings.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?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>
|
||||
84
agent.php
Normal file
84
agent.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?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'] ?? '';
|
||||
|
||||
$shows = db()->query(
|
||||
"SELECT s.*, m.title
|
||||
FROM shows s
|
||||
JOIN movies m ON m.id = s.movie_id
|
||||
ORDER BY s.show_time ASC"
|
||||
)->fetchAll();
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title><?= h($projectName) ?> — Agent POS</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">Agent booking console</h1>
|
||||
<span class="text-muted small">Pick a showtime for walk-in guests</span>
|
||||
</div>
|
||||
<div class="surface">
|
||||
<?php if (!$shows): ?>
|
||||
<div class="alert alert-light border mb-0">No showtimes available.</div>
|
||||
<?php else: ?>
|
||||
<div class="table-responsive">
|
||||
<table class="table align-middle mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Movie</th>
|
||||
<th>Showtime</th>
|
||||
<th>Screen</th>
|
||||
<th>Format</th>
|
||||
<th>Price</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($shows as $show): ?>
|
||||
<tr>
|
||||
<td><?= h($show['title']) ?></td>
|
||||
<td><?= h(date('M d, H:i', strtotime($show['show_time']))) ?></td>
|
||||
<td><?= h($show['screen']) ?></td>
|
||||
<td><?= h($show['format_label']) ?></td>
|
||||
<td>$<?= h(number_format((float)$show['price'], 2)) ?></td>
|
||||
<td><a class="btn btn-outline-dark btn-sm" href="booking.php?show_id=<?= h((string)$show['id']) ?>">Book seats</a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,403 +1,129 @@
|
||||
body {
|
||||
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
|
||||
background-size: 400% 400%;
|
||||
animation: gradient 15s ease infinite;
|
||||
color: #212529;
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
background: #f6f7f9;
|
||||
color: #111827;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.main-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 100vh;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@keyframes gradient {
|
||||
0% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% 50%;
|
||||
}
|
||||
100% {
|
||||
background-position: 0% 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.chat-container {
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
border-radius: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 85vh;
|
||||
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
|
||||
backdrop-filter: blur(15px);
|
||||
-webkit-backdrop-filter: blur(15px);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chat-header {
|
||||
padding: 1.5rem;
|
||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
font-weight: 700;
|
||||
font-size: 1.1rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.chat-messages {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 1.5rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
/* Custom Scrollbar */
|
||||
::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.message {
|
||||
max-width: 85%;
|
||||
padding: 0.85rem 1.1rem;
|
||||
border-radius: 16px;
|
||||
line-height: 1.5;
|
||||
font-size: 0.95rem;
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
||||
animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; transform: translateY(20px) scale(0.95); }
|
||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
||||
}
|
||||
|
||||
.message.visitor {
|
||||
align-self: flex-end;
|
||||
background: linear-gradient(135deg, #212529 0%, #343a40 100%);
|
||||
color: #fff;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.message.bot {
|
||||
align-self: flex-start;
|
||||
.navbar {
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
background: #ffffff;
|
||||
color: #212529;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
|
||||
.chat-input-area {
|
||||
padding: 1.25rem;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.chat-input-area form {
|
||||
.app-shell {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.chat-input-area input {
|
||||
flex: 1;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
border-radius: 12px;
|
||||
padding: 0.75rem 1rem;
|
||||
outline: none;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.chat-input-area input:focus {
|
||||
border-color: #23a6d5;
|
||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.2);
|
||||
}
|
||||
|
||||
.chat-input-area button {
|
||||
background: #212529;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.chat-input-area button:hover {
|
||||
background: #000;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
/* Background Animations */
|
||||
.bg-animations {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.blob {
|
||||
position: absolute;
|
||||
width: 500px;
|
||||
height: 500px;
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 50%;
|
||||
filter: blur(80px);
|
||||
animation: move 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
|
||||
}
|
||||
|
||||
.blob-1 {
|
||||
top: -10%;
|
||||
left: -10%;
|
||||
background: rgba(238, 119, 82, 0.4);
|
||||
}
|
||||
|
||||
.blob-2 {
|
||||
bottom: -10%;
|
||||
right: -10%;
|
||||
background: rgba(35, 166, 213, 0.4);
|
||||
animation-delay: -7s;
|
||||
width: 600px;
|
||||
height: 600px;
|
||||
}
|
||||
|
||||
.blob-3 {
|
||||
top: 40%;
|
||||
left: 30%;
|
||||
background: rgba(231, 60, 126, 0.3);
|
||||
animation-delay: -14s;
|
||||
width: 450px;
|
||||
height: 450px;
|
||||
}
|
||||
|
||||
@keyframes move {
|
||||
0% { transform: translate(0, 0) rotate(0deg) scale(1); }
|
||||
33% { transform: translate(150px, 100px) rotate(120deg) scale(1.1); }
|
||||
66% { transform: translate(-50px, 200px) rotate(240deg) scale(0.9); }
|
||||
100% { transform: translate(0, 0) rotate(360deg) scale(1); }
|
||||
}
|
||||
|
||||
.header-link {
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 8px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.header-link:hover {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Admin Styles */
|
||||
.admin-container {
|
||||
max-width: 900px;
|
||||
margin: 3rem auto;
|
||||
.hero {
|
||||
background: #ffffff;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
padding: 2.5rem;
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border-radius: 24px;
|
||||
box-shadow: 0 20px 50px rgba(0,0,0,0.15);
|
||||
border: 1px solid rgba(255, 255, 255, 0.4);
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.admin-container h1 {
|
||||
margin-top: 0;
|
||||
color: #212529;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 8px;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 1rem;
|
||||
color: #6c757d;
|
||||
.hero h1 {
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
padding: 1.25rem;
|
||||
}
|
||||
|
||||
.movie-card {
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
background: #ffffff;
|
||||
padding: 1.5rem;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.badge-soft {
|
||||
background: #f3f4f6;
|
||||
color: #374151;
|
||||
border-radius: 999px;
|
||||
padding: 0.25rem 0.75rem;
|
||||
font-weight: 500;
|
||||
font-size: 0.75rem;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.table td {
|
||||
background: #fff;
|
||||
padding: 1rem;
|
||||
border: none;
|
||||
.seat-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8, minmax(0, 1fr));
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.table tr td:first-child { border-radius: 12px 0 0 12px; }
|
||||
.table tr td:last-child { border-radius: 0 12px 12px 0; }
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
width: 100%;
|
||||
padding: 0.75rem 1rem;
|
||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
transition: all 0.3s ease;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.form-control:focus {
|
||||
outline: none;
|
||||
border-color: #23a6d5;
|
||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.1);
|
||||
}
|
||||
|
||||
.header-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.header-links {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.admin-card {
|
||||
background: rgba(255, 255, 255, 0.6);
|
||||
padding: 2rem;
|
||||
border-radius: 20px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.5);
|
||||
margin-bottom: 2.5rem;
|
||||
box-shadow: 0 10px 30px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.admin-card h3 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1.5rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background: #dc3545;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-add {
|
||||
background: #212529;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.btn-save {
|
||||
background: #0088cc;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.8rem 1.5rem;
|
||||
border-radius: 12px;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
width: 100%;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.webhook-url {
|
||||
font-size: 0.85em;
|
||||
color: #555;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.history-table-container {
|
||||
overflow-x: auto;
|
||||
background: rgba(255, 255, 255, 0.4);
|
||||
padding: 1rem;
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.history-table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.history-table-time {
|
||||
width: 15%;
|
||||
white-space: nowrap;
|
||||
font-size: 0.85em;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.history-table-user {
|
||||
width: 35%;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
border-radius: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.history-table-ai {
|
||||
width: 50%;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
border-radius: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.no-messages {
|
||||
.seat {
|
||||
border: 1px solid #d1d5db;
|
||||
background: #ffffff;
|
||||
color: #111827;
|
||||
border-radius: 6px;
|
||||
padding: 0.35rem 0;
|
||||
font-size: 0.75rem;
|
||||
text-align: center;
|
||||
color: #777;
|
||||
}
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.seat:hover {
|
||||
border-color: #111827;
|
||||
}
|
||||
|
||||
.seat.selected {
|
||||
background: #111827;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.seat.taken {
|
||||
background: #e5e7eb;
|
||||
color: #9ca3af;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.surface {
|
||||
background: #ffffff;
|
||||
border: 1px solid #e5e7eb;
|
||||
border-radius: 10px;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.table thead th {
|
||||
font-weight: 600;
|
||||
font-size: 0.85rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #111827;
|
||||
border-color: #111827;
|
||||
border-radius: 8px;
|
||||
padding: 0.55rem 1.25rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.btn-outline-dark {
|
||||
border-radius: 8px;
|
||||
padding: 0.55rem 1.25rem;
|
||||
}
|
||||
|
||||
.form-control, .form-select {
|
||||
border-radius: 8px;
|
||||
border-color: #d1d5db;
|
||||
}
|
||||
|
||||
.alert {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: auto;
|
||||
border-top: 1px solid #e5e7eb;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
@ -1,39 +1,34 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const chatForm = document.getElementById('chat-form');
|
||||
const chatInput = document.getElementById('chat-input');
|
||||
const chatMessages = document.getElementById('chat-messages');
|
||||
const seatGrid = document.querySelector('[data-seat-grid]');
|
||||
const seatInput = document.querySelector('[data-seat-input]');
|
||||
const totalOutput = document.querySelector('[data-total]');
|
||||
const seatOutput = document.querySelector('[data-seat-output]');
|
||||
const price = parseFloat(document.body.dataset.price || '0');
|
||||
|
||||
const appendMessage = (text, sender) => {
|
||||
const msgDiv = document.createElement('div');
|
||||
msgDiv.classList.add('message', sender);
|
||||
msgDiv.textContent = text;
|
||||
chatMessages.appendChild(msgDiv);
|
||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
||||
if (!seatGrid || !seatInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
const updateTotals = () => {
|
||||
const selectedSeats = Array.from(seatGrid.querySelectorAll('.seat.selected'))
|
||||
.map((seat) => seat.dataset.seat);
|
||||
seatInput.value = selectedSeats.join(', ');
|
||||
if (seatOutput) {
|
||||
seatOutput.textContent = selectedSeats.length ? selectedSeats.join(', ') : 'None yet';
|
||||
}
|
||||
if (totalOutput) {
|
||||
totalOutput.textContent = (selectedSeats.length * price).toFixed(2);
|
||||
}
|
||||
};
|
||||
|
||||
chatForm.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
const message = chatInput.value.trim();
|
||||
if (!message) return;
|
||||
|
||||
appendMessage(message, 'visitor');
|
||||
chatInput.value = '';
|
||||
|
||||
try {
|
||||
const response = await fetch('api/chat.php', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ message })
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
// Artificial delay for realism
|
||||
setTimeout(() => {
|
||||
appendMessage(data.reply, 'bot');
|
||||
}, 500);
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
appendMessage("Sorry, something went wrong. Please try again.", 'bot');
|
||||
seatGrid.addEventListener('click', (event) => {
|
||||
const seat = event.target.closest('.seat');
|
||||
if (!seat || seat.classList.contains('taken')) {
|
||||
return;
|
||||
}
|
||||
seat.classList.toggle('selected');
|
||||
updateTotals();
|
||||
});
|
||||
|
||||
updateTotals();
|
||||
});
|
||||
|
||||
163
booking.php
Normal file
163
booking.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?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'] ?? '';
|
||||
|
||||
$showId = isset($_GET['show_id']) ? (int)$_GET['show_id'] : 0;
|
||||
$show = $showId ? fetch_show($showId) : null;
|
||||
|
||||
$rows = ['A', 'B', 'C', 'D', 'E'];
|
||||
$seatsPerRow = 8;
|
||||
$allSeats = [];
|
||||
foreach ($rows as $row) {
|
||||
for ($i = 1; $i <= $seatsPerRow; $i++) {
|
||||
$allSeats[] = $row . $i;
|
||||
}
|
||||
}
|
||||
$bookedSeats = $show ? fetch_booked_seats($showId) : [];
|
||||
|
||||
$errors = [];
|
||||
$success = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $show) {
|
||||
$name = trim($_POST['customer_name'] ?? '');
|
||||
$email = trim($_POST['customer_email'] ?? '');
|
||||
$seats = trim($_POST['seats'] ?? '');
|
||||
|
||||
if ($name === '') {
|
||||
$errors[] = 'Customer name is required.';
|
||||
}
|
||||
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
||||
$errors[] = 'A valid email is required.';
|
||||
}
|
||||
$seatList = array_filter(array_map('trim', explode(',', $seats)));
|
||||
if (!$seatList) {
|
||||
$errors[] = 'Select at least one seat.';
|
||||
}
|
||||
|
||||
$invalidSeats = array_diff($seatList, $allSeats);
|
||||
$takenSeats = array_intersect($seatList, $bookedSeats);
|
||||
if ($invalidSeats) {
|
||||
$errors[] = 'One or more seats are invalid.';
|
||||
}
|
||||
if ($takenSeats) {
|
||||
$errors[] = 'Some selected seats are already booked: ' . implode(', ', $takenSeats) . '.';
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
$pdo = db();
|
||||
$bookingCode = generate_booking_code($pdo);
|
||||
$total = count($seatList) * (float)$show['price'];
|
||||
|
||||
$stmt = $pdo->prepare(
|
||||
"INSERT INTO bookings (show_id, customer_name, customer_email, seats, total_price, booking_code)
|
||||
VALUES (?, ?, ?, ?, ?, ?)"
|
||||
);
|
||||
$stmt->execute([$showId, $name, $email, implode(', ', $seatList), $total, $bookingCode]);
|
||||
|
||||
header('Location: confirmation.php?code=' . urlencode($bookingCode));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title><?= h($projectName) ?> — Select seats</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 data-price="<?= h($show ? (string)$show['price'] : '0') ?>">
|
||||
<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 movies</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container my-4">
|
||||
<?php if (!$show): ?>
|
||||
<div class="alert alert-light border">Select a showtime to continue booking.</div>
|
||||
<?php else: ?>
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-7">
|
||||
<div class="surface">
|
||||
<h1 class="h4 mb-2">Choose your seats</h1>
|
||||
<p class="text-muted small mb-4"><?= h($show['title']) ?> · <?= h(date('M d, H:i', strtotime($show['show_time']))) ?> · <?= h($show['format_label']) ?></p>
|
||||
<div class="mb-3">
|
||||
<div class="text-muted small mb-2">Screen</div>
|
||||
<div class="badge-soft"><?= h($show['screen']) ?></div>
|
||||
</div>
|
||||
<div class="seat-grid mb-3" data-seat-grid>
|
||||
<?php foreach ($allSeats as $seat): ?>
|
||||
<?php $taken = in_array($seat, $bookedSeats, true); ?>
|
||||
<div class="seat <?= $taken ? 'taken' : '' ?>" data-seat="<?= h($seat) ?>">
|
||||
<?= h($seat) ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between small text-muted">
|
||||
<span>Selected: <span data-seat-output>None yet</span></span>
|
||||
<span>Total: $<span data-total>0.00</span></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<div class="surface">
|
||||
<h2 class="h5">Booking details</h2>
|
||||
<?php if ($errors): ?>
|
||||
<div class="alert alert-danger">
|
||||
<?php foreach ($errors as $error): ?>
|
||||
<div><?= h($error) ?></div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Full name</label>
|
||||
<input class="form-control" name="customer_name" value="<?= h($_POST['customer_name'] ?? '') ?>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Email</label>
|
||||
<input class="form-control" name="customer_email" type="email" value="<?= h($_POST['customer_email'] ?? '') ?>" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Selected seats</label>
|
||||
<input class="form-control" name="seats" data-seat-input readonly>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<span class="text-muted small">Price per seat</span>
|
||||
<span class="fw-semibold">$<?= h(number_format((float)$show['price'], 2)) ?></span>
|
||||
</div>
|
||||
<button class="btn btn-primary w-100" type="submit">Confirm booking</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
<footer class="footer py-3">
|
||||
<div class="container">
|
||||
<span class="text-muted small">Secure checkout placeholder · Pay at cinema supported.</span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
<script src="assets/js/main.js?v=<?= time(); ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
87
confirmation.php
Normal file
87
confirmation.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?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'] ?? '';
|
||||
|
||||
$code = trim($_GET['code'] ?? '');
|
||||
$booking = null;
|
||||
if ($code !== '') {
|
||||
$stmt = db()->prepare(
|
||||
"SELECT b.*, s.show_time, s.screen, s.format_label, m.title
|
||||
FROM bookings b
|
||||
JOIN shows s ON s.id = b.show_id
|
||||
JOIN movies m ON m.id = s.movie_id
|
||||
WHERE b.booking_code = ?"
|
||||
);
|
||||
$stmt->execute([$code]);
|
||||
$booking = $stmt->fetch();
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title><?= h($projectName) ?> — Confirmation</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="/">Return home</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container my-4">
|
||||
<?php if (!$booking): ?>
|
||||
<div class="alert alert-light border">Booking not found. Please check your code.</div>
|
||||
<?php else: ?>
|
||||
<div class="surface">
|
||||
<h1 class="h4 mb-3">Booking confirmed</h1>
|
||||
<div class="row g-4">
|
||||
<div class="col-lg-7">
|
||||
<div class="mb-3 text-muted small">Showtime</div>
|
||||
<div class="fw-semibold"><?= h($booking['title']) ?></div>
|
||||
<div class="text-muted small"><?= h(date('M d, H:i', strtotime($booking['show_time']))) ?> · <?= h($booking['format_label']) ?> · <?= h($booking['screen']) ?></div>
|
||||
<hr>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<div class="text-muted small">Seats</div>
|
||||
<div class="fw-semibold"><?= h($booking['seats']) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-muted small">Total paid</div>
|
||||
<div class="fw-semibold">$<?= h(number_format((float)$booking['total_price'], 2)) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<div class="surface bg-light border">
|
||||
<div class="text-muted small mb-2">Entry code</div>
|
||||
<div class="display-6 fw-semibold"><?= h($booking['booking_code']) ?></div>
|
||||
<div class="text-muted small mt-2">Show this code at entry for scanning.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
145
includes/bootstrap.php
Normal file
145
includes/bootstrap.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../db/config.php';
|
||||
|
||||
function h(string $value): string {
|
||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
|
||||
function ensure_schema(): void {
|
||||
$pdo = db();
|
||||
$pdo->exec(
|
||||
"CREATE TABLE IF NOT EXISTS movies (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
title VARCHAR(160) NOT NULL,
|
||||
genre VARCHAR(80) NOT NULL,
|
||||
duration_min INT NOT NULL,
|
||||
rating VARCHAR(10) NOT NULL,
|
||||
description TEXT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"
|
||||
);
|
||||
|
||||
$pdo->exec(
|
||||
"CREATE TABLE IF NOT EXISTS shows (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
movie_id INT NOT NULL,
|
||||
screen VARCHAR(40) NOT NULL,
|
||||
show_time DATETIME NOT NULL,
|
||||
format_label VARCHAR(10) NOT NULL,
|
||||
price DECIMAL(8,2) NOT NULL DEFAULT 12.00,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (movie_id) REFERENCES movies(id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"
|
||||
);
|
||||
|
||||
$pdo->exec(
|
||||
"CREATE TABLE IF NOT EXISTS bookings (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
show_id INT NOT NULL,
|
||||
customer_name VARCHAR(120) NOT NULL,
|
||||
customer_email VARCHAR(160) NOT NULL,
|
||||
seats VARCHAR(120) NOT NULL,
|
||||
total_price DECIMAL(8,2) NOT NULL,
|
||||
booking_code VARCHAR(20) NOT NULL UNIQUE,
|
||||
status VARCHAR(20) NOT NULL DEFAULT 'booked',
|
||||
checked_in TINYINT(1) NOT NULL DEFAULT 0,
|
||||
checked_in_at DATETIME NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (show_id) REFERENCES shows(id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4"
|
||||
);
|
||||
}
|
||||
|
||||
function seed_data(): void {
|
||||
$pdo = db();
|
||||
$count = (int)$pdo->query("SELECT COUNT(*) FROM movies")->fetchColumn();
|
||||
if ($count > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pdo->beginTransaction();
|
||||
$stmt = $pdo->prepare("INSERT INTO movies (title, genre, duration_min, rating, description) VALUES (?, ?, ?, ?, ?)");
|
||||
$stmt->execute([
|
||||
'Midnight Signal',
|
||||
'Sci-Fi Thriller',
|
||||
124,
|
||||
'PG-13',
|
||||
'A space relay operator uncovers a message that redefines humanity’s future.'
|
||||
]);
|
||||
$stmt->execute([
|
||||
'Velvet Avenue',
|
||||
'Drama',
|
||||
108,
|
||||
'PG',
|
||||
'A fashion editor returns home to rebuild her family studio and identity.'
|
||||
]);
|
||||
|
||||
$movies = $pdo->query("SELECT id, title FROM movies")->fetchAll();
|
||||
$now = new DateTimeImmutable('now');
|
||||
$showStmt = $pdo->prepare("INSERT INTO shows (movie_id, screen, show_time, format_label, price) VALUES (?, ?, ?, ?, ?)");
|
||||
foreach ($movies as $index => $movie) {
|
||||
$base = $now->modify('+' . ($index * 2 + 1) . ' hours');
|
||||
$showStmt->execute([$movie['id'], 'Screen A', $base->format('Y-m-d H:i:s'), '2D', 11.50]);
|
||||
$showStmt->execute([$movie['id'], 'Screen B', $base->modify('+3 hours')->format('Y-m-d H:i:s'), 'IMAX', 15.00]);
|
||||
}
|
||||
$pdo->commit();
|
||||
}
|
||||
|
||||
function fetch_movies_with_shows(): array {
|
||||
$pdo = db();
|
||||
$movies = $pdo->query("SELECT * FROM movies ORDER BY created_at DESC")->fetchAll();
|
||||
$shows = $pdo->query(
|
||||
"SELECT s.*, m.title AS movie_title
|
||||
FROM shows s
|
||||
JOIN movies m ON m.id = s.movie_id
|
||||
ORDER BY s.show_time ASC"
|
||||
)->fetchAll();
|
||||
|
||||
$grouped = [];
|
||||
foreach ($shows as $show) {
|
||||
$grouped[$show['movie_id']][] = $show;
|
||||
}
|
||||
|
||||
return [$movies, $grouped];
|
||||
}
|
||||
|
||||
function fetch_show(int $showId): ?array {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare(
|
||||
"SELECT s.*, m.title, m.genre, m.duration_min, m.rating, m.description
|
||||
FROM shows s
|
||||
JOIN movies m ON m.id = s.movie_id
|
||||
WHERE s.id = ?"
|
||||
);
|
||||
$stmt->execute([$showId]);
|
||||
$row = $stmt->fetch();
|
||||
return $row ?: null;
|
||||
}
|
||||
|
||||
function fetch_booked_seats(int $showId): array {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare("SELECT seats FROM bookings WHERE show_id = ? AND status = 'booked'");
|
||||
$stmt->execute([$showId]);
|
||||
$booked = [];
|
||||
foreach ($stmt->fetchAll() as $row) {
|
||||
$parts = array_filter(array_map('trim', explode(',', $row['seats'])));
|
||||
foreach ($parts as $seat) {
|
||||
$booked[$seat] = true;
|
||||
}
|
||||
}
|
||||
return array_keys($booked);
|
||||
}
|
||||
|
||||
function generate_booking_code(PDO $pdo): string {
|
||||
do {
|
||||
$code = strtoupper(bin2hex(random_bytes(3)));
|
||||
$stmt = $pdo->prepare("SELECT COUNT(*) FROM bookings WHERE booking_code = ?");
|
||||
$stmt->execute([$code]);
|
||||
} while ((int)$stmt->fetchColumn() > 0);
|
||||
return $code;
|
||||
}
|
||||
|
||||
ensure_schema();
|
||||
seed_data();
|
||||
263
index.php
263
index.php
@ -1,150 +1,159 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
|
||||
$projectName = $_SERVER['PROJECT_NAME'] ?? 'CineReserve';
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? 'Book movie seats instantly with a streamlined customer and staff experience.';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
$now = new DateTimeImmutable('now');
|
||||
|
||||
[$movies, $showsByMovie] = fetch_movies_with_shows();
|
||||
$showCount = 0;
|
||||
foreach ($showsByMovie as $shows) {
|
||||
$showCount += count($shows);
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<title><?= h($projectName) ?> — Movie Booking</title>
|
||||
<meta name="description" content="<?= h($projectDescription) ?>" />
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<meta property="og:description" content="<?= h($projectDescription) ?>" />
|
||||
<meta property="twitter:description" content="<?= h($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($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="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loader {
|
||||
margin: 1.25rem auto 1.25rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time(); ?>">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
<div class="app-shell">
|
||||
<nav class="navbar navbar-expand-lg navbar-light">
|
||||
<div class="container">
|
||||
<a class="navbar-brand fw-semibold" href="/"> <?= h($projectName) ?></a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="mainNav">
|
||||
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item"><a class="nav-link" href="#movies">Movies</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="agent.php">Agent POS</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="staff_checkin.php">Staff Check-in</a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="admin_bookings.php">Admin</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container my-4">
|
||||
<div class="hero mb-4">
|
||||
<div class="row g-4 align-items-center">
|
||||
<div class="col-lg-7">
|
||||
<span class="badge-soft">Live seat selection • Real-time confirmations</span>
|
||||
<h1 class="mt-3">A clean, dependable movie booking workflow.</h1>
|
||||
<p class="text-muted mb-4">Browse showtimes, choose seats, and deliver instant e-tickets. Agents and staff get dedicated tools for walk-ins and check-ins.</p>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<a href="#movies" class="btn btn-primary">Book a seat</a>
|
||||
<a href="admin_bookings.php" class="btn btn-outline-dark">View bookings</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-5">
|
||||
<div class="stat-card">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<div class="text-muted small">Today’s shows</div>
|
||||
<div class="fs-4 fw-semibold"><?= h((string)$showCount) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-muted small">Movies live</div>
|
||||
<div class="fs-4 fw-semibold"><?= h((string)count($movies)) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="text-muted small">Updated <?= h($now->format('M d, Y H:i')) ?> UTC</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section id="movies" class="mb-5">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h2 class="h4 mb-0">Now showing</h2>
|
||||
<span class="text-muted small">Select a showtime to continue</span>
|
||||
</div>
|
||||
<?php if (!$movies): ?>
|
||||
<div class="alert alert-light border">No movies yet. Add shows from the admin panel.</div>
|
||||
<?php endif; ?>
|
||||
<div class="row g-4">
|
||||
<?php foreach ($movies as $movie): ?>
|
||||
<div class="col-lg-6">
|
||||
<div class="movie-card">
|
||||
<div class="d-flex justify-content-between align-items-start mb-2">
|
||||
<div>
|
||||
<h3 class="h5 mb-1"><?= h($movie['title']) ?></h3>
|
||||
<div class="text-muted small"><?= h($movie['genre']) ?> · <?= h((string)$movie['duration_min']) ?> min · Rated <?= h($movie['rating']) ?></div>
|
||||
</div>
|
||||
<span class="badge-soft">Now</span>
|
||||
</div>
|
||||
<p class="text-muted small mb-3"><?= h($movie['description']) ?></p>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<?php foreach (($showsByMovie[$movie['id']] ?? []) as $show): ?>
|
||||
<a class="btn btn-outline-dark btn-sm" href="booking.php?show_id=<?= h((string)$show['id']) ?>">
|
||||
<?= h(date('M d, H:i', strtotime($show['show_time']))) ?> · <?= h($show['format_label']) ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php if (empty($showsByMovie[$movie['id']])): ?>
|
||||
<span class="text-muted small">No showtimes loaded.</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="row g-4 mb-5">
|
||||
<div class="col-lg-4">
|
||||
<div class="surface h-100">
|
||||
<h3 class="h6">Agent POS</h3>
|
||||
<p class="text-muted small">Create walk-in bookings and print confirmation slips.</p>
|
||||
<a href="agent.php" class="btn btn-outline-dark btn-sm">Open agent view</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="surface h-100">
|
||||
<h3 class="h6">Staff check-in</h3>
|
||||
<p class="text-muted small">Scan or enter codes to admit guests and track attendance.</p>
|
||||
<a href="staff_checkin.php" class="btn btn-outline-dark btn-sm">Open check-in</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<div class="surface h-100">
|
||||
<h3 class="h6">Admin overview</h3>
|
||||
<p class="text-muted small">Review all bookings and manage upcoming showtimes.</p>
|
||||
<a href="admin_bookings.php" class="btn btn-outline-dark btn-sm">Open admin</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
|
||||
<footer class="footer py-3">
|
||||
<div class="container d-flex justify-content-between align-items-center">
|
||||
<span class="text-muted small">© <?= h((string)$now->format('Y')) ?> <?= h($projectName) ?></span>
|
||||
<span class="text-muted small">Powered by PHP <?= h(PHP_VERSION) ?></span>
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
115
staff_checkin.php
Normal file
115
staff_checkin.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?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'] ?? '';
|
||||
|
||||
$message = '';
|
||||
$booking = null;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$code = trim($_POST['booking_code'] ?? '');
|
||||
if ($code === '') {
|
||||
$message = 'Enter a booking code to check in.';
|
||||
} else {
|
||||
$pdo = db();
|
||||
$stmt = $pdo->prepare(
|
||||
"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
|
||||
WHERE b.booking_code = ?"
|
||||
);
|
||||
$stmt->execute([$code]);
|
||||
$booking = $stmt->fetch();
|
||||
|
||||
if (!$booking) {
|
||||
$message = 'No booking found for that code.';
|
||||
} elseif ($booking['checked_in']) {
|
||||
$message = 'Guest already checked in.';
|
||||
} else {
|
||||
$update = $pdo->prepare("UPDATE bookings SET checked_in = 1, checked_in_at = NOW() WHERE id = ?");
|
||||
$update->execute([$booking['id']]);
|
||||
$message = 'Check-in successful for ' . $booking['customer_name'] . '.';
|
||||
$booking['checked_in'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title><?= h($projectName) ?> — Staff check-in</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="row g-4">
|
||||
<div class="col-lg-5">
|
||||
<div class="surface">
|
||||
<h1 class="h5 mb-3">Staff check-in</h1>
|
||||
<form method="post">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">Booking code</label>
|
||||
<input class="form-control" name="booking_code" placeholder="Enter or scan code">
|
||||
</div>
|
||||
<button class="btn btn-primary w-100" type="submit">Confirm check-in</button>
|
||||
</form>
|
||||
<?php if ($message): ?>
|
||||
<div class="alert alert-light border mt-3 mb-0"><?= h($message) ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-7">
|
||||
<div class="surface">
|
||||
<h2 class="h6">Latest scan result</h2>
|
||||
<?php if (!$booking): ?>
|
||||
<p class="text-muted small mb-0">Scan a ticket to see details here.</p>
|
||||
<?php else: ?>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<div class="text-muted small">Guest</div>
|
||||
<div class="fw-semibold"><?= h($booking['customer_name']) ?></div>
|
||||
<div class="text-muted small"><?= h($booking['customer_email']) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-muted small">Movie</div>
|
||||
<div class="fw-semibold"><?= h($booking['title']) ?></div>
|
||||
<div class="text-muted small"><?= h(date('M d, H:i', strtotime($booking['show_time']))) ?></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-muted small">Seats</div>
|
||||
<div class="fw-semibold"><?= h($booking['seats']) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user