maintaince module

This commit is contained in:
2026-08-12 21:29:55 +03:00
parent 41c4838dab
commit 55d83c12b0
51 changed files with 8200 additions and 48 deletions
+9 -4
View File
@@ -17,7 +17,7 @@ try {
$toolType = trim($_POST['tool_type'] ?? '');
$manufacturer = trim($_POST['manufacturer'] ?? '');
$description = trim($_POST['description'] ?? '');
$isActive = isset($_POST['is_active']) ? (int)$_POST['is_active'] : 1;
$status = (string)($_POST['status'] ?? 'active');
if ($id <= 0) {
echo json_encode(['success' => false, 'message' => 'Invalid ID.']);
@@ -29,14 +29,19 @@ try {
exit;
}
$sql = "UPDATE production_tools
if (!in_array($status, ['active', 'out_of_service', 'decommissioned'], true)) {
$status = 'active';
}
// production_tools is now inv_equipment (see manutenzioni/sql)
$sql = "UPDATE inv_equipment
SET name = :name,
registration_number = :registration_number,
serial_number = :serial_number,
tool_type = :tool_type,
manufacturer = :manufacturer,
description = :description,
is_active = :is_active
status = :status
WHERE id = :id";
$stmt = $pdo->prepare($sql);
@@ -47,7 +52,7 @@ try {
'tool_type' => $toolType ?: null,
'manufacturer' => $manufacturer ?: null,
'description' => $description ?: null,
'is_active' => $isActive,
'status' => $status,
'id' => $id
]);