<?php
require_once __DIR__ . '/db.php';
require_login();
require_roles(['Pengguna Biasa', 'Admin Audit', 'Pentadbir Sistem']);
require_department_access($conn, 'senarai_maklumat_audit', 'delete');

$auditId = (int) ($_GET['id'] ?? 0);
if ($auditId > 0) {
    $stmt = $conn->prepare("DELETE FROM audit_forms WHERE id = ?");
    $stmt->bind_param('i', $auditId);
    $stmt->execute();
}

header('Location: dashboard.php?success=audit_deleted');
exit();
