fixed saving and modifying parts

This commit is contained in:
2025-08-25 19:39:53 +04:00
parent a87423d879
commit 1bda30e957
2 changed files with 8 additions and 7 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ if ($partDescription) {
':part_description' => $partDescription,
':mix' => $mix
]);
echo json_encode(['success' => true, 'message' => 'Parte aggiornata con successo']);
echo json_encode(['success' => true, 'part_id' => $partId, 'part_number'=>$partNumber, 'message' => 'Parte aggiornata con successo']);
} else {
// INSERT თუ ახალია
$stmt = $pdo->prepare("INSERT INTO identification_parts
@@ -50,7 +50,7 @@ if ($partDescription) {
':mix' => $mix
]);
$newId = $pdo->lastInsertId();
echo json_encode(['success' => true, 'message' => 'Parte salvata con successo', 'part_id' => $newId]);
echo json_encode(['success' => true, 'part_id' => $newId, 'part_number'=>$partNumber, 'message' => 'Parte salvata con successo']);
}
} catch (PDOException $e) {
echo json_encode(['success' => false, 'message' => 'Errore nel salvataggio: ' . $e->getMessage()]);