<?php
header("Content-Type: application/json");
require_once "../../config.php";

$id = $_POST['id'] ?? '';
$status = $_POST['status'] ?? '';

if ($id && $status !== '') {
    $stmt = $dbh->prepare("UPDATE tblstaff SET Status = :status WHERE StaffId = :id");
    $stmt->bindParam(':status', $status);
    $stmt->bindParam(':id', $id);
    $stmt->execute();

    echo json_encode(["success" => true]);
} else {
    echo json_encode(["success" => false, "message" => "Invalid data"]);
}
