<?php
require_once __DIR__.'/../../config/functions.php';
requireLogin();
$id=intval($_GET['id']??0);
$stmt=$pdo->prepare("SELECT p.*,u.warna FROM pegawai p LEFT JOIN unit u ON p.unit_id=u.id WHERE p.id=?");
$stmt->execute([$id]);$p=$stmt->fetch();
if(!$p)jsonResponse(false,'Rekod tidak dijumpai.');
$p['gambar_url']=getPegawaiImage($p['gambar']);
jsonResponse(true,'',$p);
