feat: image support

also translated some strings back into english
This commit is contained in:
2025-06-02 04:37:54 +02:00
parent f7583738d7
commit 9de5c85120
17 changed files with 125 additions and 60 deletions

View File

@@ -17,6 +17,7 @@ function modifyEvent() {
const title = document.getElementById('title').value;
const location = document.getElementById('location').value;
const description = document.getElementById('description').value;
const imageURL = document.getElementById('imageURL').value;
const eventDateRaw = document.getElementById('eventDate').value;
// Walidacja prostych pól
if (!title || !location || !eventDateRaw) {
@@ -27,6 +28,7 @@ function modifyEvent() {
const payload = {
title,
location,
imageURL,
description,
eventDate,
};
@@ -40,12 +42,12 @@ function modifyEvent() {
const errorText = yield response.text();
throw new Error(errorText);
}
alert("Wydarzenie zmodyfikowane!");
alert("Event modified!");
window.location.href = "/"; // Przekierowanie do strony głównej
}
catch (error) {
console.error("Błąd podczas modyfikowania:", error);
alert("Nie udało się zmodyfikować wydarzenia: " + error);
console.error("Error occurred while trying to modify event:", error);
alert("Couldn't modify event, an error occurred: " + error);
}
});
}
@@ -77,9 +79,10 @@ document.addEventListener("DOMContentLoaded", () => __awaiter(void 0, void 0, vo
const locationInput = document.getElementById('location');
const descriptionInput = document.getElementById('description');
const dateInput = document.getElementById('eventDate');
const imageInput = document.getElementById('imageURL');
var ev = yield getEvent(eventId);
if (ev === null) {
container.innerHTML = "<p class='text-muted'>Brak wydarzeń do wyświetlenia.</p>";
container.innerHTML = "<p class='text-muted'>Failed to load event data.</p>";
return;
}
else {
@@ -87,6 +90,7 @@ document.addEventListener("DOMContentLoaded", () => __awaiter(void 0, void 0, vo
locationInput.value = ev.location || '';
descriptionInput.value = ev.description || '';
dateInput.value = ev.eventDate.slice(0, 16) || '';
imageInput.value = ev.imageURL || '';
}
}
catch (err) {