<?php
session_start();
if (!isset($_SESSION['username'])) { header("location:login"); exit; }
include '../functions.php';

$id     = (int)($_POST['id'] ?? 0);
$status = trim($_POST['status'] ?? '');
$notes  = trim($_POST['admin_notes'] ?? '');

if ($id && in_array($status, ['Pending','Approved','Rejected'])) {
    $stmt = $conn->prepare("UPDATE kyc_submissions SET status = ?, admin_notes = ? WHERE id = ?");
    $stmt->bind_param('ssi', $status, $notes, $id);
    $stmt->execute();
    $stmt->close();
}

header("location:kyc-submissions?updated=1");
exit;
