Initial commit
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
.env
|
||||
node_modules
|
||||
data
|
63
assets/index.html
Normal file
63
assets/index.html
Normal file
@ -0,0 +1,63 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Absolvententreffen 2025</title>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<img src="logo.png" alt="HTL Ungargasse Logo" class="logo" />
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<h1>Absolvententreffen</h1>
|
||||
<h2>2025</h2>
|
||||
<div class="buttons">
|
||||
<button class="btn green" onclick="toggleOverlay('zusage')">
|
||||
Zusage
|
||||
</button>
|
||||
<button class="btn red" onclick="toggleOverlay('absage')">
|
||||
Absage
|
||||
</button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<!-- Zusage Overlay -->
|
||||
<div class="overlay" id="zusage">
|
||||
<div class="form-box">
|
||||
<h3>Zugesagt</h3>
|
||||
<p>Um es zu Finalisieren füllen Sie bitte die Felder aus</p>
|
||||
<form method="post" action="/post">
|
||||
<input name="firstname" type="text" placeholder="Vorname" required />
|
||||
<input name="lastname" type="text" placeholder="Nachname" required />
|
||||
<input name="email" type="email" placeholder="Email" required />
|
||||
<input name="department" type="text" placeholder="Abteilung" />
|
||||
<input name="year" type="text" placeholder="Jahrgang" />
|
||||
<button type="submit">Absenden</button>
|
||||
</form>
|
||||
<img src="logo.png" alt="HTL Logo" class="form-logo" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Absage Overlay -->
|
||||
<div class="overlay" id="absage">
|
||||
<div class="form-box">
|
||||
<h3>Abgesagt</h3>
|
||||
<p>Um es zu Finalisieren füllen Sie bitte die Felder aus</p>
|
||||
<form>
|
||||
<input type="text" placeholder="Vorname" required />
|
||||
<input type="text" placeholder="Nachname" required />
|
||||
<input type="email" placeholder="Email" required />
|
||||
<input type="text" placeholder="Abteilung" />
|
||||
<input type="text" placeholder="Jahrgang" />
|
||||
<button type="submit">Absenden</button>
|
||||
</form>
|
||||
<img src="logo.png" alt="HTL Logo" class="form-logo" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
BIN
assets/logo.png
Normal file
BIN
assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
17
assets/script.js
Normal file
17
assets/script.js
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
function toggleOverlay(id) {
|
||||
document.getElementById(id).style.display = 'flex';
|
||||
['zusage', 'absage'].forEach(otherId => {
|
||||
if (otherId !== id) {
|
||||
document.getElementById(otherId).style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelectorAll('.overlay').forEach(overlay => {
|
||||
overlay.addEventListener('click', function (e) {
|
||||
if (e.target === overlay) {
|
||||
overlay.style.display = 'none';
|
||||
}
|
||||
});
|
||||
});
|
114
assets/styles.css
Normal file
114
assets/styles.css
Normal file
@ -0,0 +1,114 @@
|
||||
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
header {
|
||||
background: #ccc;
|
||||
padding: 10px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 50px 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
color: #666;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 10px 25px;
|
||||
font-size: 16px;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn.green {
|
||||
background-color: #28a745;
|
||||
}
|
||||
|
||||
.btn.red {
|
||||
background-color: #dc3545;
|
||||
}
|
||||
|
||||
.overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
display: none;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.form-box {
|
||||
background: white;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
width: 90%;
|
||||
max-width: 400px;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.form-box h3 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.form-box p {
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.form-box form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.form-box input {
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-box button {
|
||||
background: black;
|
||||
color: white;
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
margin-top: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-logo {
|
||||
display: block;
|
||||
margin: 20px auto 0;
|
||||
height: 40px;
|
||||
}
|
49
index.js
Normal file
49
index.js
Normal file
@ -0,0 +1,49 @@
|
||||
const dotenv = require("dotenv");
|
||||
dotenv.config()
|
||||
const express = require("express");
|
||||
const bodyParser = require('body-parser');
|
||||
const nodemailer = require("nodemailer");
|
||||
const fs = require("fs");
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: "smtp-relay.brevo.com",
|
||||
port: 587,
|
||||
authMethod: "PLAIN",
|
||||
auth: {
|
||||
user: process.env.smtp_user,
|
||||
pass: process.env.smtp_pass,
|
||||
}
|
||||
});
|
||||
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
|
||||
app.use(express.static("assets"))
|
||||
app.use(bodyParser.urlencoded());
|
||||
|
||||
app.post("/post", (req, res) => {
|
||||
fs.writeFile(`./data/${req.body.firstname}-${req.body.lastname}.json`, JSON.stringify(req.body), (err) => {
|
||||
return res.send(err)
|
||||
})
|
||||
|
||||
transporter.sendMail({
|
||||
from: "Alumnihub <alumnihub@kocoder.xyz>",
|
||||
to: `${req.body.firstname} ${req.body.lastname} <${req.body.email}>`,
|
||||
envelope: {
|
||||
from: "alumnihub@kocoder.xyz",
|
||||
to: req.body.email,
|
||||
},
|
||||
subject: "Anmeldungs für's Absolvententreffen.",
|
||||
text: `Hallo ${req.body.firstname}!
|
||||
Du hast dich erfolgreich für das Absolvententreffen am X.Y.Z angemeldet! Hier findest du alle Details https://x.y!
|
||||
Bei Rückfragen bitte an: absolvententreffen@outlook.com wenden.
|
||||
`,
|
||||
}, (err, info) => {
|
||||
if (err) return res.send(err);
|
||||
});
|
||||
return res.send("Du wurdest erfolgreich angemeldet!");
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening on port ${port}`);
|
||||
});
|
1199
package-lock.json
generated
Normal file
1199
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
20
package.json
Normal file
20
package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "absolventenverein-fallback",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
"type": "commonjs",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "nodemon index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"dotenv": "^17.2.1",
|
||||
"express": "^5.1.0",
|
||||
"nodemailer": "^7.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^3.1.10"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user