mirror of
https://github.com/Matewoo/tablet-web-survey.git
synced 2026-11-18 13:52:47 +01:00
moved files
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
let currentWeek = new Date();
|
||||
currentWeek.setDate(currentWeek.getDate() - currentWeek.getDay() + 1); // Set to Monday of the current week
|
||||
|
||||
function updateWeekTitle() {
|
||||
const startOfWeek = new Date(currentWeek);
|
||||
const endOfWeek = new Date(currentWeek);
|
||||
endOfWeek.setDate(startOfWeek.getDate() + 4); // Friday of the current week
|
||||
const weekNumber = Math.ceil(((startOfWeek - new Date(startOfWeek.getFullYear(), 0, 1)) / 86400000 + startOfWeek.getDay() + 1) / 7);
|
||||
document.getElementById('week-title').textContent = `KW${weekNumber} ${startOfWeek.toLocaleDateString()} - ${endOfWeek.toLocaleDateString()}`;
|
||||
}
|
||||
|
||||
function fetchSummary() {
|
||||
fetch(`/weekly-summary?week=${currentWeek.toISOString().split('T')[0]}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const tableBody = document.getElementById('summary-table').getElementsByTagName('tbody')[0];
|
||||
tableBody.innerHTML = '';
|
||||
const categories = ['Fleischgericht', 'Vegetarisch', 'Tagesgericht', 'Tagessalat'];
|
||||
categories.forEach(category => {
|
||||
const tr = document.createElement('tr');
|
||||
tr.innerHTML = `
|
||||
<td>${category}</td>
|
||||
<td>${data.Monday[category].average} ⭐ (${data.Monday[category].count} P)</td>
|
||||
<td>${data.Tuesday[category].average} ⭐ (${data.Tuesday[category].count} P)</td>
|
||||
<td>${data.Wednesday[category].average} ⭐ (${data.Wednesday[category].count} P)</td>
|
||||
<td>${data.Thursday[category].average} ⭐ (${data.Thursday[category].count} P)</td>
|
||||
<td>${data.Friday[category].average} ⭐ (${data.Friday[category].count} P)</td>
|
||||
`;
|
||||
tableBody.appendChild(tr);
|
||||
});
|
||||
|
||||
const tro = document.createElement('tr');
|
||||
tro.innerHTML = `
|
||||
<td>Gesamte Bewertungen</td>
|
||||
<td>${Number(data.Monday['Fleischgericht'].count) + Number(data.Monday['Vegetarisch'].count) + Number(data.Monday['Tagesgericht'].count) + Number(data.Monday['Tagessalat'].count)} Bewertungen</td>
|
||||
<td>${Number(data.Tuesday['Fleischgericht'].count) + Number(data.Tuesday['Vegetarisch'].count) + Number(data.Tuesday['Tagesgericht'].count) + Number(data.Tuesday['Tagessalat'].count)} Bewertungen</td>
|
||||
<td>${Number(data.Wednesday['Fleischgericht'].count) + Number(data.Wednesday['Vegetarisch'].count) + Number(data.Wednesday['Tagesgericht'].count) + Number(data.Wednesday['Tagessalat'].count)} Bewertungen</td>
|
||||
<td>${Number(data.Thursday['Fleischgericht'].count) + Number(data.Thursday['Vegetarisch'].count) + Number(data.Thursday['Tagesgericht'].count) + Number(data.Thursday['Tagessalat'].count)} Bewertungen</td>
|
||||
<td>${Number(data.Friday['Fleischgericht'].count) + Number(data.Friday['Vegetarisch'].count) + Number(data.Friday['Tagesgericht'].count) + Number(data.Friday['Tagessalat'].count)} Bewertungen</td>
|
||||
`;
|
||||
tableBody.appendChild(tro);
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching summary:', error);
|
||||
});
|
||||
}
|
||||
|
||||
document.getElementById('prev-week').addEventListener('click', () => {
|
||||
currentWeek.setDate(currentWeek.getDate() - 7);
|
||||
updateWeekTitle();
|
||||
fetchSummary();
|
||||
});
|
||||
|
||||
document.getElementById('next-week').addEventListener('click', () => {
|
||||
currentWeek.setDate(currentWeek.getDate() + 7);
|
||||
updateWeekTitle();
|
||||
fetchSummary();
|
||||
});
|
||||
|
||||
updateWeekTitle();
|
||||
fetchSummary();
|
||||
@@ -0,0 +1,29 @@
|
||||
document.querySelectorAll('.emoji').forEach(button => {
|
||||
button.addEventListener('click', () => {
|
||||
const category = button.getAttribute('data-category');
|
||||
const results = {};
|
||||
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';
|
||||
document.getElementById('content').style.visibility = 'hidden';
|
||||
setTimeout(() => {
|
||||
document.getElementById('thank-you-message').style.display = 'none';
|
||||
document.getElementById('content').style.visibility = 'visible';
|
||||
document.querySelectorAll('.emoji').forEach(button => button.classList.remove('selected'));
|
||||
}, 2500);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Error:', error);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,109 @@
|
||||
body {
|
||||
font-family: 'Fira Sans', sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background-color: #a81411;
|
||||
background-image: url("/resources/background.png");
|
||||
color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
overflow: hidden; /* Verhindert Scrollen */
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
margin-bottom: 70px;
|
||||
padding-top: 1rem;
|
||||
-webkit-user-select: none; /* Safari */
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.content {
|
||||
display: grid;
|
||||
grid-template-columns: auto 1fr;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
margin-left: 12rem;
|
||||
margin-right: 12rem;
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
grid-template-columns:auto 3fr;
|
||||
gap: 250px;
|
||||
align-items: flex-start;
|
||||
margin-top:20px;
|
||||
margin-left: 12rem;
|
||||
margin-right: 12rem;
|
||||
margin-bottom: -70px;
|
||||
}
|
||||
|
||||
.rating-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 150px; /* Feste Höhe für die Zeilen */
|
||||
}
|
||||
|
||||
.rating-container h3 {
|
||||
font-size: 3rem;
|
||||
}
|
||||
|
||||
.emojies {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
button {
|
||||
font-size: 6rem;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
background-color: #f0f0f0;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
transition: transform 0.2s;
|
||||
font-family: 'Fira Sans', sans-serif;
|
||||
}
|
||||
|
||||
button.selected {
|
||||
background-color: #a8a8a8;
|
||||
}
|
||||
|
||||
#submit {
|
||||
margin-top: 20px;
|
||||
padding: 10px 20px;
|
||||
font-size: 2rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#thank-you-message {
|
||||
display: none;
|
||||
margin-top: 0px;
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Weekly Summary</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 id="week-title"></h1>
|
||||
<div>
|
||||
<button id="prev-week"><</button>
|
||||
<button id="next-week">></button>
|
||||
</div>
|
||||
<table id="summary-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Gericht</th>
|
||||
<th style="width: 18%;">Montag</th>
|
||||
<th style="width: 18%;">Dienstg</th>
|
||||
<th style="width: 18%;">Mittwoch</th>
|
||||
<th style="width: 18%;">Donnerstag</th>
|
||||
<th style="width: 18%;">Freitag</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
</table>
|
||||
<script src="../src/summary.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="google" content="notranslate">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<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 Besuch</h1>
|
||||
<div class="content" id="content">
|
||||
<div>
|
||||
<div class="rating-container" style="justify-content:left;">
|
||||
<h3>Fleisch/Fisch</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;">
|
||||
<h3>Tagesalat</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">
|
||||
<div class="emojies">
|
||||
<button class="emoji" data-category="Tagessalat" id="veryBad">😟</button>
|
||||
<button class="emoji" data-category="Tagessalat" id="bad">☹️</button>
|
||||
<button class="emoji" data-category="Tagessalat" id="neutral">😐</button>
|
||||
<button class="emoji" data-category="Tagessalat" id="good">🙂</button>
|
||||
<button class="emoji" data-category="Tagessalat" id="veryGood">😋</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div style="width: 20rem;">
|
||||
</div>
|
||||
<div style="width: 20rem;">
|
||||
</div>
|
||||
<div style="width: 20rem;">
|
||||
<img src="/resources/logo.png" alt="Logo" class="logo" height="100" style="margin-top: 40px;">
|
||||
</div>
|
||||
</div>
|
||||
<div id="thank-you-message" style="display: none; margin-top: -420px; font-size: 5rem;">Vielen Dank für Ihr Feedback!</div>
|
||||
<script src="vote.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user