mirror of
https://github.com/Matewoo/pdf-writer.git
synced 2026-11-18 18:32:44 +01:00
new weeklyFeed show menu for the week
This commit is contained in:
+6
-2
@@ -65,8 +65,12 @@ app.get('/edit/dailyDish', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../frontend/public/edit', 'dailyDish.html'));
|
||||
});
|
||||
|
||||
app.get('/digitalSignage/feed', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../frontend/public/digitalSignage', 'feed.html'));
|
||||
app.get('/digitalSignage/dailyFeed', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../frontend/public/digitalSignage', 'dailyFeed.html'));
|
||||
});
|
||||
|
||||
app.get('/digitalSignage/weeklyFeed', (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../frontend/public/digitalSignage', 'weeklyFeed.html'));
|
||||
});
|
||||
|
||||
app.post('/save-week', (req, res) => {
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@
|
||||
|
||||
</script>
|
||||
|
||||
<script src="../src/feed.js"></script>
|
||||
<script src="../src/dailyFeed.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>weeklyFeed</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Fira Sans', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #a81411;
|
||||
font-size: 50px;
|
||||
font-weight: 300;
|
||||
font-style: italic;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #a81411;
|
||||
font-weight: bold;
|
||||
margin-bottom: 0;
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
.category {
|
||||
color: rgb(72, 163, 238);
|
||||
font-weight: 600;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
font-size: 23px;
|
||||
}
|
||||
|
||||
.veggie {
|
||||
color: rgb(10, 194, 87);
|
||||
}
|
||||
|
||||
.halal {
|
||||
color: rgb(10, 194, 87);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.main {
|
||||
font-weight: 600;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 0;
|
||||
font-size: 23px;
|
||||
}
|
||||
|
||||
.side {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
margin-left:17px;
|
||||
font-size: 23px;
|
||||
}
|
||||
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 0.5px solid #707070;
|
||||
width: 80%;
|
||||
margin-left: 0;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Freuen Sie sich auf:</h1>
|
||||
<h2></h2>
|
||||
|
||||
<script src="../src/weeklyFeed.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,40 @@
|
||||
function loadWeek(week) {
|
||||
fetch(`/load-week?week=${encodeURIComponent(week)}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const sortedData = data.sort((a, b) => a.day_index - b.day_index);
|
||||
|
||||
const container = document.querySelector('body');
|
||||
container.innerHTML = `
|
||||
<h1>Freuen Sie sich auf:</h1>
|
||||
${sortedData.map(item => `
|
||||
<p class="category">— ${item.date_title} ${item.halal ? '<span class="halal">„HALAL"</span>' : ''}</p>
|
||||
<p class="main">~ ${item.meat_main}</p>
|
||||
<p class="side">${item.meat_side}</p>
|
||||
|
||||
<p class="main">~ ${item.veggi_main}</p>
|
||||
<p class="side">${item.veggi_side}</p>
|
||||
<hr>
|
||||
`).join('')}
|
||||
`;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error loading week:', error);
|
||||
});
|
||||
}
|
||||
|
||||
// Get current week number and year
|
||||
function getCurrentWeek() {
|
||||
const now = new Date();
|
||||
const start = new Date(now.getFullYear(), 0, 1);
|
||||
const week = Math.ceil((((now - start) / 86400000) + start.getDay() + 1) / 7);
|
||||
return `KW${week} ${now.getFullYear()}`;
|
||||
}
|
||||
|
||||
// Load current week's menu on page load
|
||||
loadWeek(getCurrentWeek());
|
||||
|
||||
// Reload page every 15 seconds
|
||||
setInterval(() => {
|
||||
window.location.reload();
|
||||
}, 15000);
|
||||
Reference in New Issue
Block a user