diff --git a/article_overview.php b/article_overview.php
index 48783b2..5d15bdf 100644
--- a/article_overview.php
+++ b/article_overview.php
@@ -38,8 +38,7 @@
Home
Artikel hinzufügen
Artikel Übersicht
- chrome Erweiterung
- Backup
+ Einstellungen
@@ -240,6 +239,38 @@
createNotification("Ablaufdatum nahe", options);
}
}
+
+ // Gotify-Benachrichtigung senden
+ function sendGotifyNotification(message) {
+ var gotifyConfig = JSON.parse('');
+ var gotifyUrl = gotifyConfig.gotify_url;
+ var appToken = gotifyConfig.app_token;
+
+ var xhr = new XMLHttpRequest();
+ xhr.open("POST", gotifyUrl + "/message?token=" + appToken, true);
+ xhr.setRequestHeader('Content-Type', 'application/json');
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState === 4 && xhr.status === 200) {
+ console.log("Gotify notification sent successfully.");
+ }
+ };
+
+ var data = JSON.stringify({ message: message });
+ xhr.send(data);
+ }
+
+ // Gotify-Benachrichtigung senden, wenn das Ablaufdatum innerhalb der Benachrichtigungstage liegt
+ function checkExpiryDate(expirationDate, notificationDays, itemName) {
+ var tenDaysBeforeExpiry = new Date(expirationDate);
+ tenDaysBeforeExpiry.setDate(tenDaysBeforeExpiry.getDate() - notificationDays);
+ var currentDate = new Date();
+
+ if (currentDate >= tenDaysBeforeExpiry && currentDate <= new Date(expirationDate)) {
+ var message = "Das Ablaufdatum von " + itemName + " liegt in " + notificationDays + " Tagen an.";
+ sendGotifyNotification(message);
+ }
+ }
// Aufrufen der Funktion für jedes Element in der Tabelle
var rows = document.getElementsByClassName("expiring");