mirror of
https://github.com/Alvin-Zilverstand/Spik-en-span.git
synced 2026-03-06 13:26:49 +01:00
add ticket purchase form, employee login, and database schema
This commit is contained in:
35
database.sql
Normal file
35
database.sql
Normal file
@@ -0,0 +1,35 @@
|
||||
-- Create the database
|
||||
CREATE DATABASE IF NOT EXISTS spik_en_span;
|
||||
USE spik_en_span;
|
||||
|
||||
-- Table for storing ticket information
|
||||
CREATE TABLE tickets (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
ticket_id VARCHAR(255) NOT NULL UNIQUE,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL,
|
||||
category ENUM('adult', 'child', 'group') NOT NULL,
|
||||
quantity INT NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Table for storing employee login credentials
|
||||
CREATE TABLE employees (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
username VARCHAR(255) NOT NULL UNIQUE,
|
||||
password_hash VARCHAR(255) NOT NULL, -- Store hashed passwords
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Table for storing scanned ticket logs
|
||||
CREATE TABLE scanned_tickets (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
ticket_id VARCHAR(255) NOT NULL,
|
||||
scanned_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
is_valid BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
UNIQUE (ticket_id)
|
||||
);
|
||||
|
||||
-- Insert a default employee account (username: admin, password: password)
|
||||
INSERT INTO employees (username, password_hash)
|
||||
VALUES ('admin', SHA2('password', 256)); -- Replace with a secure password hashing method
|
||||
44
employee-login.html
Normal file
44
employee-login.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Medewerker Login</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<h1 class="text-center">Medewerker Login</h1>
|
||||
<form id="loginForm" class="mt-4">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Gebruikersnaam</label>
|
||||
<input type="text" id="username" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Wachtwoord</label>
|
||||
<input type="password" id="password" class="form-control" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Inloggen</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
document.getElementById('loginForm').addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const username = document.getElementById('username').value;
|
||||
const password = document.getElementById('password').value;
|
||||
|
||||
// Placeholder for authentication logic
|
||||
if (username === 'admin' && password === 'password') {
|
||||
alert('Succesvol ingelogd!');
|
||||
window.location.href = 'qr-scanner.html'; // Redirect to QR scanner page
|
||||
} else {
|
||||
alert('Ongeldige inloggegevens.');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
28
index.html
28
index.html
@@ -10,7 +10,33 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container mt-5">
|
||||
<h1 class="text-center">Koop je tickets voor Spik en Span!</h1>
|
||||
<form id="ticketForm" class="mt-4">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Naam</label>
|
||||
<input type="text" id="name" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">E-mailadres</label>
|
||||
<input type="email" id="email" class="form-control" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ticketCategory" class="form-label">Categorie</label>
|
||||
<select id="ticketCategory" class="form-select" required>
|
||||
<option value="adult">Volwassenen</option>
|
||||
<option value="child">Kinderen</option>
|
||||
<option value="group">Groepen</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ticketQuantity" class="form-label">Aantal tickets</label>
|
||||
<input type="number" id="ticketQuantity" class="form-control" min="1" max="10" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Koop Tickets</button>
|
||||
</form>
|
||||
<div id="qrCodeContainer" class="mt-5 text-center"></div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
||||
25
script.js
25
script.js
@@ -0,0 +1,25 @@
|
||||
document.getElementById('ticketForm').addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const name = document.getElementById('name').value;
|
||||
const email = document.getElementById('email').value;
|
||||
const category = document.getElementById('ticketCategory').value;
|
||||
const quantity = document.getElementById('ticketQuantity').value;
|
||||
|
||||
// Generate a unique ticket ID (for simplicity, using timestamp)
|
||||
const ticketId = `TICKET-${Date.now()}`;
|
||||
|
||||
// Generate QR code content
|
||||
const qrContent = `Name: ${name}, Email: ${email}, Category: ${category}, Quantity: ${quantity}, Ticket ID: ${ticketId}`;
|
||||
|
||||
// Display QR code (using a library like QRCode.js)
|
||||
const qrCodeContainer = document.getElementById('qrCodeContainer');
|
||||
qrCodeContainer.innerHTML = ''; // Clear previous QR code
|
||||
const qrCode = new QRCode(qrCodeContainer, {
|
||||
text: qrContent,
|
||||
width: 200,
|
||||
height: 200,
|
||||
});
|
||||
|
||||
alert('Ticket(s) successfully generated!');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user