Logo-Upload: Bild hochladen/loeschen via Settings, Einbindung in PDF mit Fallback auf Text
This commit is contained in:
@@ -139,6 +139,41 @@ function showNotification(msg) {
|
||||
setTimeout(() => { container.style.display = 'none'; }, 2500);
|
||||
}
|
||||
|
||||
/** Logo hochladen via AJAX. */
|
||||
async function uploadLogo() {
|
||||
const input = document.getElementById('logo-upload');
|
||||
if (!input.files || !input.files[0]) {
|
||||
showNotification('Bitte eine Datei auswaehlen');
|
||||
return;
|
||||
}
|
||||
const formData = new FormData();
|
||||
formData.append('logo', input.files[0]);
|
||||
try {
|
||||
const res = await fetch('/upload_logo', { method: 'POST', body: formData });
|
||||
const data = await res.json();
|
||||
if (data.status === 'ok') {
|
||||
showNotification('Logo gespeichert!');
|
||||
setTimeout(() => location.reload(), 800);
|
||||
}
|
||||
} catch (e) {
|
||||
showNotification('Fehler beim Hochladen');
|
||||
}
|
||||
}
|
||||
|
||||
/** Logo loeschen. */
|
||||
async function deleteLogo() {
|
||||
try {
|
||||
const res = await fetch('/delete_logo', { method: 'POST' });
|
||||
const data = await res.json();
|
||||
if (data.status === 'ok') {
|
||||
showNotification('Logo entfernt');
|
||||
setTimeout(() => location.reload(), 800);
|
||||
}
|
||||
} catch (e) {
|
||||
showNotification('Fehler beim Loeschen');
|
||||
}
|
||||
}
|
||||
|
||||
/** Initiale Berechnung beim Seitenladen. */
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
recalculate();
|
||||
|
||||
Reference in New Issue
Block a user