<?php
include "../config/koneksi.php";
include "../middleware/auth.php";

sikompro_require_role('teknisi');

$id = (int) ($_POST['id'] ?? 0);

if ($id <= 0) {
    header("Location: teknisi.php?pesan=invalid");
    exit;
}

mysqli_query($conn,"
    UPDATE komplain 
    SET status='selesai_teknisi',
        tanggal_update=NOW()
    WHERE id='$id' AND teknisi_id='" . (int) $_SESSION['user_id'] . "'
");

header("Location: teknisi.php?pesan=terkirim");
