feat: Implement floors, locations, and racks management

- Added list, edit, and save functionalities for floors, locations, and racks.
- Enhanced UI with search and filter options for better usability.
- Implemented SVG upload for floor plans in the floors module.
- Added validation for required fields in the save processes.
- Improved navigation in the header to reflect new modules.
- Styled forms and tables for a consistent look and feel across modules.
This commit is contained in:
2026-02-11 14:34:07 +01:00
parent 2f341bff9f
commit 0d3c6e1ae7
26 changed files with 3753 additions and 1045 deletions

View File

@@ -0,0 +1,44 @@
<?php
/**
* app/modules/locations/save.php
*/
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
header('Location: ?module=locations&action=list');
exit;
}
$locationId = (int)($_POST['id'] ?? 0);
$name = trim($_POST['name'] ?? '');
$comment = trim($_POST['comment'] ?? '');
$errors = [];
if (empty($name)) {
$errors[] = "Name ist erforderlich";
}
if (!empty($errors)) {
$_SESSION['error'] = implode(', ', $errors);
$redirectUrl = $locationId ? "?module=locations&action=edit&id=$locationId" : "?module=locations&action=edit";
header("Location: $redirectUrl");
exit;
}
if ($locationId > 0) {
$sql->set(
"UPDATE locations SET name = ?, comment = ? WHERE id = ?",
"ssi",
[$name, $comment, $locationId]
);
} else {
$sql->set(
"INSERT INTO locations (name, comment) VALUES (?, ?)",
"ss",
[$name, $comment]
);
}
$_SESSION['success'] = "Standort gespeichert";
header('Location: ?module=locations&action=list');
exit;