<?php
session_start();

include("../includes/auth.php");
include("../config/db.php");

if(
    !isset($_POST['contract_id']) ||
    !isset($_POST['status'])
){
    die("Datos inválidos");
}

$contract_id =
intval($_POST['contract_id']);

$status =
trim($_POST['status']);

$stmt = $conn->prepare("
UPDATE contracts
SET status = ?
WHERE id = ?
");

$stmt->bind_param(
    "si",
    $status,
    $contract_id
);

$stmt->execute();

header("
Location: /pages/contracts.php
");

exit;
?>