feat: implement package 1 session and validation feedback
- add session validation_errors bootstrap initialization - render global flash + validation messages in header - remove footer alert-based flash handling - persist structured validation errors across save handlers - mark NEXT_STEPS package 1 tasks as done
This commit is contained in:
@@ -18,6 +18,15 @@ $comment = trim((string)($_POST['comment'] ?? ''));
|
||||
$rawPolygon = trim((string)($_POST['polygon_points'] ?? ''));
|
||||
|
||||
if ($name === '' || $floorId <= 0) {
|
||||
$errors = [];
|
||||
if ($name === '') {
|
||||
$errors[] = 'Name ist erforderlich';
|
||||
}
|
||||
if ($floorId <= 0) {
|
||||
$errors[] = 'Stockwerk ist erforderlich';
|
||||
}
|
||||
$_SESSION['error'] = implode(', ', $errors);
|
||||
$_SESSION['validation_errors'] = $errors;
|
||||
$redirect = $roomId > 0 ? "?module=rooms&action=edit&id=$roomId" : "?module=rooms&action=edit&floor_id=$floorId";
|
||||
header("Location: $redirect");
|
||||
exit;
|
||||
@@ -100,6 +109,7 @@ if (roomsHasPolygonColumn($sql)) {
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['success'] = $roomId > 0 ? 'Raum gespeichert' : 'Raum erstellt';
|
||||
header('Location: ?module=locations&action=list');
|
||||
exit;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user