// Set page title // Include header require_once '../includes/candidate_header.php'; // Get candidate data $user_id = $_SESSION['user_id'] ?? null; $candidate_id = $_SESSION['candidate_id'] ?? null; $profile_complete = $_SESSION['profile_complete'] ?? false; if (!$user_id) { header('Location: ../login.php'); exit; } $conn = getConnection(); // Get candidate details if not already in session if (!$candidate_id) { $sql = "SELECT cp.id as candidate_profile_id, cp.full_name, u.email, u.username, CASE WHEN cp.full_name IS NOT NULL AND cp.phone IS NOT NULL AND cp.address IS NOT NULL THEN true ELSE false END as profile_complete FROM users u LEFT JOIN candidate_profiles cp ON u.id = cp.user_id WHERE u.id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $user_id); $stmt->execute(); $result = $stmt->get_result(); if ($result && $result->num_rows > 0) { $row = $result->fetch_assoc(); $candidate_id = $user_id; $profile_complete = $row['profile_complete']; $_SESSION['candidate_id'] = $candidate_id; $_SESSION['profile_complete'] = $profile_complete; } } // Get candidate data and calculate profile completion $candidate = null; $profile_completion_percentage = 0; if ($candidate_id) { $sql = "SELECT cp.*, u.email, u.username, CASE WHEN cp.full_name IS NOT NULL THEN 20 ELSE 0 END + CASE WHEN cp.phone IS NOT NULL THEN 20 ELSE 0 END + CASE WHEN cp.address IS NOT NULL THEN 20 ELSE 0 END + CASE WHEN cp.education IS NOT NULL THEN 20 ELSE 0 END + CASE WHEN cp.resume_path IS NOT NULL THEN 20 ELSE 0 END as profile_completion_percentage FROM candidate_profiles cp JOIN users u ON cp.user_id = u.id WHERE cp.user_id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $candidate_id); $stmt->execute(); $result = $stmt->get_result(); if ($result && $result->num_rows > 0) { $candidate = $result->fetch_assoc(); $profile_completion_percentage = $candidate['profile_completion_percentage'] ?? 0; } } // Get application statistics $stats = [ 'total_applications' => 0, 'pending_applications' => 0, 'shortlisted_applications' => 0, 'interview_applications' => 0, 'offered_applications' => 0, 'rejected_applications' => 0 ]; if ($candidate_id) { $sql = "SELECT COUNT(*) as total_applications, COUNT(CASE WHEN status = 'pending' THEN 1 END) as pending_applications, COUNT(CASE WHEN status = 'shortlisted' THEN 1 END) as shortlisted_applications, COUNT(CASE WHEN status = 'interview' THEN 1 END) as interview_applications, COUNT(CASE WHEN status = 'offered' THEN 1 END) as offered_applications, COUNT(CASE WHEN status = 'rejected' THEN 1 END) as rejected_applications FROM job_applications WHERE user_id = ?"; $stmt = $conn->prepare($sql); $stmt->bind_param("i", $candidate_id); $stmt->execute(); $result = $stmt->get_result(); if ($result && $result->num_rows > 0) { $stats = $result->fetch_assoc(); } } ?>
Portal karir untuk mengikuti progress lamaran dan mengelola profil Anda. Pantau status lamaran, jadwal tes, dan interview melalui dashboard ini.
Cari Lowongan
Profil Anda baru terisi %. Lengkapi profil untuk meningkatkan peluang diterima.