Merge pull request 'develop' (#36) from develop into main
Reviewed-on: #36
This commit is contained in:
commit
1eee428e71
2
.idea/Webshop.iml
generated
2
.idea/Webshop.iml
generated
@ -5,7 +5,7 @@
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="font-awesome" level="application" />
|
||||
<orderEntry type="library" name="boxicons" level="application" />
|
||||
<orderEntry type="library" name="boxicons" level="application" />
|
||||
</component>
|
||||
</module>
|
||||
8
.idea/dataSources.xml
generated
8
.idea/dataSources.xml
generated
@ -2,14 +2,12 @@
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="fd7d9aa1-1427-4fa7-afe9-9730b93129bb">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<driver-ref>mariadb</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://localhost:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
|
||||
2
.idea/jsLibraryMappings.xml
generated
2
.idea/jsLibraryMappings.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptLibraryMappings">
|
||||
<file url="file://$PROJECT_DIR$" libraries="{HTML, HTTP Pre-Request and Response Handler}" />
|
||||
<file url="file://$PROJECT_DIR$" libraries="{HTML, HTTP Pre-Request and Response Handler, boxicons}" />
|
||||
</component>
|
||||
</project>
|
||||
37
package-lock.json
generated
37
package-lock.json
generated
@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "sniper",
|
||||
"name": "webshop",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "sniper",
|
||||
"name": "webshop",
|
||||
"version": "1.0.0",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
@ -15,7 +15,9 @@
|
||||
"express-session": "^1.18.1",
|
||||
"mysql": "^2.18.1",
|
||||
"mysql2": "^3.12.0",
|
||||
"path": "^0.12.7"
|
||||
"node": "^22.15.0",
|
||||
"path": "^0.12.7",
|
||||
"server.js": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/accepts": {
|
||||
@ -597,6 +599,7 @@
|
||||
"version": "2.18.1",
|
||||
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
|
||||
"integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bignumber.js": "9.0.0",
|
||||
"readable-stream": "2.3.7",
|
||||
@ -673,6 +676,28 @@
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/node": {
|
||||
"version": "22.15.0",
|
||||
"resolved": "https://registry.npmjs.org/node/-/node-22.15.0.tgz",
|
||||
"integrity": "sha512-qrOEL83lNt+Jbh9pekl5xQrZK+QRJz51m2IGGCu2NENgbG6Go0D1QUBvjbejP8jB2eokQpX1AorDLbKQ/FxuYA==",
|
||||
"hasInstallScript": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"node-bin-setup": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"node": "bin/node"
|
||||
},
|
||||
"engines": {
|
||||
"npm": ">=5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-bin-setup": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/node-bin-setup/-/node-bin-setup-1.1.3.tgz",
|
||||
"integrity": "sha512-opgw9iSCAzT2+6wJOETCpeRYAQxSopqQ2z+N6BXwIMsQQ7Zj5M8MaafQY8JMlolRR6R1UXg2WmhKp0p9lSOivg==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.2",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
|
||||
@ -893,6 +918,12 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/server.js": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/server.js/-/server.js-1.0.0.tgz",
|
||||
"integrity": "sha512-fO4IvzkZ09bBB++XU/gWGuzxJs0OpghSd/34mlW8coMoakLzj/+W5d1pHX+I+7H52GkBKu96UQU0K5vptNjaqg==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/set-function-length": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
||||
|
||||
10
package.json
10
package.json
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "sniper",
|
||||
"name": "webshop",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "node server.js"
|
||||
"start": "npm install && node server.js"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
@ -12,13 +12,13 @@
|
||||
"description": "Webshop Autohändler",
|
||||
"dependencies": {
|
||||
"app-root-path": "^3.1.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.21.1",
|
||||
"dotenv": "^16.4.7",
|
||||
"express": "^4.21.2",
|
||||
"express-session": "^1.18.1",
|
||||
"mysql": "^2.18.1",
|
||||
"mysql2": "^3.12.0",
|
||||
"path": "^0.12.7"
|
||||
"node": "^22.15.0",
|
||||
"path": "^0.12.7",
|
||||
"server.js": "^1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
27
public/404.html
Normal file
27
public/404.html
Normal file
@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Seite nicht gefunden</title>
|
||||
<link rel="stylesheet" href="/Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<main class="content" style="text-align: center; padding: 80px;">
|
||||
<h1>🚧 Seite nicht gefunden 🚧</h1>
|
||||
<p>Diese Seite existiert nicht oder befindet sich noch in Arbeit.</p>
|
||||
<a href="/" class="btn" style="width: auto; display: inline-block; margin-top: 20px;">Zur Startseite</a>
|
||||
</main>
|
||||
|
||||
<!-- Fußzeiele -->
|
||||
<div id="footer"></div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -4,8 +4,12 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>Warenkorb</title>
|
||||
<link rel="stylesheet" href="/Styles/Warenkorb/warenkorb.css">
|
||||
<link rel="stylesheet" href="./Styles/styles-main.css">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Header wird hier dynamisch geladen -->
|
||||
<div id="header-placeholder"></div>
|
||||
<div class="warenkorb">
|
||||
<h2>🛒 Dein Warenkorb</h2>
|
||||
|
||||
@ -26,8 +30,9 @@
|
||||
|
||||
<div class="summary">
|
||||
</div>
|
||||
|
||||
<button class="checkout">Zur Kasse gehen</button>
|
||||
<button class="zurKasse">Zur Kasse gehen</button>
|
||||
</div>
|
||||
<!-- Footer wird dynamisch geladen -->
|
||||
<div id="footer"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
259
public/bestellformular/bestellformular.html
Normal file
259
public/bestellformular/bestellformular.html
Normal file
@ -0,0 +1,259 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Bestellformular</title>
|
||||
<link rel="stylesheet" href="/Styles/bestellformular/bestellformular.css">
|
||||
<link rel="stylesheet" href="./Styles/styles-main.css">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<!-- Header wird hier dynamisch geladen -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<main>
|
||||
<div class="form-container">
|
||||
<form method="post" id="bestellform">
|
||||
<h2>Bestellformular</h2>
|
||||
|
||||
<label for="vorname">Vorname:</label>
|
||||
<input type="text" id="Vorname" name="Vorname" required placeholder="Vorname">
|
||||
|
||||
<label for="nachname">Nachname:</label>
|
||||
<input type="text" id="Nachname" name="Nachname" required placeholder="Nachname">
|
||||
|
||||
<label for="kundenNr">Kunden Nr.:</label>
|
||||
<input type="text" id="KundenNr" name="KundenNr" required placeholder="Kunden Nr.">
|
||||
|
||||
<label for="strasse">Straße:</label>
|
||||
<input type="text" id="strasse" name="strasse" required placeholder="Strasse">
|
||||
|
||||
<label for="hausnummer">Hausnummer:</label>
|
||||
<input type="text" id="hausnummer" name="hausnummer" required placeholder="Hausnummer">
|
||||
|
||||
<label for="ort">Ort:</label>
|
||||
<input type="text" id="ort" name="ort" required placeholder="Ort">
|
||||
|
||||
<label for="ArtikelNr">Artikel Nr.:</label>
|
||||
<div class="Artikel">
|
||||
<button type="button" class="loeschen-button" onclick="loescheArtikel(this)">x</button>
|
||||
<input type="text" class="ArtikelNrText" id="ArtikelNr" name="ArtikelNr" required placeholder="Artikel Nr.">
|
||||
<input type="text" class="StueckzahlText" id="Stueckzahl" name="Stueckzahl" required placeholder="Anzahl">
|
||||
<div class="verfuegbarkeit"></div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.Artikel{
|
||||
display: flex;
|
||||
align-content: center;
|
||||
}
|
||||
|
||||
.ArtikelNrText{
|
||||
max-width: 50%;
|
||||
}
|
||||
|
||||
.StueckzahlText{
|
||||
max-width: 15%;
|
||||
margin-left: 2.5%;
|
||||
}
|
||||
|
||||
.loeschen-button{
|
||||
background-color: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
width: 5%;
|
||||
height: 30px;
|
||||
cursor: pointer;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.verfuegbarkeit{
|
||||
display: flex;
|
||||
align-content: center;
|
||||
max-width: 20%;
|
||||
padding-left: 2.5%;
|
||||
}
|
||||
</style>
|
||||
<a class="button-submit" id="sendOrder">Bestellung absenden</a>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const formular = document.getElementById('bestellform');
|
||||
const sendButton = document.getElementById('sendOrder');
|
||||
let artikelVerfuegbarkeiten = [];
|
||||
|
||||
// Bestellung absenden
|
||||
sendButton.addEventListener('click', async function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
const form = document.getElementById('bestellform');
|
||||
|
||||
// Kundendaten einsammeln
|
||||
const userData = {
|
||||
vorname: form.Vorname.value.trim(),
|
||||
nachname: form.Nachname.value.trim(),
|
||||
kundenNr: form.KundenNr.value.trim(),
|
||||
strasse: form.strasse.value.trim(),
|
||||
hausnummer: form.hausnummer.value.trim(),
|
||||
ort: form.ort.value.trim()
|
||||
};
|
||||
|
||||
// Artikel einsammeln
|
||||
const artikelInputs = document.querySelectorAll('.Artikel');
|
||||
const produkte = [];
|
||||
|
||||
artikelInputs.forEach(artikel => {
|
||||
const artikelNrInput = artikel.querySelector('.ArtikelNrText');
|
||||
const stueckzahlInput = artikel.querySelector('.StueckzahlText');
|
||||
|
||||
if (artikelNrInput && artikelNrInput.value.trim() !== '') {
|
||||
produkte.push({
|
||||
product_id: parseInt(artikelNrInput.value.trim(), 10),
|
||||
quantity: parseInt(stueckzahlInput.value.trim(), 10) || 1
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (produkte.length === 0) {
|
||||
alert('Bitte mindestens ein Produkt angeben!');
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
user_id: parseInt(userData.kundenNr, 10),
|
||||
produkte: produkte
|
||||
};
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/bestellung', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(payload)
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (response.ok) {
|
||||
// Bestellung erfolgreich -> Weiterleitung
|
||||
window.location.href = "/bestellung";
|
||||
} else {
|
||||
alert('Fehler: ' + result.message);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Abschicken der Bestellung:', error);
|
||||
alert('Serverfehler beim Abschicken der Bestellung.');
|
||||
}
|
||||
});
|
||||
|
||||
// Artikelnummer prüfen bei Eingabe
|
||||
formular.addEventListener('input', async function (event) {
|
||||
if (event.target.classList.contains('ArtikelNrText')) {
|
||||
if (event.target.value.trim() !== '') {
|
||||
await pruefeVerfuegbarkeit(event.target);
|
||||
fuegeNeuesArtikelFeldHinzu();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Funktion: Verfügbarkeit prüfen
|
||||
async function pruefeVerfuegbarkeit(inputFeld) {
|
||||
const artikelnummer = inputFeld.value.trim();
|
||||
const verfuegbarkeitDiv = inputFeld.parentElement.querySelector('.verfuegbarkeit');
|
||||
const sendButton = document.getElementById('sendOrder');
|
||||
|
||||
if (artikelnummer.length === 0) {
|
||||
verfuegbarkeitDiv.textContent = "";
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(`/api/pruefe-artikel?nummer=${encodeURIComponent(artikelnummer)}`);
|
||||
const data = await response.json();
|
||||
|
||||
const artikelDivs = document.querySelectorAll('.Artikel');
|
||||
artikelVerfuegbarkeiten = [];
|
||||
|
||||
artikelDivs.forEach(div => {
|
||||
const artikelNrInput = div.querySelector('.ArtikelNrText');
|
||||
const verfDiv = div.querySelector('.verfuegbarkeit');
|
||||
|
||||
if (artikelNrInput.value.trim() !== '') {
|
||||
if (artikelNrInput === inputFeld) {
|
||||
if (data.verfuegbar) {
|
||||
verfDiv.textContent = "Artikel verfügbar.";
|
||||
verfDiv.style.color = "green";
|
||||
artikelVerfuegbarkeiten.push(true);
|
||||
} else {
|
||||
verfDiv.textContent = "Artikel nicht verfügbar!";
|
||||
verfDiv.style.color = "red";
|
||||
artikelVerfuegbarkeiten.push(false);
|
||||
}
|
||||
} else {
|
||||
// Für andere Felder bisherige Anzeige berücksichtigen
|
||||
if (verfDiv.textContent.includes("nicht verfügbar")) {
|
||||
artikelVerfuegbarkeiten.push(false);
|
||||
} else {
|
||||
artikelVerfuegbarkeiten.push(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Button sperren/freigeben
|
||||
if (artikelVerfuegbarkeiten.every(status => status === true)) {
|
||||
sendButton.disabled = false;
|
||||
} else {
|
||||
sendButton.disabled = true;
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler bei der Artikelsuche:', error);
|
||||
verfuegbarkeitDiv.textContent = "Fehler bei der Prüfung.";
|
||||
verfuegbarkeitDiv.style.color = "orange";
|
||||
sendButton.disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Funktion: Neues Artikelfeld hinzufügen
|
||||
function fuegeNeuesArtikelFeldHinzu() {
|
||||
const formular = document.getElementById('bestellform');
|
||||
const artikelnummerFelder = formular.querySelectorAll('.ArtikelNrText');
|
||||
const letztesFeld = artikelnummerFelder[artikelnummerFelder.length - 1];
|
||||
|
||||
if (letztesFeld && letztesFeld.value.trim() !== '') {
|
||||
const neueArtikelDiv = document.createElement('div');
|
||||
neueArtikelDiv.className = 'Artikel';
|
||||
neueArtikelDiv.innerHTML = `
|
||||
<button type="button" class="loeschen-button" onclick="loescheArtikel(this)">x</button>
|
||||
<input type="text" class="ArtikelNrText" name="ArtikelNr" required placeholder="Artikel Nr.">
|
||||
<input type="text" class="StueckzahlText" name="Stueckzahl" required placeholder="Anzahl">
|
||||
<div class="verfuegbarkeit"></div>
|
||||
`;
|
||||
|
||||
const sendButton = document.getElementById('sendOrder');
|
||||
formular.insertBefore(neueArtikelDiv, sendButton);
|
||||
}
|
||||
}
|
||||
|
||||
// Funktion: Artikel löschen
|
||||
function loescheArtikel(button) {
|
||||
const artikelDiv = button.parentElement;
|
||||
artikelDiv.remove();
|
||||
}
|
||||
|
||||
</script>
|
||||
<!-- Footer wird dynamisch geladen -->
|
||||
<div id="footer"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
104
public/bestellung/bestellung.html
Normal file
104
public/bestellung/bestellung.html
Normal file
@ -0,0 +1,104 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Ihre Bestellung</title>
|
||||
<link rel="stylesheet" href="/Styles/bestellung/bestellung.css">
|
||||
<link rel="stylesheet" href="/Styles/styles-main.css">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Header wird hier dynamisch geladen -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<main>
|
||||
<h2>Ihre Bestellung:</h2>
|
||||
<div id="bestellung">
|
||||
<!-- Platzhalter für die Bestellinformationen -->
|
||||
<div class="bestell-info-card">
|
||||
<p><strong>Kundennummer:</strong> <span id="kundenNr"></span></p>
|
||||
<p><strong>Produkt-ID:</strong> <span id="produktId"></span></p>
|
||||
<p><strong>Produktname:</strong> <span id="produktName"></span></p>
|
||||
<p><strong>Preis:</strong> <span id="preis"></span></p>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
async function ladeBestellung() {
|
||||
const user_id = sessionStorage.getItem('user_id');
|
||||
if (!user_id) {
|
||||
alert('Sie sind nicht eingeloggt! Bitte loggen Sie sich ein.');
|
||||
window.location.href = '/login';
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/bestellung/daten', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ user_id: user_id })
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
const daten = await response.json();
|
||||
const bestellungContainer = document.getElementById('bestellung');
|
||||
bestellungContainer.innerHTML = '';
|
||||
|
||||
const bestellungen = {};
|
||||
|
||||
daten.forEach(item => {
|
||||
if (!bestellungen[item.order_id]) {
|
||||
bestellungen[item.order_id] = {
|
||||
total: item.order_total,
|
||||
produkte: []
|
||||
};
|
||||
}
|
||||
bestellungen[item.order_id].produkte.push({
|
||||
name: item.product_name,
|
||||
preis: item.product_price,
|
||||
quantity: item.quantity
|
||||
});
|
||||
});
|
||||
|
||||
for (const orderId in bestellungen) {
|
||||
const bestellung = bestellungen[orderId];
|
||||
const bestellCard = document.createElement('div');
|
||||
bestellCard.className = 'bestell-info-card';
|
||||
|
||||
let produkteHTML = '';
|
||||
bestellung.produkte.forEach(produkt => {
|
||||
produkteHTML += `
|
||||
<p>• ${produkt.name} — ${produkt.quantity} Stück — Preis: ${produkt.preis.toFixed(2)} €</p>
|
||||
`;
|
||||
});
|
||||
|
||||
bestellCard.innerHTML = `
|
||||
<h3>Bestellnummer: ${orderId}</h3>
|
||||
${produkteHTML}
|
||||
<p><strong>Gesamtsumme:</strong> ${bestellung.total.toFixed(2)} €</p>
|
||||
`;
|
||||
|
||||
bestellungContainer.appendChild(bestellCard);
|
||||
}
|
||||
|
||||
} else if (response.status === 404) {
|
||||
document.getElementById('bestellung').innerHTML = '<p>Keine Bestellungen gefunden.</p>';
|
||||
} else {
|
||||
console.error('Fehler beim Laden der Bestellungen.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fehler: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener('DOMContentLoaded', ladeBestellung);
|
||||
</script>
|
||||
|
||||
<!-- Footer wird dynamisch geladen -->
|
||||
<div id="footer"></div>
|
||||
</body>
|
||||
</html>
|
||||
8
public/header_footer/footer.html
Normal file
8
public/header_footer/footer.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!-- Fußzeiele -->
|
||||
<footer class="footer">
|
||||
<p>© 2025 Autohändler Webshop – Alle Rechte vorbehalten</p>
|
||||
<p>
|
||||
<a href="/impressum">Impressum</a> |
|
||||
<a href="/datenschutz">Datenschutz</a>
|
||||
</p>
|
||||
</footer>
|
||||
34
public/header_footer/header.html
Normal file
34
public/header_footer/header.html
Normal file
@ -0,0 +1,34 @@
|
||||
<!-- header.html -->
|
||||
<header>
|
||||
<div class="logo-container">
|
||||
<img src="/images/Logo.png" alt="Modellauto-Shop Logo" class="logo-img">
|
||||
<h1>Modellauto - Shop</h1>
|
||||
</div>
|
||||
<div class="header-right">
|
||||
<a href="/login" class="login-btn">Login</a>
|
||||
<div class="header-right">
|
||||
|
||||
<a href="/warenkorb" class="cart">
|
||||
<i class='bx bx-cart'></i>
|
||||
<span class="cart-count">0</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<nav class="menu">
|
||||
<ul class="menu-list">
|
||||
<li class="menu-item"><a href="/">Startseite</a></li>
|
||||
<li class="menu-item">
|
||||
<a href="/shop">Shop</a>
|
||||
<ul class="submenu">
|
||||
<li><a href="/shop/motorrad">Motorräder</a></li>
|
||||
<li><a href="/shop/oldtimer">Oldtimer</a></li>
|
||||
<li><a href="/shop/sportwagen">Sportwagen</a></li>
|
||||
<li><a href="/shop/lkw">LKWs</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="menu-item"><a href="/ueberuns">Über uns</a></li>
|
||||
<li class="menu-item"><a href="/kontakt">Kontakt</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
@ -4,30 +4,67 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./Styles/login/login.css">
|
||||
<link rel="stylesheet" href="./Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<form action="login.php" method="POST">
|
||||
<h1>Login</h1>
|
||||
<div class="input-box">
|
||||
<input type="text" name="username" placeholder="Username" required>
|
||||
<i class='bx bxs-user'></i>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<input type="password" id="password" name="password" placeholder="Passwort" required>
|
||||
<i class='bx bxs-lock-alt' id="togglePassword" onclick="togglePassword()"></i>
|
||||
</div>
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<button type="submit" class="btn">Login</button>
|
||||
|
||||
<div class="register-link">
|
||||
<br>
|
||||
<p>Noch keinen Account? <a href="/registrieren">Registrieren</a></p>
|
||||
<main class="main-content">
|
||||
<div class="login-container">
|
||||
<h2 class="login-title">Login</h2>
|
||||
<form class="login-form">
|
||||
<div class="input-group">
|
||||
<input id="email" type="text" placeholder="E-Mail" required/>
|
||||
<i class="icon fas fa-user"></i>
|
||||
</div>
|
||||
<div class="input-group">
|
||||
<input id="password" type="password" placeholder="Passwort" required/>
|
||||
<i class="icon fas fa-lock"></i>
|
||||
</div>
|
||||
<button id="submit" type="submit" class="login-btn">Login</button>
|
||||
<p class="register-text">
|
||||
Noch keinen Account? <a href="/registrieren">Registrieren</a>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<script src="./script.js"></script>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
document.getElementById('submit').addEventListener('click', async (event) => {
|
||||
event.preventDefault()
|
||||
|
||||
const email = document.getElementById('email').value
|
||||
const password = document.getElementById('password').value
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/user/login', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({email, password})
|
||||
})
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
sessionStorage.setItem("user_id", data.id)
|
||||
alert('Login erfolgreich!');
|
||||
window.location.href = '/'; // Redirect to home page after login
|
||||
} else {
|
||||
const errorData = await response.json()
|
||||
alert('Login fehlgeschlagen: ' + (errorData.message || 'Unbekannter Fehler'))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Login: ', error)
|
||||
alert('Fehler beim Senden des Logins.')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!-- Fußzeile -->
|
||||
<div id="footer"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
// Funktion, um die Stärke des Passworts zu bewerten
|
||||
function checkPasswordStrength(password) {
|
||||
const strengthBar = document.getElementById('passwordStrengthBar');
|
||||
const passwordStrength = evaluatePasswordStrength(password);
|
||||
|
||||
// Aktualisiere den Sicherheitsbalken basierend auf der Stärke
|
||||
if (passwordStrength === 'weak') {
|
||||
strengthBar.classList.remove('medium', 'strong');
|
||||
strengthBar.classList.add('weak');
|
||||
} else if (passwordStrength === 'medium') {
|
||||
strengthBar.classList.remove('weak', 'strong');
|
||||
strengthBar.classList.add('medium');
|
||||
} else {
|
||||
strengthBar.classList.remove('weak', 'medium');
|
||||
strengthBar.classList.add('strong');
|
||||
}
|
||||
}
|
||||
|
||||
// Funktion zur Beurteilung der Passwortstärke
|
||||
function evaluatePasswordStrength(password) {
|
||||
if (password.length >= 8 && /[A-Z]/.test(password) && /[0-9]/.test(password)) {
|
||||
return 'strong';
|
||||
} else if (password.length >= 6) {
|
||||
return 'medium';
|
||||
} else {
|
||||
return 'weak';
|
||||
}
|
||||
}
|
||||
|
||||
// Event Listener für das Passwortfeld
|
||||
document.getElementById('regPassword').addEventListener('input', function() {
|
||||
checkPasswordStrength(this.value);
|
||||
});
|
||||
|
||||
// Event Listener für das Bestätigungs-Passwortfeld
|
||||
document.getElementById('confirmPassword').addEventListener('input', function() {
|
||||
const password = document.getElementById('regPassword').value;
|
||||
const confirmPassword = this.value;
|
||||
|
||||
if (password !== confirmPassword) {
|
||||
this.setCustomValidity("Die Passwörter stimmen nicht überein.");
|
||||
} else {
|
||||
this.setCustomValidity("");
|
||||
}
|
||||
});
|
||||
@ -4,24 +4,33 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="./Styles/registrieren/registrieren.css">
|
||||
<link rel="stylesheet" href="./Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
<title>Registrieren</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<div class="page-container">
|
||||
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<!-- Registrierungsformular -->
|
||||
<main class="content-wrapper">
|
||||
<div class="register-wrapper">
|
||||
<form action="register.php" method="POST">
|
||||
<h1>Registrieren</h1>
|
||||
<h2 class="title">Registrieren</h2>
|
||||
|
||||
<div class="input-box">
|
||||
<input type="text" name="name" placeholder="Voller Name" required>
|
||||
<input type="text" name="vorname" placeholder="Vorname" required id="vorname">
|
||||
<i class='bx bxs-user'></i>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<input type="text" name="username" placeholder="Username" required>
|
||||
<input type="text" name="nachname" placeholder="Nachname" required id="nachname">
|
||||
<i class='bx bxs-user'></i>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
<input type="email" name="email" placeholder="E-Mail" required>
|
||||
<input type="email" name="email" placeholder="E-Mail" required id="email">
|
||||
<i class='bx bxs-envelope'></i>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
@ -30,22 +39,58 @@
|
||||
</div>
|
||||
|
||||
<div class="input-box">
|
||||
<input type="password" id="confirmPassword" name="confirmPassword" placeholder="Passwort bestätigen" required>
|
||||
<input type="password" id="confirmPassword" name="confirmPassword" placeholder="Passwort bestätigen"
|
||||
required>
|
||||
<i class='bx bxs-lock-alt'></i>
|
||||
</div>
|
||||
|
||||
<!-- Sicherheitsbalken -->
|
||||
<div id="passwordStrengthBar" class="password-strength-bar"></div>
|
||||
|
||||
|
||||
<button type="submit" class="btn">Registrieren</button>
|
||||
<button type="submit" class="btn" id="register">Registrieren</button>
|
||||
|
||||
<div class="register-link">
|
||||
<br>
|
||||
<p>Bereits ein Konto? <a href="/login">Login</a></p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
document.getElementById('register').addEventListener('click', async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const formData = {
|
||||
name: document.getElementById('vorname').value,
|
||||
lower_name: document.getElementById('nachname').value,
|
||||
email: document.getElementById('email').value,
|
||||
passwd: document.getElementById('regPassword').value,
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/user/registration', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(formData)
|
||||
})
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
sessionStorage.setItem("user_id", data.id)
|
||||
alert('Nutzer erfolgreich hinzugefügt! Ihre Kundennummer: ' + data.id)
|
||||
window.location.href= '/'
|
||||
} else {
|
||||
alert('Fehler bei der Registrierung.')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Fehler: ', error)
|
||||
alert('Fehler beim Senden des Formulars.')
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
<!-- Fußzeiele -->
|
||||
<div id="footer"></div>
|
||||
|
||||
</div>
|
||||
<script src="./passwordValidation.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
62
public/shop/shop.html
Normal file
62
public/shop/shop.html
Normal file
@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Shop</title>
|
||||
<link rel="stylesheet" href="/Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<!-- Hauptinhalt -->
|
||||
<section style="padding: 0px 30px; text-align: left;">
|
||||
<h1>Willkommen im Webshop</h1>
|
||||
</section>
|
||||
|
||||
<main>
|
||||
<section class="card-grid" id="products">
|
||||
<!-- Dynamische Produkte -->
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Fußzeiele -->
|
||||
<div id="footer"></div>
|
||||
|
||||
<script>
|
||||
fetch('/api/products')
|
||||
.then(res => res.json())
|
||||
.then(products => {
|
||||
const container = document.getElementById('products');
|
||||
container.innerHTML = ''; // sicherheitshalber leeren
|
||||
|
||||
products.forEach(product => {
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('card');
|
||||
card.innerHTML = `
|
||||
<img src="${product.image_url}" alt="${product.name}">
|
||||
<h3>${product.name}</h3>
|
||||
<p>Preis: ${product.price}€</p>
|
||||
<p>${product.description}</p>
|
||||
<p>Artikel Nr: ${product.id}</p>
|
||||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||||
`;
|
||||
container.appendChild(card);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Fehler beim Laden der Shop_Produkte:', err);
|
||||
|
||||
const container = document.getElementById('products');
|
||||
container.innerHTML =
|
||||
`<div class="error-message">
|
||||
<h3>Fehler beim Laden der Produkte</h3>
|
||||
<p>Es gab ein Problem beim Abrufen der Produktdaten.<br>Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.</p>
|
||||
</div>`;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
69
public/shop/shop_lkw.html
Normal file
69
public/shop/shop_lkw.html
Normal file
@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Shop - LKW's</title>
|
||||
<link rel="stylesheet" href="/Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<!-- Hauptinhalt -->
|
||||
<main>
|
||||
<section style="padding: 0px 30px; text-align: left;">
|
||||
<h1>Unsere LKW Produkte</h1>
|
||||
</section>
|
||||
|
||||
<section class="card-grid" id="products_lkw">
|
||||
<!-- Dynamische Produkte (filtern nach Motorrad) -->
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Fußzeiele -->
|
||||
<div id="footer"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
fetch('/api/products/lkw')
|
||||
.then(res => res.json())
|
||||
.then(products => {
|
||||
const container = document.getElementById('products_lkw');
|
||||
container.innerHTML = ''; // sicherheitshalber leeren
|
||||
|
||||
products.forEach(product => {
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('card');
|
||||
card.innerHTML = `
|
||||
<img src="${product.image_url}" alt="${product.name}">
|
||||
<h3>${product.name}</h3>
|
||||
<p>Preis: ${product.price}€</p>
|
||||
<p>${product.description}</p>
|
||||
<p>Artikel Nr: ${product.id}</p>
|
||||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||||
`;
|
||||
container.appendChild(card);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Fehler beim Laden der LKW_Produkte:', err);
|
||||
|
||||
const container = document.getElementById('products_lkw');
|
||||
container.innerHTML =
|
||||
`<div class="error-message">
|
||||
<h3>Fehler beim Laden der Produkte</h3>
|
||||
<p>Es gab ein Problem beim Abrufen der Produktdaten.<br>
|
||||
Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.</p>
|
||||
</div> `;
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Fußzeiele -->
|
||||
<div id="footer"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
64
public/shop/shop_motorrad.html
Normal file
64
public/shop/shop_motorrad.html
Normal file
@ -0,0 +1,64 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Shop - Motorräder</title>
|
||||
<link rel="stylesheet" href="/Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<!-- Hauptinhalt -->
|
||||
<main class="main-content">
|
||||
<section style="padding: 0px 30px; text-align: left;">
|
||||
<h1>Unsere Motorrad Produkte</h1>
|
||||
</section>
|
||||
|
||||
<section class="card-grid" id="products_motorrad">
|
||||
<!-- Dynamische Produkte oder Fehlermeldung -->
|
||||
</section>
|
||||
</main>
|
||||
|
||||
|
||||
<script>
|
||||
fetch('/api/products/motorrad')
|
||||
.then(res => res.json())
|
||||
.then(products => {
|
||||
const container = document.getElementById('products_motorrad');
|
||||
container.innerHTML = ''; // sicherheitshalber leeren
|
||||
|
||||
products.forEach(product => {
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('card');
|
||||
card.innerHTML = `
|
||||
<img src="${product.image_url}" alt="${product.name}">
|
||||
<h3>${product.name}</h3>
|
||||
<p>Preis: ${product.price}€</p>
|
||||
<p>${product.description}</p>
|
||||
<p>Artikel Nr: ${product.id}</p>
|
||||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||||
`;
|
||||
container.appendChild(card);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Fehler beim Laden der Motorrad_Produkte:', err);
|
||||
const container = document.getElementById('products_motorrad');
|
||||
container.innerHTML = `
|
||||
<div class="error-message">
|
||||
<h3>Fehler beim Laden der Produkte</h3>
|
||||
<p>Es gab ein Problem beim Abrufen der Produktdaten.<br>Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.</p>
|
||||
</div>`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Fußzeiele -->
|
||||
<div id="footer"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
63
public/shop/shop_oldtimer.html
Normal file
63
public/shop/shop_oldtimer.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>Shop - Oldtimer</title>
|
||||
<link rel="stylesheet" href="/Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<!-- Hauptinhalt -->
|
||||
<main class="main-content">
|
||||
<section style="padding: 0px 30px; text-align: left;">
|
||||
<h1>Unsere Oldtimer Produkte</h1>
|
||||
</section>
|
||||
|
||||
<section class="card-grid" id="products_oldtimer">
|
||||
<!-- Dynamische Produkte oder Fehlermeldung -->
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Fußzeile -->
|
||||
<div id="footer"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
fetch('/api/products/oldtimer')
|
||||
.then(res => res.json())
|
||||
.then(products => {
|
||||
const container = document.getElementById('products_oldtimer');
|
||||
container.innerHTML = ''; // sicherheitshalber leeren
|
||||
|
||||
products.forEach(product => {
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('card');
|
||||
card.innerHTML = `
|
||||
<img src="${product.image_url}" alt="${product.name}">
|
||||
<h3>${product.name}</h3>
|
||||
<p>Preis: ${product.price}€</p>
|
||||
<p>${product.description}</p>
|
||||
<p>Artikel Nr: ${product.id}</p>
|
||||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||||
`;
|
||||
container.appendChild(card);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Fehler beim Laden der Oldtimer_Produkte:', err);
|
||||
const container = document.getElementById('products_oldtimer');
|
||||
container.innerHTML = `
|
||||
<div class="error-message">
|
||||
<h3>Fehler beim Laden der Produkte</h3>
|
||||
<p>Es gab ein Problem beim Abrufen der Produktdaten.<br>Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.</p>
|
||||
</div>`;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
66
public/shop/shop_sportwagen.html
Normal file
66
public/shop/shop_sportwagen.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Shop - Sportwagen</title>
|
||||
<link rel="stylesheet" href="/Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<!-- Header -->
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<!-- Hauptinhalt -->
|
||||
<main>
|
||||
<section style="padding: 0px 30px; text-align: left;">
|
||||
<h1>Unsere Sportwagen Produkte</h1>
|
||||
</section>
|
||||
|
||||
<section class="card-grid" id="products_sportwagen">
|
||||
<!-- Dynamische Produkte oder Fehlermeldung -->
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<!-- Footer -->
|
||||
<div id="footer"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
fetch('/api/products/sportwagen')
|
||||
.then(res => res.json())
|
||||
.then(products => {
|
||||
const container = document.getElementById('products_sportwagen');
|
||||
container.innerHTML = '';
|
||||
|
||||
products.forEach(product => {
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('card');
|
||||
card.innerHTML = `
|
||||
<img src="${product.image_url}" alt="${product.name}">
|
||||
<h3>${product.name}</h3>
|
||||
<p>Preis: ${product.price}€</p>
|
||||
<p>${product.description}</p>
|
||||
<p>Artikel Nr: ${product.id}</p>
|
||||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||||
`;
|
||||
container.appendChild(card);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Fehler beim Laden der Sportwagen_Produkte:', err);
|
||||
|
||||
const container = document.getElementById('products_sportwagen');
|
||||
container.innerHTML =
|
||||
`<div class="error-message">
|
||||
<h3>Fehler beim Laden der Produkte</h3>
|
||||
<p>Es gab ein Problem beim Abrufen der Produktdaten.<br>
|
||||
Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.</p>
|
||||
</div> `;
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -3,85 +3,98 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Autohändler Webshop</title>
|
||||
<link rel="stylesheet" href="./Styles/startseite/startseite.css">
|
||||
<title>Modellauto - Startseite</title>
|
||||
<link rel="stylesheet" href="./Styles/styles-main.css">
|
||||
<link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
|
||||
<script src="/header_footer"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Wrapper für die gesamte Seite -->
|
||||
<div class="wrapper">
|
||||
<div class="wrapper">
|
||||
<!-- Header -->
|
||||
<header>
|
||||
<h1>Autohändler Webshop</h1>
|
||||
<div class="header-right">
|
||||
<a href="/login" class="login-btn">Login</a>
|
||||
<a href="/warenkorb" class="cart">
|
||||
<i class='bx bx-cart'></i>
|
||||
<span class="cart-count">0</span>
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
<div id="header-placeholder"></div>
|
||||
|
||||
<!-- Navigationsleiste -->
|
||||
<nav class="menu">
|
||||
<ul class="menu-list">
|
||||
<li class="menu-item">
|
||||
<a href="#">Startseite</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="#">Neuwagen</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="#">Gebrauchtwagen</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="#">Angebote</a>
|
||||
</li>
|
||||
<li class="menu-item">
|
||||
<a href="#">Kontakt</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<main>
|
||||
<!-- Infobereich -->
|
||||
<section style="padding: 40px 20px; text-align: center; background: #fff;">
|
||||
<h2>Willkommen beim Modellauto-Shop</h2>
|
||||
<p>Bei uns finden Sie hochwertige Modellautos – ob Oldtimer, Sportwagen, Lkw's oder Motorräder.
|
||||
Perfekt für Sammler, Bastler und Fans.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<!-- Hauptinhalt -->
|
||||
<main>
|
||||
<div class="search-bar">
|
||||
<input type="text" placeholder="Marke oder Modell eingeben">
|
||||
<select>
|
||||
<option>Fahrzeugtyp</option>
|
||||
<option>SUV</option>
|
||||
<option>Limousine</option>
|
||||
<option>Kombi</option>
|
||||
</select>
|
||||
<select>
|
||||
<option>Preisspanne</option>
|
||||
<option>Bis 10.000€</option>
|
||||
<option>Bis 20.000€</option>
|
||||
<option>Bis 50.000€</option>
|
||||
</select>
|
||||
<button>Suchen</button>
|
||||
</div>
|
||||
<h1>Unsere Neusten Produkte: </h1>
|
||||
<section class="card-grid" id="latest-products">
|
||||
<!-- Dynamische Produkte (5 aktuelle Produkte) -->
|
||||
</section>
|
||||
|
||||
<section class="card-grid">
|
||||
<div class="card">
|
||||
<img src="https://via.placeholder.com/150" alt="Auto">
|
||||
<h3>BMW 3er Limousine</h3>
|
||||
<p>Preis: 35.000€</p>
|
||||
<p>Baujahr: 2020 | Kilometerstand: 20.000 km</p>
|
||||
<button class="add-to-cart">Zum Warenkorb hinzufügen</button>
|
||||
<!-- JavaScript zum Abrufen und Anzeigen der neuesten Produkte -->
|
||||
<script>
|
||||
// API-Aufruf
|
||||
fetch('/api/products/new')
|
||||
// Antwort als JSON parsen
|
||||
.then(res => res.json())
|
||||
.then(products => {
|
||||
const container = document.getElementById('latest-products');
|
||||
container.innerHTML = ''; // sicherheitshalber leeren
|
||||
|
||||
// Für jedes Produkt eine Karte erzeugen
|
||||
products.forEach(product => {
|
||||
const card = document.createElement('div');
|
||||
card.classList.add('card');
|
||||
// HTML-Inhalt der Karte mit Produktdaten füllen
|
||||
card.innerHTML = `
|
||||
<img src="${product.image_url}" alt="${product.name}">
|
||||
<h3>${product.name}</h3>
|
||||
<p>Preis: ${product.price}€</p>
|
||||
<p>${product.description}</p>
|
||||
<button class="add-to-cart" data-id="${product.id}">Zum Warenkorb hinzufügen</button>
|
||||
`;
|
||||
// Karte in Container einfügen
|
||||
container.appendChild(card);
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('Fehler beim Laden der neuesten Produkte:', err);
|
||||
|
||||
const container = document.getElementById('latest-products');
|
||||
container.innerHTML =
|
||||
`<div class="error-message">
|
||||
<h3>Fehler beim Laden der Produkte</h3>
|
||||
<p>Es gab ein Problem beim Abrufen der Produktdaten.<br>Wir arbeiten bereits daran – bitte versuchen Sie es später erneut.</p>
|
||||
</div>`;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Info-Sektion -->
|
||||
<section class="info-cards-section">
|
||||
<div class="info-card">
|
||||
<i class='bx bx-package'></i>
|
||||
<h3>Versandkostenfrei ab 50€</h3>
|
||||
<p>Schneller & sicherer Versand mit Sendungsverfolgung.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<img src="https://via.placeholder.com/150" alt="Auto">
|
||||
<h3>Audi Q5</h3>
|
||||
<p>Preis: 50.000€</p>
|
||||
<p>Baujahr: 2022 | Kilometerstand: 10.000 km</p>
|
||||
<button class="add-to-cart">Zum Warenkorb hinzufügen</button>
|
||||
<div class="info-card">
|
||||
<i class='bx bx-credit-card'></i>
|
||||
<h3>Flexible Zahlungsmethoden</h3>
|
||||
<p>PayPal, Kreditkarte, Klarna, Vorkasse – Sie haben die Wahl.</p>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<i class='bx bx-undo'></i>
|
||||
<h3>14 Tage Rückgaberecht</h3>
|
||||
<p>Unzufrieden? Kein Problem – Rückgabe einfach & unkompliziert.</p>
|
||||
</div>
|
||||
<div class="info-card">
|
||||
<i class='bx bx-star'></i>
|
||||
<h3>Top-Bewertungen</h3>
|
||||
<p>Unsere Kunden lieben uns – überzeugen Sie sich selbst!</p>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<!-- Scripts -->
|
||||
<script src="startseite.js"></script>
|
||||
<!-- Fußzeiele -->
|
||||
<div id="footer"></div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
41
scripts/einfügenHeaderFooter.js
Normal file
41
scripts/einfügenHeaderFooter.js
Normal file
@ -0,0 +1,41 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// Header laden
|
||||
const headerTarget = document.getElementById("header-placeholder");
|
||||
if (headerTarget) {
|
||||
fetch("/header")
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error("Header nicht gefunden");
|
||||
return response.text();
|
||||
})
|
||||
.then(data => {
|
||||
headerTarget.innerHTML = data;
|
||||
})
|
||||
.catch(error => {
|
||||
headerTarget.innerHTML = `
|
||||
<div style="background: #ffdede; color: #a00; padding: 10px; text-align: center;">
|
||||
Fehler beim Laden des Headers.
|
||||
</div>`;
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
// Footer laden
|
||||
const footerTarget = document.getElementById("footer");
|
||||
if (footerTarget) {
|
||||
fetch("/footer")
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error("Footer nicht gefunden");
|
||||
return response.text();
|
||||
})
|
||||
.then(data => {
|
||||
footerTarget.innerHTML = data;
|
||||
})
|
||||
.catch(error => {
|
||||
footerTarget.innerHTML = `
|
||||
<div style="background: #ffdede; color: #a00; padding: 10px; text-align: center;">
|
||||
Fehler beim Laden der Fußzeile.
|
||||
</div>`;
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -1,6 +1,7 @@
|
||||
const path = require('path');
|
||||
const router = require('express').Router();
|
||||
|
||||
// Route - Startseite
|
||||
router.get('/', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/startseite/startseite.html'));
|
||||
})
|
||||
@ -9,15 +10,68 @@ router.get('/example', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/example/index.html'));
|
||||
})
|
||||
|
||||
// Route - Login
|
||||
router.get('/login', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/login/login.html'));
|
||||
})
|
||||
|
||||
// Route - Registrieren
|
||||
router.get('/registrieren', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/registrieren/registrieren.html'));
|
||||
})
|
||||
|
||||
// Route - HeaderFooter
|
||||
router.get('/header_footer', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../scripts/einfügenHeaderFooter.js'));
|
||||
})
|
||||
|
||||
// Route - Kopfzeile
|
||||
router.get('/header', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/header_footer/header.html'));
|
||||
})
|
||||
|
||||
// Route - Fußzeile
|
||||
router.get('/footer', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/header_footer/footer.html'));
|
||||
})
|
||||
|
||||
// Route - Shop (Alle Produkte)
|
||||
router.get('/shop', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/shop/shop.html'));
|
||||
})
|
||||
|
||||
// Route - Shop_Motorrad (Filtern nach Motorrad Produkten)
|
||||
router.get('/shop/motorrad', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/shop/shop_motorrad.html'));
|
||||
})
|
||||
|
||||
// Route - Shop_Oldtimer (Filtern nach Oldtimer Produkten)
|
||||
router.get('/shop/oldtimer', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/shop/shop_oldtimer.html'));
|
||||
})
|
||||
|
||||
// Route - Shop_Sportwagen (Filtern nach Sportwagen Produkten)
|
||||
router.get('/shop/sportwagen', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/shop/shop_sportwagen.html'));
|
||||
})
|
||||
|
||||
// Route - Shop_LKW (Filtern nach LKW Produkten)
|
||||
router.get('/shop/lkw', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/shop/shop_lkw.html'));
|
||||
})
|
||||
|
||||
router.get('/bestellformular', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/bestellformular/bestellformular.html'));
|
||||
})
|
||||
router.get('/Warenkorb', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/warenkorb/warenkorb.html'));
|
||||
})
|
||||
|
||||
router.get('/bestellformular', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/bestellformular/bestellformular.html'));
|
||||
})
|
||||
|
||||
router.get('/bestellung', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../../../public/bestellung/bestellung.html'));
|
||||
})
|
||||
module.exports = router;
|
||||
274
server.js
274
server.js
@ -3,9 +3,27 @@ const session = require('express-session');
|
||||
const router = require('express').Router();
|
||||
const path = require('path');
|
||||
|
||||
require('dotenv').config({path:'process.env'});
|
||||
require('dotenv').config({path: 'process.env'});
|
||||
|
||||
const app = express();
|
||||
const mysql = require('mysql');
|
||||
|
||||
// Datenbankverbindung
|
||||
const db = mysql.createConnection({
|
||||
host: 'localhost',
|
||||
user: 'root',
|
||||
password: '',
|
||||
database: 'webshop'
|
||||
});
|
||||
|
||||
// Verbindung zur MySQL-Datenbank herstellen
|
||||
db.connect(err => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Verbinden zur Datenbank:', err);
|
||||
return;
|
||||
}
|
||||
console.log('Mit der Datenbank verbunden');
|
||||
});
|
||||
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
@ -14,14 +32,264 @@ app.use(session({
|
||||
}));
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
app.use(express.urlencoded({extended: true}));
|
||||
app.use(express.static(path.join(__dirname, '/scripts')));
|
||||
app.use(express.static(path.join(__dirname, '/static')));
|
||||
|
||||
const getIndexRoute = require('./scripts/routes/other/route-index');
|
||||
// API-Route für Produkte
|
||||
app.get('/api/products', (req, res) => {
|
||||
// SQL-Abfrage für Produktdaten
|
||||
const sql = 'SELECT * FROM webshop.product';
|
||||
|
||||
// Abfrage ausführen
|
||||
db.query(sql, (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Produkte:', err);
|
||||
res.status(500).send('Fehler beim Abrufen der Produkte');
|
||||
return;
|
||||
}
|
||||
res.json(results); // Rückgabe der Produktdaten als JSON
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/products/new', async (req, res) => {
|
||||
// SQL-Abfrage für Produktdaten
|
||||
const sql = 'SELECT * FROM webshop.product ORDER BY created_at DESC LIMIT 4';
|
||||
|
||||
// Abfrage ausführen
|
||||
db.query(sql, (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Produkte:', err);
|
||||
res.status(500).send('Fehler beim Abrufen der Produkte');
|
||||
return;
|
||||
}
|
||||
res.json(results); // Rückgabe der Produktdaten als JSON
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/products/motorrad', async (req, res) => {
|
||||
// SQL-Abfrage für Produktdaten
|
||||
const sql = 'SELECT * FROM webshop.product WHERE category_id = 4';
|
||||
|
||||
// Abfrage ausführen
|
||||
db.query(sql, (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Produkte:', err);
|
||||
res.status(500).send('Fehler beim Abrufen der Produkte');
|
||||
return;
|
||||
}
|
||||
res.json(results); // Rückgabe der Produktdaten als JSON
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/products/oldtimer', async (req, res) => {
|
||||
// SQL-Abfrage für Produktdaten
|
||||
const sql = 'SELECT * FROM webshop.product WHERE category_id = 2';
|
||||
|
||||
// Abfrage ausführen
|
||||
db.query(sql, (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Produkte:', err);
|
||||
res.status(500).send('Fehler beim Abrufen der Produkte');
|
||||
return;
|
||||
}
|
||||
res.json(results); // Rückgabe der Produktdaten als JSON
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/products/lkw', async (req, res) => {
|
||||
// SQL-Abfrage für Produktdaten
|
||||
const sql = 'SELECT * FROM webshop.product WHERE category_id = 3';
|
||||
|
||||
// Abfrage ausführen
|
||||
db.query(sql, (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Produkte:', err);
|
||||
res.status(500).send('Fehler beim Abrufen der Produkte');
|
||||
return;
|
||||
}
|
||||
res.json(results); // Rückgabe der Produktdaten als JSON
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/products/sportwagen', async (req, res) => {
|
||||
// SQL-Abfrage für Produktdaten
|
||||
const sql = 'SELECT * FROM webshop.product WHERE category_id = 1';
|
||||
|
||||
// Abfrage ausführen
|
||||
db.query(sql, (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Produkte:', err);
|
||||
res.status(500).send('Fehler beim Abrufen der Produkte');
|
||||
return;
|
||||
}
|
||||
res.json(results); // Rückgabe der Produktdaten als JSON
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/user/registration', (req, res) => {
|
||||
// SQL-Query für Nutzerregistration
|
||||
const {name, lower_name, email, passwd} = req.body;
|
||||
const sql = "INSERT INTO webshop.user (name, lower_name, email, passwd, passwd_hash_algo) VALUES (?, ?, ?, ?, 'none')"
|
||||
|
||||
// Query abschicken
|
||||
db.query(sql, [name, lower_name, email, passwd], (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Schreiben in die Datenbank: ', err);
|
||||
res.status(500).send('Fehler beim Schreiben in die Datenbank');
|
||||
return;
|
||||
}
|
||||
res.status(201).json({message: 'Nutzer erfolgreich hinzugefügt', id: results.insertId})
|
||||
})
|
||||
})
|
||||
|
||||
app.post('/api/user/login', (req, res) => {
|
||||
const {email, password} = req.body
|
||||
const sql = 'SELECT * FROM user WHERE email = ?'
|
||||
|
||||
db.query(sql, [email], (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen des Nutzers: ', err)
|
||||
return res.status(500).json({message: 'Serverfehler'})
|
||||
}
|
||||
if (results.length === 0) {
|
||||
return res.status(401).json({message: 'E-Mail nicht gefunden'})
|
||||
}
|
||||
const user = results[0]
|
||||
|
||||
if (user.passwd !== password) {
|
||||
return res.status(401).json({message: 'Falsches Passwort'})
|
||||
}
|
||||
|
||||
req.session.userId = user.id;
|
||||
req.session.email = user.email;
|
||||
|
||||
res.json({message: 'Login erfolgreich', id: user.id})
|
||||
})
|
||||
})
|
||||
|
||||
app.post('/api/bestellung', (req, res) => {
|
||||
const { user_id, produkte } = req.body;
|
||||
// produkte erwartet als Array: [{product_id: 1, quantity: 2}, {product_id: 5, quantity: 1}, ...]
|
||||
|
||||
if (!user_id || !Array.isArray(produkte) || produkte.length === 0) {
|
||||
return res.status(400).json({ message: 'Ungültige Anfrage: user_id oder Produkte fehlen.' });
|
||||
}
|
||||
|
||||
// Preise der Produkte abrufen
|
||||
const productIds = produkte.map(p => p.product_id);
|
||||
|
||||
const priceQuery = 'SELECT id, price FROM webshop.product WHERE id IN (?)';
|
||||
db.query(priceQuery, [productIds], (err, priceResults) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Produktpreise:', err);
|
||||
return res.status(500).json({ message: 'Serverfehler beim Abrufen der Produktpreise.' });
|
||||
}
|
||||
|
||||
if (priceResults.length !== productIds.length) {
|
||||
return res.status(400).json({ message: 'Eines oder mehrere Produkte existieren nicht.' });
|
||||
}
|
||||
|
||||
// Total berechnen
|
||||
let total = 0;
|
||||
produkte.forEach(p => {
|
||||
const dbProduct = priceResults.find(pr => pr.id === p.product_id);
|
||||
if (dbProduct) {
|
||||
total += dbProduct.price * p.quantity;
|
||||
}
|
||||
});
|
||||
|
||||
const payment_id = 1; // Zahlungssystem-ID (z.B. 1 = Rechnung, 2 = PayPal, ...)
|
||||
|
||||
const sqlOrder = 'INSERT INTO webshop.order_details (user_id, payment_id, total) VALUES (?, ?, ?)';
|
||||
db.query(sqlOrder, [user_id, payment_id, total], (err1, result1) => {
|
||||
if (err1) {
|
||||
console.error('Fehler beim Erstellen der Bestellung:', err1);
|
||||
return res.status(500).json({ message: 'Fehler beim Erstellen der Bestellung.' });
|
||||
}
|
||||
|
||||
const orderId = result1.insertId;
|
||||
|
||||
const values = produkte.map(p => [user_id, p.product_id, p.quantity, orderId]);
|
||||
const sqlItems = 'INSERT INTO webshop.order_items (user_id, product_id, quantity, order_id) VALUES ?';
|
||||
|
||||
db.query(sqlItems, [values], (err2, result2) => {
|
||||
if (err2) {
|
||||
console.error('Fehler beim Einfügen der Order-Items:', err2);
|
||||
return res.status(500).json({ message: 'Fehler beim Hinzufügen der Produkte zur Bestellung.' });
|
||||
}
|
||||
|
||||
res.status(201).json({ message: 'Bestellung erfolgreich!', order_id: orderId, total: total.toFixed(2) });
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.post('/api/bestellung/daten', (req, res) => {
|
||||
const { user_id } = req.body;
|
||||
|
||||
const sql = `
|
||||
SELECT
|
||||
od.id AS order_id,
|
||||
od.total AS order_total,
|
||||
oi.product_id,
|
||||
oi.quantity,
|
||||
p.name AS product_name,
|
||||
p.price AS product_price
|
||||
FROM
|
||||
webshop.order_details od
|
||||
INNER JOIN
|
||||
webshop.order_items oi ON od.id = oi.order_id
|
||||
INNER JOIN
|
||||
webshop.product p ON oi.product_id = p.id
|
||||
WHERE
|
||||
od.user_id = ?
|
||||
ORDER BY
|
||||
od.id DESC
|
||||
`;
|
||||
|
||||
db.query(sql, [user_id], (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler beim Abrufen der Bestellungen: ', err);
|
||||
return res.status(500).json({ message: 'Fehler beim Abrufen der Bestellungen' });
|
||||
}
|
||||
|
||||
if (results.length === 0) {
|
||||
return res.status(404).json({ message: 'Keine Bestellungen gefunden.' });
|
||||
}
|
||||
|
||||
res.json(results);
|
||||
});
|
||||
});
|
||||
|
||||
app.get('/api/pruefe-artikel', (req, res) => {
|
||||
const artikelnummer = req.query.nummer;
|
||||
|
||||
if (!artikelnummer) {
|
||||
return res.status(400).json({ error: 'Keine Artikelnummer angegeben.' });
|
||||
}
|
||||
|
||||
const query = 'SELECT id FROM product WHERE id = ?';
|
||||
|
||||
db.query(query, [artikelnummer], (err, results) => {
|
||||
if (err) {
|
||||
console.error('Fehler bei der Artikelsuche:', err);
|
||||
return res.status(500).json({ error: 'Serverfehler bei der Artikelsuche.' });
|
||||
}
|
||||
|
||||
const verfuegbar = results.length > 0;
|
||||
res.json({ verfuegbar });
|
||||
});
|
||||
});
|
||||
|
||||
const getIndexRoute = require('./scripts/routes/other/route-index');
|
||||
app.use('/', getIndexRoute);
|
||||
|
||||
app.use((req, res) => {
|
||||
res.status(404).sendFile(path.join(__dirname, 'public', '404.html'));
|
||||
});
|
||||
|
||||
// Sever starten
|
||||
app.listen(process.env.APP_PORT, () => {
|
||||
console.log("\x1b[32m");
|
||||
console.log(`Server is running on http://localhost:${process.env.APP_PORT}`);
|
||||
|
||||
@ -6,7 +6,7 @@ body {
|
||||
}
|
||||
|
||||
.warenkorb {
|
||||
max-width: 500px;
|
||||
max-width: 700px;
|
||||
margin: 0 auto;
|
||||
background: white;
|
||||
padding: 120px;
|
||||
@ -43,7 +43,7 @@ body {
|
||||
}
|
||||
|
||||
.remove {
|
||||
background-color: #ff4d4f;
|
||||
background-color: #ff6600;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 6px 12px;
|
||||
@ -52,7 +52,7 @@ body {
|
||||
}
|
||||
|
||||
.remove:hover {
|
||||
background-color: #e60000;
|
||||
background-color: #ff6600;
|
||||
}
|
||||
|
||||
.summary {
|
||||
@ -65,7 +65,7 @@ body {
|
||||
display: block;
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background-color: #4CAF50;
|
||||
background-color: #ff6600;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
@ -75,5 +75,90 @@ body {
|
||||
}
|
||||
|
||||
.checkout:hover {
|
||||
background-color: #45a049;
|
||||
background-color: #ff6600;
|
||||
}
|
||||
|
||||
.checkout {
|
||||
display: inline-block;
|
||||
background-color: #ff6600;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f2f2f2;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.form-container {
|
||||
max-width: 600px;
|
||||
margin: auto;
|
||||
background-color: #ffffff;
|
||||
padding: 25px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
form h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="tel"],
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin-top: 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
input[type="submit"] {
|
||||
margin-top: 20px;
|
||||
background-color: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input[type="submit"]:hover {
|
||||
background-color: #ff6600;
|
||||
}
|
||||
|
||||
.zurKasse {
|
||||
display: block;
|
||||
margin: 20px auto;
|
||||
background-color: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 24px;
|
||||
font-size: 16px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.zurKasse:hover {
|
||||
background-color: #ff6600;
|
||||
}
|
||||
|
||||
|
||||
|
||||
64
static/Styles/bestellformular/bestellformular.css
Normal file
64
static/Styles/bestellformular/bestellformular.css
Normal file
@ -0,0 +1,64 @@
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f2f2f2;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
flex: 1; /* Der Hauptinhalt nimmt den verfügbaren Platz ein */
|
||||
}
|
||||
|
||||
.form-container {
|
||||
max-width: 600px;
|
||||
margin: 20px auto;
|
||||
background-color: #f5f5f5;
|
||||
padding: 25px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
form h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
label {
|
||||
display: block;
|
||||
margin-top: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="tel"],
|
||||
textarea {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin-top: 5px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* NEU: Styling für den Absende-Link */
|
||||
.button-submit {
|
||||
display: inline-block;
|
||||
margin-top: 20px;
|
||||
background-color: #ff6600;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
padding: 12px;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
box-sizing: border-box; /* Damit Breite + Padding sauber passen */
|
||||
}
|
||||
|
||||
.button-submit:hover {
|
||||
background-color: #ff6600;
|
||||
}
|
||||
49
static/Styles/bestellung/bestellung.css
Normal file
49
static/Styles/bestellung/bestellung.css
Normal file
@ -0,0 +1,49 @@
|
||||
/* Allgemeine Layout-Stile */
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f2f2f2;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Container für die Bestellinformationen */
|
||||
#bestellung {
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* Titel */
|
||||
h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* Karte für Bestellinformationen */
|
||||
.bestell-info-card {
|
||||
background-color: #fafafa;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 15px;
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* Bestellinformationen formatieren */
|
||||
.bestell-info-card p {
|
||||
font-size: 16px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
/* Stile für die Label und Platzhalter */
|
||||
.bestell-info-card span {
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
||||
@ -1,234 +0,0 @@
|
||||
/* Allgemeine Einstellungen */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8f9fa;
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px 20px;
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 28px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
header .login-btn {
|
||||
font-size: 14px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background: #ff6600;
|
||||
padding: 10px 20px;
|
||||
border-radius: 25px;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
header .login-btn:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
.cart {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
font-size: 24px;
|
||||
color: #ff6600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cart-count {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -10px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Navigation */
|
||||
.menu {
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menu-item a {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
padding: 10px 20px;
|
||||
transition: background 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
.menu-item a:hover {
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* Submenu */
|
||||
.submenu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
display: none;
|
||||
list-style: none;
|
||||
min-width: 200px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.submenu li {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.submenu li a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.submenu li a:hover {
|
||||
color: white;
|
||||
background: #ff6600;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.menu-item:hover .submenu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Suchleiste */
|
||||
.search-bar {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 65px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.search-bar input,
|
||||
.search-bar select {
|
||||
padding: 12px;
|
||||
font-size: 16px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.search-bar button {
|
||||
padding: 12px 20px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.search-bar button:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
/* Karten */
|
||||
.card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.card img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
font-size: 20px;
|
||||
color: #333;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.card p {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.add-to-cart {
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 20px;
|
||||
border-radius: 25px;
|
||||
margin-top: 10px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.add-to-cart:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
@ -1,109 +1,61 @@
|
||||
/* Allgemeine Einstellungen */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8f9fa;
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Wrapper */
|
||||
.wrapper {
|
||||
background: #ffffff;
|
||||
padding: 40px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
max-width: 400px;
|
||||
.login-container {
|
||||
background-color: #fff;
|
||||
padding: 40px 30px;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 24px;
|
||||
max-width: 400px;
|
||||
text-align: center;
|
||||
color: #333;
|
||||
margin-bottom: 20px;
|
||||
margin: 50px auto; /* Zentriert das Formular */
|
||||
}
|
||||
|
||||
/* Input-Box */
|
||||
.input-box {
|
||||
.login-form .input-group {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.input-box input {
|
||||
.login-form input {
|
||||
width: 100%;
|
||||
padding: 12px 40px 12px 15px;
|
||||
padding: 12px 15px 12px 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Styling für das Schloss-Icon */
|
||||
.input-box i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 15px;
|
||||
transform: translateY(-50%);
|
||||
color: #888;
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
.login-form .icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Remember and Forgot */
|
||||
.remember-forgot {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.remember-forgot a {
|
||||
color: #ff6600;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.remember-forgot a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Button */
|
||||
.btn {
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
padding: 12px 20px;
|
||||
padding: 12px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
border-radius: 25px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
.login-btn:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
/* Register-Link */
|
||||
.register-link {
|
||||
text-align: center;
|
||||
.register-text {
|
||||
margin-top: 20px;
|
||||
font-size: 14px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.register-link a {
|
||||
.register-text a {
|
||||
color: #ff6600;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.register-link a:hover {
|
||||
.register-text a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
@ -1,103 +1,72 @@
|
||||
/* Allgemeine Einstellungen */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8f9fa;
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
.page-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* Wrapper für das Formular */
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
.register-wrapper {
|
||||
max-width: 400px;
|
||||
margin: 50px auto;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
.content-wrapper {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 40px 20px;
|
||||
}
|
||||
|
||||
.registration-container {
|
||||
max-width: 400px;
|
||||
margin: 60px auto;
|
||||
padding: 30px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.registration-container h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
/* Eingabefelder */
|
||||
.input-box {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Textfelder */
|
||||
.input-box input {
|
||||
.registration-container input[type="text"],
|
||||
.registration-container input[type="email"],
|
||||
.registration-container input[type="password"] {
|
||||
width: 100%;
|
||||
padding: 12px 15px;
|
||||
font-size: 16px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
outline: none;
|
||||
padding-left: 40px; /* Platz für das Icon */
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 15px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 8px;
|
||||
font-size: 1em;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Positionierung der Icons */
|
||||
.input-box i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 10px;
|
||||
transform: translateY(-50%);
|
||||
font-size: 18px;
|
||||
color: #888;
|
||||
.register-link {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
/* Passwortfeld */
|
||||
.input-box input[type="password"] {
|
||||
padding-right: 40px; /* Platz für das Passwort-Symbol rechts */
|
||||
.register-link a {
|
||||
color: #ff6600;
|
||||
text-decoration: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Positionierung des Passwort-Symbols */
|
||||
#toggleRegPassword {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 10px;
|
||||
transform: translateY(-50%);
|
||||
font-size: 18px;
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
.register-link a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Passwort Sicherheitsbalken */
|
||||
.password-strength-bar {
|
||||
width: 100%;
|
||||
height: 5px;
|
||||
background-color: #ddd;
|
||||
border-radius: 5px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* Sicherheitsstufen */
|
||||
.password-strength-bar.weak {
|
||||
background-color: #f44336; /* Rot für schwach */
|
||||
}
|
||||
|
||||
.password-strength-bar.medium {
|
||||
background-color: #ff9800; /* Orange für mittel */
|
||||
}
|
||||
|
||||
.password-strength-bar.strong {
|
||||
background-color: #4caf50; /* Grün für stark */
|
||||
}
|
||||
|
||||
/* Button */
|
||||
.btn {
|
||||
.register-btn {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background: #ff6600;
|
||||
@ -105,25 +74,8 @@ h1 {
|
||||
border: none;
|
||||
border-radius: 25px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
/* Registrierung-Link */
|
||||
.register-link {
|
||||
text-align: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.register-link a {
|
||||
text-decoration: none;
|
||||
color: #ff6600;
|
||||
}
|
||||
|
||||
.register-link a:hover {
|
||||
color: #e95b00;
|
||||
}
|
||||
|
||||
@ -1,234 +0,0 @@
|
||||
/* Allgemeine Einstellungen */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8f9fa;
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px 20px;
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 28px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
header .login-btn {
|
||||
font-size: 14px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background: #ff6600;
|
||||
padding: 10px 20px;
|
||||
border-radius: 25px;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
header .login-btn:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
.cart {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
font-size: 24px;
|
||||
color: #ff6600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cart-count {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -10px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Navigation */
|
||||
.menu {
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menu-item a {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
padding: 10px 20px;
|
||||
transition: background 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
.menu-item a:hover {
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/* Submenu */
|
||||
.submenu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
display: none;
|
||||
list-style: none;
|
||||
min-width: 200px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.submenu li {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.submenu li a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.submenu li a:hover {
|
||||
color: white;
|
||||
background: #ff6600;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.menu-item:hover .submenu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Suchleiste */
|
||||
.search-bar {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 65px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.search-bar input,
|
||||
.search-bar select {
|
||||
padding: 12px;
|
||||
font-size: 16px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.search-bar button {
|
||||
padding: 12px 20px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.search-bar button:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
/* Karten */
|
||||
.card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.card img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
font-size: 20px;
|
||||
color: #333;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.card p {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.add-to-cart {
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 20px;
|
||||
border-radius: 25px;
|
||||
margin-top: 10px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.add-to-cart:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
@ -1,26 +1,424 @@
|
||||
|
||||
/*
|
||||
===============
|
||||
Fonts
|
||||
===============
|
||||
*/
|
||||
@import url("https://fonts.googleapis.com/css?family=Open+Sans|Roboto:400,700&display=swap");
|
||||
|
||||
/*
|
||||
===============
|
||||
Variables
|
||||
===============
|
||||
*/
|
||||
:root {
|
||||
--demo-clr: #ff0000;
|
||||
/* ========== Allgemeine Einstellungen ========== */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: "Poppins", sans-serif;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Global Styles
|
||||
===============
|
||||
*/
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #f8f9fa;
|
||||
color: #333;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
/* ========== Header ========== */
|
||||
header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0px 20px;
|
||||
width: 100%;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.logo-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.logo-container h1 {
|
||||
margin-left: 10px;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
.logo-img {
|
||||
height: 70px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
font-size: 30px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
font-size: 14px;
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
background: #ff6600;
|
||||
padding: 10px 20px;
|
||||
border-radius: 25px;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.login-btn:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
/* ========== Warenkorb Icon ========== */
|
||||
.cart {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
font-size: 24px;
|
||||
color: #ff6600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cart-count {
|
||||
position: absolute;
|
||||
top: -5px;
|
||||
right: -10px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
font-size: 12px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* ========== Navigation ========== */
|
||||
.menu {
|
||||
background: #ffffff;
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.menu-list {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.menu-item a {
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
padding: 10px 20px;
|
||||
transition: background 0.3s ease, color 0.3s ease;
|
||||
}
|
||||
|
||||
.menu-item a:hover {
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.submenu {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
display: none;
|
||||
list-style: none;
|
||||
min-width: 200px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.submenu li {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
|
||||
.submenu li a {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.submenu li a:hover {
|
||||
color: white;
|
||||
background: #ff6600;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.menu-item:hover .submenu {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ========== Suchleiste ========== */
|
||||
.search-bar {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
position: sticky;
|
||||
top: 65px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.search-bar input,
|
||||
.search-bar select {
|
||||
padding: 12px;
|
||||
font-size: 16px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.search-bar button {
|
||||
padding: 12px 20px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.search-bar button:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
/* ========== Karten ========== */
|
||||
.card-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
gap: 20px;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: #ffffff;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.card img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
border-radius: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
font-size: 20px;
|
||||
color: #333;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.card p {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.add-to-cart {
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 12px 20px;
|
||||
border-radius: 25px;
|
||||
margin-top: 10px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.add-to-cart:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
/* ========== Footer ========== */
|
||||
.footer {
|
||||
background: #222;
|
||||
color: #fff;
|
||||
padding: 30px 20px;
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
color: #ff6600;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* ========== Formulare und Buttons allgemein ========== */
|
||||
.input-box {
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 26px;
|
||||
font-weight: 600;
|
||||
margin-bottom: 25px;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.input-box input {
|
||||
width: 100%;
|
||||
padding: 12px 40px 12px 15px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.input-box i {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: 15px;
|
||||
transform: translateY(-50%);
|
||||
color: #888;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 100%;
|
||||
padding: 12px 20px;
|
||||
background: #ff6600;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
transition: background 0.3s ease;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
background: #e95b00;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: var(--demo-clr);
|
||||
font-size: 24px;
|
||||
color: #333;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.info-cards-section {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 30px;
|
||||
padding: 50px 20px;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.info-card {
|
||||
background: #ffffff;
|
||||
border-radius: 15px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
||||
padding: 30px 25px;
|
||||
width: 320px;
|
||||
min-height: 50px;
|
||||
text-align: center;
|
||||
transition: transform 0.3s ease;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.info-card:hover {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
|
||||
.info-card i {
|
||||
font-size: 50px;
|
||||
color: #ff6600;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.info-card h3 {
|
||||
font-size: 22px;
|
||||
color: #333;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.info-card p {
|
||||
font-size: 16px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
/* ========== Error Nachricht (Header und Footer) ========== */
|
||||
.error-message {
|
||||
max-width: 600px;
|
||||
margin: 40px auto;
|
||||
padding: 30px;
|
||||
background-color: #fff5f5;
|
||||
color: #b00020;
|
||||
border: 1px solid #ffcccc;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
text-align: center;
|
||||
font-family: inherit;
|
||||
animation: fadeIn 0.6s ease-in-out;
|
||||
}
|
||||
|
||||
.error-message h3 {
|
||||
margin-bottom: 10px;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.error-message p {
|
||||
font-size: 1rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* Optional: weiche Animation beim Einblenden */
|
||||
@keyframes fadeIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 534 KiB |
BIN
static/images/Logo.png
Normal file
BIN
static/images/Logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
Loading…
x
Reference in New Issue
Block a user