From 5c29ff60411e54f8254ba33f2e31b688925b0b0b Mon Sep 17 00:00:00 2001 From: M_Viper Date: Sun, 25 Feb 2024 13:31:42 +0000 Subject: [PATCH] article_overview.php aktualisiert --- article_overview.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/article_overview.php b/article_overview.php index 35d7db6..a7ed913 100644 --- a/article_overview.php +++ b/article_overview.php @@ -72,7 +72,11 @@ // Wenn nach einem Artikel gesucht wird if(isset($_GET['search']) && !empty($_GET['search'])){ $search = $_GET['search']; - $sql .= " WHERE item_name LIKE '%" . $search . "%' OR manufacturer LIKE '%" . $search . "%' OR location LIKE '%" . $search . "%' OR barcode LIKE '%" . $search . "%'"; + $sql .= " WHERE + item_name LIKE '%" . $search . "%' OR + manufacturer LIKE '%" . $search . "%' OR + location LIKE '%" . $search . "%' OR + barcode LIKE '%" . $search . "%'"; } $result = $conn->query($sql); @@ -80,12 +84,12 @@ if ($result->num_rows > 0) { // Daten ausgeben while($row = $result->fetch_assoc()) { - $expiration_date = strtotime($row["expiration_date"]); - $ten_days_before_expiry = strtotime("-10 days", $expiration_date); // 10 Tage vor dem Ablaufdatum - $current_date = strtotime(date("Y-m-d")); // Aktuelles Datum + $expiration_date = date("d.m.Y", strtotime($row["expiration_date"])); + $ten_days_before_expiry = date("d.m.Y", strtotime("-10 days", strtotime($row["expiration_date"]))); // 10 Tage vor dem Ablaufdatum + $current_date = date("d.m.Y"); // Aktuelles Datum echo "= $ten_days_before_expiry && $current_date <= $expiration_date) { + if (strtotime($current_date) >= strtotime($ten_days_before_expiry) && strtotime($current_date) <= strtotime($expiration_date)) { echo " class='expiring'"; } echo ">"; @@ -94,7 +98,7 @@ echo "" . $row["location"] . ""; echo "" . $row["amount_should"] . ""; echo "" . $row["amount_is"] . ""; - echo "" . $row["expiration_date"] . ""; + echo "" . $expiration_date . ""; echo "" . $row["barcode"] . ""; echo ""; if (!empty($row["image"])) { @@ -103,7 +107,7 @@ echo "Standardbild"; } echo ""; - echo "Bearbeiten   |   Löschen"; + echo "Bearbeiten   |   Löschen"; echo ""; // Bearbeitungsformular für jedes Element einfügen @@ -161,6 +165,11 @@ }; xhr.send(formData); } + + // JavaScript-Funktion, um eine Bestätigungsbox anzuzeigen, bevor der Artikel gelöscht wird + function confirmDelete() { + return confirm("Möchten Sie diesen Artikel wirklich löschen?"); + } © copyright 2024 by M_Viper