query("SELECT u.id, u.username, u.email, r.name as role_name FROM users u LEFT JOIN roles r ON u.role_id = r.id ORDER BY u.username");
$users = $stmt->fetchAll();
?>
HR Employee Directory - FinMox
prepare("SELECT u.username, r.name as role_name FROM users u JOIN roles r ON u.role_id = r.id WHERE u.id = ?");
$stmt->execute([$userId]);
$user = $stmt->fetch();
if (!$user) {
exit('Employee not found.');
}
// Fetch tasks for the user
$task_stmt = $pdo->prepare("SELECT * FROM tasks WHERE assignee_id = ? ORDER BY due_date");
$task_stmt->execute([$userId]);
$tasks = $task_stmt->fetchAll();
$pending_tasks = array_filter($tasks, fn($task) => $task['status'] !== 'completed');
$completed_tasks = array_filter($tasks, fn($task) => $task['status'] === 'completed');
$total_tasks = count($tasks);
$progress = ($total_tasks > 0) ? (count($completed_tasks) / $total_tasks) * 100 : 0;
// The rest of the data is still static for now
$employee = [
'id' => $userId,
'name' => $user['username'],
'role' => $user['role_name'],
'manager' => 'Sarah Johnson', // Static for now
'startDate' => '2024-12-14', // Static for now
'progress' => round($progress),
'pending_tasks' => array_map(function($task) {
return ['name' => $task['task_name'], 'due' => $task['due_date'], 'description' => $task['description']];
}, $pending_tasks),
'completed_tasks' => array_map(function($task) {
return ['name' => $task['task_name'], 'completed_on' => $task['updated_at']];
}, $completed_tasks),
'activity_log' => [
['date' => 'Dec 16, 2024', 'event' => 'Magic link generated and sent to employee.'],
['date' => 'Dec 15, 2024', 'event' => 'Onboarding process initiated by HR.'],
]
];
?>
HR Employee Overview - FinMox
HR Employee Overview
Detailed onboarding progress for .
Onboarding Task Checklist
Employee Details
Role:
Manager:
Start Date: