mirror of
https://github.com/Matewoo/tablet-web-survey.git
synced 2026-11-18 13:52:47 +01:00
wow so much
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Emoji Feedback</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1>Bitte bewerten Sie Ihren heutigen Aufenthalt</h1>
|
||||
<div class="content">
|
||||
<div>
|
||||
<div class="rating-container" style="justify-content:left;">
|
||||
<h3>Fleischgericht</h3>
|
||||
</div>
|
||||
<div class="rating-container" style="justify-content:left;">
|
||||
<h3>Vegetarisch</h3>
|
||||
</div>
|
||||
<div class="rating-container" style="justify-content:left;">
|
||||
<h3>Tagesgericht</h3>
|
||||
</div>
|
||||
<div class="rating-container" style="justify-content:left; margin-top: 20px; margin-bottom: 20px;">
|
||||
<h3>Service</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="rating-container">
|
||||
<div class="emojies">
|
||||
<button class="emoji" data-category="Fleischgericht" id="veryBad">😢</button>
|
||||
<button class="emoji" data-category="Fleischgericht" id="bad">😐</button>
|
||||
<button class="emoji" data-category="Fleischgericht" id="neutral">🙂</button>
|
||||
<button class="emoji" data-category="Fleischgericht" id="good">😋</button>
|
||||
<button class="emoji" data-category="Fleischgericht" id="veryGood">🤩</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rating-container">
|
||||
<div class="emojies">
|
||||
<button class="emoji" data-category="Vegetarisch" id="veryBad">😢</button>
|
||||
<button class="emoji" data-category="Vegetarisch" id="bad">😐</button>
|
||||
<button class="emoji" data-category="Vegetarisch" id="neutral">🙂</button>
|
||||
<button class="emoji" data-category="Vegetarisch" id="good">😋</button>
|
||||
<button class="emoji" data-category="Vegetarisch" id="veryGood">🤩</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rating-container">
|
||||
<div class="emojies">
|
||||
<button class="emoji" data-category="Tagesgericht" id="veryBad">😢</button>
|
||||
<button class="emoji" data-category="Tagesgericht" id="bad">😐</button>
|
||||
<button class="emoji" data-category="Tagesgericht" id="neutral">🙂</button>
|
||||
<button class="emoji" data-category="Tagesgericht" id="good">😋</button>
|
||||
<button class="emoji" data-category="Tagesgericht" id="veryGood">🤩</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rating-container" style="margin-top: 20px; margin-bottom: 20px;">
|
||||
<div class="emojies">
|
||||
<button class="emoji" data-category="Service" id="bad">😟</button>
|
||||
<button class="emoji" data-category="Service" id="neutral">😐</button>
|
||||
<button class="emoji" data-category="Service" id="good">🙂</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button id="submit">Abschicken</button>
|
||||
<div id="thank-you-message" style="display: none; margin-top: 20px; font-size: 2rem;">Vielen Dank für Ihr Feedback!</div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,39 @@
|
||||
document.querySelectorAll('.emoji').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const category = button.getAttribute('data-category');
|
||||
if (category === 'Fleischgericht' || category === 'Vegetarisch' || category === 'Tagesgericht') {
|
||||
document.querySelectorAll('.emoji[data-category="Fleischgericht"], .emoji[data-category="Vegetarisch"], .emoji[data-category="Tagesgericht"]').forEach(btn => btn.classList.remove('selected'));
|
||||
} else {
|
||||
document.querySelectorAll(`.emoji[data-category="${category}"]`).forEach(btn => btn.classList.remove('selected'));
|
||||
}
|
||||
button.classList.add('selected');
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('submit').addEventListener('click', () => {
|
||||
const results = {};
|
||||
document.querySelectorAll('.emoji.selected').forEach(button => {
|
||||
const category = button.getAttribute('data-category');
|
||||
results[category] = button.id;
|
||||
});
|
||||
|
||||
fetch('/submit', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(results)
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log('Success:', data);
|
||||
document.getElementById('thank-you-message').style.display = 'block';
|
||||
setTimeout(() => {
|
||||
document.getElementById('thank-you-message').style.display = 'none';
|
||||
document.querySelectorAll('.emoji').forEach(button => button.classList.remove('selected'));
|
||||
}, 1000);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
@@ -4,6 +4,7 @@ body {
|
||||
padding: 0;
|
||||
background-color: #a81411;
|
||||
color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
@@ -69,4 +70,21 @@ body {
|
||||
margin-top: 100px;
|
||||
font-size: 2rem;
|
||||
color: lime;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 80%;
|
||||
margin: 20px auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
th {
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
}
|
||||
Reference in New Issue
Block a user