<?php
require_once __DIR__.'/../../config/functions.php';
requireLogin();

$unit_id = intval($_GET['unit_id'] ?? 0);
if (!$unit_id) jsonResponse(true, '', []);

$stmt = $pdo->prepare("SELECT id, nama_subunit FROM subunit WHERE unit_id = ? AND status = 1 ORDER BY nama_subunit");
$stmt->execute([$unit_id]);
jsonResponse(true, '', $stmt->fetchAll());
