article_overview.php aktualisiert
This commit is contained in:
parent
fa9c6830a1
commit
0a7217e127
|
@ -38,8 +38,7 @@
|
|||
<li><a href="index.php">Home</a></li>
|
||||
<li><a href="add_material_form.php">Artikel hinzufügen</a></li>
|
||||
<li><a href="article_overview.php">Artikel Übersicht</a></li>
|
||||
<li><a href="Material_chrome.zip">chrome Erweiterung</a></li>
|
||||
<li><a href="backup_restore.php">Backup</a></li>
|
||||
<li><a href="backup_restore.php">Einstellungen</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -241,6 +240,38 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Gotify-Benachrichtigung senden
|
||||
function sendGotifyNotification(message) {
|
||||
var gotifyConfig = JSON.parse('<?php echo file_get_contents("config/gotify_config.json"); ?>');
|
||||
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");
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
|
|
Loading…
Reference in New Issue