<?php
require_once __DIR__ . '/../auth/verifica.php';
require_once __DIR__ . '/../config/conexao.php';
$id = intval($_GET['id'] ?? 0);
if ($id > 0) {
    $stmt = $pdo->prepare("SELECT status FROM formas_pagamento WHERE id = :id");
    $stmt->execute(['id' => $id]);
    $f = $stmt->fetch();
    if ($f) {
        $novo = $f['status'] === 'Ativo' ? 'Inativo' : 'Ativo';
        $pdo->prepare("UPDATE formas_pagamento SET status = :s WHERE id = :id")->execute(['s' => $novo, 'id' => $id]);
    }
}
header("Location: formas_pagamento.php"); exit;
