<?php
require_once __DIR__ . "/../../config/db.php";

$id = (int)($_POST['id'] ?? 0);

if (!$id) {
    echo json_encode(['success' => false, 'message' => 'ID invalide']);
    exit;
}

$stmt = $conn->prepare("UPDATE devis SET statut='valide' WHERE id=?");
$stmt->execute([$id]);

echo json_encode(['success' => true]);