<?php
include("conex.php");

if (isset($_POST['idsucursal'])) {
    $idsucursal = $_POST['idsucursal'];

    // Actualizar la condición a 0 (deshabilitar)
    $sql = "UPDATE tbr_sucursal SET condicion = 0 WHERE idsucursal = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param('i', $idsucursal);
    $stmt->execute();

    if ($stmt->affected_rows > 0) {
        echo json_encode(['success' => true]);
    } else {
        echo json_encode(['success' => false]);
    }
} else {
    echo json_encode(['success' => false]);
}
?>
