mirror of
https://github.com/Matewoo/pdf-writer.git
synced 2026-11-18 18:42:50 +01:00
Update index.html
This commit is contained in:
+140
-16
@@ -113,6 +113,14 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.day-form {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-form.active {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -134,28 +142,98 @@
|
|||||||
<div class="template-page">
|
<div class="template-page">
|
||||||
<div class="form-overlay">
|
<div class="form-overlay">
|
||||||
<form id="menuForm">
|
<form id="menuForm">
|
||||||
<input type="text" class="input-field-14" name="date" style="bottom: 68%; left: 13.4%"
|
<div id="dayForm0" class="day-form active">
|
||||||
placeholder="Datum">
|
<input type="text" class="input-field-14" name="dateTitle0" style="bottom: 68%; left: 13.4%"
|
||||||
<input type="checkbox" class="input-field-13" name="halal" style="bottom: 62.2%; left: 22.1%">
|
placeholder="Datum">
|
||||||
<input type="text" class="input-field-12" name="meatMain" style="bottom: 55%; left: 14%"
|
<input type="checkbox" class="input-field-13" name="halal0" style="bottom: 62.2%; left: 22.1%">
|
||||||
placeholder="Fleischgericht">
|
<input type="text" class="input-field-12" name="meatMain0" style="bottom: 55%; left: 14%"
|
||||||
<input type="text" class="input-field-12" name="meatSide" style="bottom: 50.2%; left: 14%"
|
placeholder="Fleischgericht">
|
||||||
placeholder="Beilage">
|
<input type="text" class="input-field-12" name="meatSide0" style="bottom: 50.2%; left: 14%"
|
||||||
<input type="text" class="input-field-10" name="meatPrice" style="bottom: 40.4%; left: 14%"
|
placeholder="Beilage">
|
||||||
placeholder="Preis">
|
<input type="text" class="input-field-10" name="meatPrice0" style="bottom: 40.4%; left: 14%"
|
||||||
<input type="text" class="input-field-12" name="veggiMain" style="bottom: 25.6%; left: 14%"
|
placeholder="Preis">
|
||||||
placeholder="Veggie">
|
<input type="text" class="input-field-12" name="veggiMain0" style="bottom: 25.6%; left: 14%"
|
||||||
<input type="text" class="input-field-12" name="veggiSide" style="bottom: 20.8%; left: 14%"
|
placeholder="Veggie">
|
||||||
placeholder="Beilage">
|
<input type="text" class="input-field-12" name="veggiSide0" style="bottom: 20.8%; left: 14%"
|
||||||
<input type="text" class="input-field-10" name="veggiPrice" style="bottom: 15.5%; left: 14%"
|
placeholder="Beilage">
|
||||||
placeholder="Preis">
|
<input type="text" class="input-field-10" name="veggiPrice0" style="bottom: 15.5%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
</div>
|
||||||
|
<div id="dayForm1" class="day-form">
|
||||||
|
<input type="text" class="input-field-14" name="dateTitle1" style="bottom: 68%; left: 13.4%"
|
||||||
|
placeholder="Datum">
|
||||||
|
<input type="checkbox" class="input-field-13" name="halal1" style="bottom: 62.2%; left: 22.1%">
|
||||||
|
<input type="text" class="input-field-12" name="meatMain1" style="bottom: 55%; left: 14%"
|
||||||
|
placeholder="Fleischgericht">
|
||||||
|
<input type="text" class="input-field-12" name="meatSide1" style="bottom: 50.2%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="meatPrice1" style="bottom: 40.4%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
<input type="text" class="input-field-12" name="veggiMain1" style="bottom: 25.6%; left: 14%"
|
||||||
|
placeholder="Veggie">
|
||||||
|
<input type="text" class="input-field-12" name="veggiSide1" style="bottom: 20.8%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="veggiPrice1" style="bottom: 15.5%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
</div>
|
||||||
|
<div id="dayForm2" class="day-form">
|
||||||
|
<input type="text" class="input-field-14" name="dateTitle2" style="bottom: 68%; left: 13.4%"
|
||||||
|
placeholder="Datum">
|
||||||
|
<input type="checkbox" class="input-field-13" name="halal2" style="bottom: 62.2%; left: 22.1%">
|
||||||
|
<input type="text" class="input-field-12" name="meatMain2" style="bottom: 55%; left: 14%"
|
||||||
|
placeholder="Fleischgericht">
|
||||||
|
<input type="text" class="input-field-12" name="meatSide2" style="bottom: 50.2%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="meatPrice2" style="bottom: 40.4%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
<input type="text" class="input-field-12" name="veggiMain2" style="bottom: 25.6%; left: 14%"
|
||||||
|
placeholder="Veggie">
|
||||||
|
<input type="text" class="input-field-12" name="veggiSide2" style="bottom: 20.8%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="veggiPrice2" style="bottom: 15.5%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
</div>
|
||||||
|
<div id="dayForm3" class="day-form">
|
||||||
|
<input type="text" class="input-field-14" name="dateTitle3" style="bottom: 68%; left: 13.4%"
|
||||||
|
placeholder="Datum">
|
||||||
|
<input type="checkbox" class="input-field-13" name="halal3" style="bottom: 62.2%; left: 22.1%">
|
||||||
|
<input type="text" class="input-field-12" name="meatMain3" style="bottom: 55%; left: 14%"
|
||||||
|
placeholder="Fleischgericht">
|
||||||
|
<input type="text" class="input-field-12" name="meatSide3" style="bottom: 50.2%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="meatPrice3" style="bottom: 40.4%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
<input type="text" class="input-field-12" name="veggiMain3" style="bottom: 25.6%; left: 14%"
|
||||||
|
placeholder="Veggie">
|
||||||
|
<input type="text" class="input-field-12" name="veggiSide3" style="bottom: 20.8%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="veggiPrice3" style="bottom: 15.5%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
</div>
|
||||||
|
<div id="dayForm4" class="day-form">
|
||||||
|
<input type="text" class="input-field-14" name="dateTitle4" style="bottom: 68%; left: 13.4%"
|
||||||
|
placeholder="Datum">
|
||||||
|
<input type="checkbox" class="input-field-13" name="halal4" style="bottom: 62.2%; left: 22.1%">
|
||||||
|
<input type="text" class="input-field-12" name="meatMain4" style="bottom: 55%; left: 14%"
|
||||||
|
placeholder="Fleischgericht">
|
||||||
|
<input type="text" class="input-field-12" name="meatSide4" style="bottom: 50.2%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="meatPrice4" style="bottom: 40.4%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
<input type="text" class="input-field-12" name="veggiMain4" style="bottom: 25.6%; left: 14%"
|
||||||
|
placeholder="Veggie">
|
||||||
|
<input type="text" class="input-field-12" name="veggiSide4" style="bottom: 20.8%; left: 14%"
|
||||||
|
placeholder="Beilage">
|
||||||
|
<input type="text" class="input-field-10" name="veggiPrice4" style="bottom: 15.5%; left: 14%"
|
||||||
|
placeholder="Preis">
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bottom-controls">
|
<div class="bottom-controls">
|
||||||
<button onclick="savePage()">Seite speichern</button>
|
<button onclick="saveWeek()">Woche speichern</button>
|
||||||
<button onclick="generatePDF()">PDF generieren</button>
|
<button onclick="generatePDF()">PDF generieren</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -209,6 +287,11 @@
|
|||||||
year: '2-digit'
|
year: '2-digit'
|
||||||
});
|
});
|
||||||
document.getElementById('currentDay').textContent = `${dayName} ${dateStr}`;
|
document.getElementById('currentDay').textContent = `${dayName} ${dateStr}`;
|
||||||
|
|
||||||
|
// Show the correct form for the current day
|
||||||
|
document.querySelectorAll('.day-form').forEach((form, index) => {
|
||||||
|
form.classList.toggle('active', index === currentDayIndex);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function previousDay() {
|
function previousDay() {
|
||||||
@@ -239,6 +322,47 @@
|
|||||||
updateDayDisplay();
|
updateDayDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveWeek() {
|
||||||
|
const weekNumber = getWeekNumber(currentWeek);
|
||||||
|
const entries = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < 5; i++) {
|
||||||
|
const currentDate = new Date(currentWeek);
|
||||||
|
currentDate.setDate(currentDate.getDate() + i);
|
||||||
|
|
||||||
|
const entry = {
|
||||||
|
date: currentDate.toISOString().split('T')[0], // Reines Datum
|
||||||
|
dayIndex: i,
|
||||||
|
dateTitle: document.querySelector(`input[name="dateTitle${i}"]`).value,
|
||||||
|
meatMain: document.querySelector(`input[name="meatMain${i}"]`).value,
|
||||||
|
meatSide: document.querySelector(`input[name="meatSide${i}"]`).value,
|
||||||
|
halal: document.querySelector(`input[name="halal${i}"]`).checked,
|
||||||
|
meatPrice: document.querySelector(`input[name="meatPrice${i}"]`).value,
|
||||||
|
veggiMain: document.querySelector(`input[name="veggiMain${i}"]`).value,
|
||||||
|
veggiSide: document.querySelector(`input[name="veggiSide${i}"]`).value,
|
||||||
|
veggiPrice: document.querySelector(`input[name="veggiPrice${i}"]`).value
|
||||||
|
};
|
||||||
|
|
||||||
|
entries.push(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch('/save-week', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ weekNumber, entries })
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
alert(data.message);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.error('Error saving week:', error);
|
||||||
|
alert('Fehler beim Speichern der Woche');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the display when page loads
|
// Initialize the display when page loads
|
||||||
updateWeekDisplay();
|
updateWeekDisplay();
|
||||||
updateDayDisplay();
|
updateDayDisplay();
|
||||||
|
|||||||
Reference in New Issue
Block a user