2024-02-25 11:00:01 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="de">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" type="text/css" href="css/style.css">
|
|
|
|
<link rel="icon" href="img/favicon.png" type="image/x-icon">
|
|
|
|
<title>Materialverwaltung</title>
|
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
const form = document.getElementById('addMaterialForm');
|
|
|
|
form.addEventListener('submit', function(event) {
|
|
|
|
event.preventDefault(); // Verhindert das Standardverhalten des Formulars
|
|
|
|
|
|
|
|
// AJAX-Anfrage senden
|
|
|
|
const formData = new FormData(form);
|
|
|
|
const xhr = new XMLHttpRequest();
|
|
|
|
xhr.open('POST', 'add_material.php', true);
|
|
|
|
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
|
|
|
xhr.onload = function() {
|
|
|
|
if (xhr.status === 200) {
|
|
|
|
const response = JSON.parse(xhr.responseText);
|
|
|
|
if (response.success) {
|
|
|
|
const messageElement = document.createElement('p');
|
|
|
|
messageElement.textContent = response.message;
|
|
|
|
messageElement.style.color = 'green';
|
|
|
|
// Nachricht neben dem Button einfügen
|
|
|
|
form.parentNode.insertBefore(messageElement, form.nextSibling);
|
|
|
|
setTimeout(function() {
|
|
|
|
messageElement.remove();
|
|
|
|
}, 3000);
|
|
|
|
// Formular zurücksetzen
|
|
|
|
form.reset();
|
|
|
|
} else {
|
|
|
|
const errorMessage = document.createElement('p');
|
|
|
|
errorMessage.textContent = response.message;
|
|
|
|
errorMessage.style.color = 'red';
|
|
|
|
// Fehlermeldung einfügen
|
|
|
|
form.parentNode.insertBefore(errorMessage, form.nextSibling);
|
|
|
|
setTimeout(function() {
|
|
|
|
errorMessage.remove();
|
|
|
|
}, 3000);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
console.error('AJAX-Fehler beim Hinzufügen des Artikels.');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
xhr.onerror = function() {
|
|
|
|
console.error('AJAX-Fehler beim Hinzufügen des Artikels.');
|
|
|
|
};
|
|
|
|
xhr.send(formData);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<header class="header">
|
|
|
|
<div class="header-container">
|
|
|
|
<h1>Materialverwaltung</h1>
|
|
|
|
<nav>
|
|
|
|
<ul>
|
|
|
|
<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>
|
2024-02-28 19:01:30 +00:00
|
|
|
<li><a href="Material_chrome.zip">chrome Erweiterung</a></li>
|
2024-02-27 20:54:38 +00:00
|
|
|
<li><a href="backup_restore.php">Backup</a></li>
|
2024-02-25 11:00:01 +00:00
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
<div class="add-material-box">
|
|
|
|
<h2>Material hinzufügen</h2>
|
|
|
|
<form method="post" action="add_material.php" id="addMaterialForm">
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="item_name">Gegenstand/Medikament:</label>
|
|
|
|
<input type="text" id="item_name" name="item_name" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="manufacturer">Hersteller:</label>
|
|
|
|
<input type="text" id="manufacturer" name="manufacturer" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="location">Lagerort:</label>
|
|
|
|
<input type="text" id="location" name="location" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="amount_should">Anzahl soll:</label>
|
|
|
|
<input type="number" id="amount_should" name="amount_should" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="amount_is">Anzahl ist:</label>
|
|
|
|
<input type="number" id="amount_is" name="amount_is" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="expiration_date">Mindesthaltbarkeitsdatum:</label>
|
2024-02-25 15:27:27 +00:00
|
|
|
<input type="date" id="expiration_date" name="expiration_date">
|
2024-02-25 11:00:01 +00:00
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="barcode">Barcode/EAN:</label>
|
|
|
|
<input type="text" id="barcode" name="barcode" required>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
|
|
<label for="image">Bild (optional):</label>
|
|
|
|
<input type="file" id="image" name="image">
|
|
|
|
</div>
|
|
|
|
<div class="form-group" style="display: flex; justify-content: flex-end;">
|
|
|
|
<input type="submit" value="Hinzufügen" class="submit-button">
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<span class="watermark">© copyright 2024 by M_Viper</span>
|
|
|
|
</html>
|