article_overview.php aktualisiert
This commit is contained in:
parent
59bdeb6b6e
commit
5c29ff6041
|
@ -72,7 +72,11 @@
|
||||||
// Wenn nach einem Artikel gesucht wird
|
// Wenn nach einem Artikel gesucht wird
|
||||||
if(isset($_GET['search']) && !empty($_GET['search'])){
|
if(isset($_GET['search']) && !empty($_GET['search'])){
|
||||||
$search = $_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);
|
$result = $conn->query($sql);
|
||||||
|
@ -80,12 +84,12 @@
|
||||||
if ($result->num_rows > 0) {
|
if ($result->num_rows > 0) {
|
||||||
// Daten ausgeben
|
// Daten ausgeben
|
||||||
while($row = $result->fetch_assoc()) {
|
while($row = $result->fetch_assoc()) {
|
||||||
$expiration_date = strtotime($row["expiration_date"]);
|
$expiration_date = date("d.m.Y", strtotime($row["expiration_date"]));
|
||||||
$ten_days_before_expiry = strtotime("-10 days", $expiration_date); // 10 Tage vor dem Ablaufdatum
|
$ten_days_before_expiry = date("d.m.Y", strtotime("-10 days", strtotime($row["expiration_date"]))); // 10 Tage vor dem Ablaufdatum
|
||||||
$current_date = strtotime(date("Y-m-d")); // Aktuelles Datum
|
$current_date = date("d.m.Y"); // Aktuelles Datum
|
||||||
|
|
||||||
echo "<tr";
|
echo "<tr";
|
||||||
if ($current_date >= $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 " class='expiring'";
|
||||||
}
|
}
|
||||||
echo ">";
|
echo ">";
|
||||||
|
@ -94,7 +98,7 @@
|
||||||
echo "<td>" . $row["location"] . "</td>";
|
echo "<td>" . $row["location"] . "</td>";
|
||||||
echo "<td>" . $row["amount_should"] . "</td>";
|
echo "<td>" . $row["amount_should"] . "</td>";
|
||||||
echo "<td>" . $row["amount_is"] . "</td>";
|
echo "<td>" . $row["amount_is"] . "</td>";
|
||||||
echo "<td>" . $row["expiration_date"] . "</td>";
|
echo "<td>" . $expiration_date . "</td>";
|
||||||
echo "<td>" . $row["barcode"] . "</td>";
|
echo "<td>" . $row["barcode"] . "</td>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
if (!empty($row["image"])) {
|
if (!empty($row["image"])) {
|
||||||
|
@ -103,7 +107,7 @@
|
||||||
echo "<img src='img/free.png' alt='Standardbild' style='width: 50px; height: 50px;' onclick='toggleEditForm(" . $row["id"] . ")'>";
|
echo "<img src='img/free.png' alt='Standardbild' style='width: 50px; height: 50px;' onclick='toggleEditForm(" . $row["id"] . ")'>";
|
||||||
}
|
}
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "<td><img src='img/bearbeiten.png' alt='Bearbeiten' style='width: 20px; height: 20px;' onclick='toggleEditForm(" . $row["id"] . ")'> | <a href='remove_article.php?id=" . $row["id"] . "'><img src='img/delete.png' alt='Löschen' style='width: 20px; height: 20px;' ></a></td>";
|
echo "<td><img src='img/bearbeiten.png' alt='Bearbeiten' style='width: 20px; height: 20px;' onclick='toggleEditForm(" . $row["id"] . ")'> | <a href='remove_article.php?id=" . $row["id"] . "' onclick='return confirmDelete();'><img src='img/delete.png' alt='Löschen' style='width: 20px; height: 20px;' ></a></td>";
|
||||||
|
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
// Bearbeitungsformular für jedes Element einfügen
|
// Bearbeitungsformular für jedes Element einfügen
|
||||||
|
@ -161,6 +165,11 @@
|
||||||
};
|
};
|
||||||
xhr.send(formData);
|
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?");
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<span class="watermark">© copyright 2024 by M_Viper</span>
|
<span class="watermark">© copyright 2024 by M_Viper</span>
|
||||||
|
|
Loading…
Reference in New Issue