<?php
require_once 'config/config.php';

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $id = intval($_POST['id']);
    $new_date = $_POST['followup_date'];

    $stmt = $conn->prepare("UPDATE customers_followup SET followed_up = 0, closed_date = NULL, followup_date = ? WHERE id = ?");
    $stmt->bind_param("si", $new_date, $id);
    $success = $stmt->execute();
    
    echo json_encode(['success' => $success]);
}
