query("SELECT id, name FROM departments ORDER BY name ASC")->fetchAll(); $positions = $pdo->query("SELECT id, name FROM positions ORDER BY name ASC")->fetchAll(); $q = trim($_GET['q'] ?? ''); $deptId = $_GET['dept_id'] ?? ''; $posId = $_GET['position_id'] ?? ''; $status = $_GET['status'] ?? ''; $where = []; $params = []; if ($q !== '') { $where[] = "(e.full_name LIKE :q OR e.employee_code LIKE :q OR e.email LIKE :q)"; $params[':q'] = '%' . $q . '%'; } if ($deptId !== '') { $where[] = "e.dept_id = :dept_id"; $params[':dept_id'] = $deptId; } if ($posId !== '') { $where[] = "e.position_id = :position_id"; $params[':position_id'] = $posId; } if ($status !== '') { $where[] = "e.status = :status"; $params[':status'] = $status; } $sql = " SELECT e.*, d.name AS dept_name, p.name AS position_name FROM employees e LEFT JOIN departments d ON d.id = e.dept_id LEFT JOIN positions p ON p.id = e.position_id "; if ($where) { $sql .= " WHERE " . implode(' AND ', $where); } $sql .= " ORDER BY e.full_name ASC"; $stmt = $pdo->prepare($sql); $stmt->execute($params); $employees = $stmt->fetchAll(); render_header('Data Pegawai', 'employees'); ?>

Data Pegawai

Kelola profil, status kerja, dan penempatan pegawai.

Tambah Pegawai
Reset
Daftar Pegawai hasil
Belum ada pegawai yang cocok dengan filter ini.
Nama Kode Departemen Jabatan Status
Detail