order cat
Deploy HouseHub / deploy (push) Successful in 1s

This commit is contained in:
2026-06-21 11:25:17 +02:00
parent 041411b070
commit 506cd64a44
4 changed files with 117 additions and 2 deletions
+13
View File
@@ -168,6 +168,19 @@ try {
exit;
}
// SAUVEGARDE DU NOUVEL ORDRE DES CATÉGORIES
if (isset($_POST['action']) && $_POST['action'] === 'save_categories_order') {
$ids = json_decode($_POST['order'], true);
if (is_array($ids)) {
$stmt = $pdo->prepare("UPDATE pf_budget_categories SET sort_order = ? WHERE id = ?");
foreach ($ids as $index => $id) {
$stmt->execute([$index, (int)$id]);
}
}
echo json_encode(['success' => true]);
exit;
}
throw new Exception("Action API inconnue.");
} catch (Exception $e) {