You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
138 lines
5.8 KiB
138 lines
5.8 KiB
<?php
|
|
session_start();
|
|
|
|
|
|
// Check if the user is logged in
|
|
if (!isset($_SESSION['email'])) {
|
|
header("Location: login.php");
|
|
exit();
|
|
}
|
|
|
|
include 'connect.php';
|
|
|
|
// Check if the logged-in user is a job seeker
|
|
$is_job_seeker = ($_SESSION['user_type'] === 'Job seeker');
|
|
if (!$is_job_seeker) {
|
|
echo "Access denied. Only job seekers can view applications.";
|
|
exit();
|
|
}
|
|
|
|
// Get all applications for the current seeker
|
|
$seeker_id = $_SESSION['seeker_id'];
|
|
$sql = "SELECT a.*, j.job_title, j.location, j.salary, j.posted_date
|
|
FROM applications a
|
|
JOIN job_postings j ON a.job_id = j.job_id
|
|
WHERE a.seeker_id = ?";
|
|
$stmt = $conn->prepare($sql);
|
|
$stmt->bind_param("i", $seeker_id);
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="en" data-theme="light">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>My Job Applications</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.7.2/dist/full.min.css" rel="stylesheet" type="text/css" />
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
</head>
|
|
<body class="min-h-screen flex flex-col bg-white">
|
|
<?php include 'navbar.php';?>
|
|
|
|
<main class="flex-grow container mx-auto px-4 py-8">
|
|
<!-- Breadcrumb -->
|
|
<div class="text-sm breadcrumbs mb-6">
|
|
<ul>
|
|
<li><a href="index.php">Home</a></li>
|
|
<li class="text-primary">My Applications</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="bg-white rounded-lg shadow-md p-6">
|
|
<h1 class="text-3xl font-bold mb-6 text-gray-800">My Job Applications</h1>
|
|
|
|
<?php if ($result->num_rows > 0): ?>
|
|
<div class="overflow-x-auto">
|
|
<table class="table w-full">
|
|
<thead>
|
|
<tr class="bg-gray-50">
|
|
<th class="text-left px-6 py-3 text-gray-600">Job Title</th>
|
|
<th class="text-left px-6 py-3 text-gray-600">Location</th>
|
|
<th class="text-left px-6 py-3 text-gray-600">Salary</th>
|
|
<th class="text-left px-6 py-3 text-gray-600">Application Date</th>
|
|
<th class="text-left px-6 py-3 text-gray-600">Status</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-200">
|
|
<?php while ($application = $result->fetch_assoc()): ?>
|
|
<tr class="hover:bg-gray-50 transition-colors">
|
|
<td class="px-6 py-4">
|
|
<div class="text-sm font-medium text-gray-900">
|
|
<?= htmlspecialchars($application['job_title']) ?>
|
|
</div>
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-600">
|
|
<?= htmlspecialchars($application['location']) ?>
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-600">
|
|
<?= htmlspecialchars($application['salary']) ?>
|
|
</td>
|
|
<td class="px-6 py-4 text-sm text-gray-600">
|
|
<?= date('F j, Y', strtotime($application['application_date'])) ?>
|
|
</td>
|
|
<td class="px-6 py-4">
|
|
<?php
|
|
$statusClass = match($application['status']) {
|
|
'Pending' => 'bg-yellow-100 text-yellow-800',
|
|
'Accepted' => 'bg-green-100 text-green-800',
|
|
default => 'bg-red-100 text-red-800'
|
|
};
|
|
?>
|
|
<span class="px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full <?= $statusClass ?>">
|
|
<?= htmlspecialchars($application['status']) ?>
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
<?php endwhile; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="bg-blue-50 border-l-4 border-blue-400 p-4 mb-4">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0">
|
|
<svg class="h-5 w-5 text-blue-400" viewBox="0 0 20 20" fill="currentColor">
|
|
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
|
|
</svg>
|
|
</div>
|
|
<div class="ml-3">
|
|
<p class="text-sm text-blue-700">
|
|
You haven't applied to any jobs yet.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</main>
|
|
|
|
<?php include 'footer.php';?>
|
|
|
|
|
|
<style>
|
|
body {
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
main {
|
|
flex: 1 0 auto;
|
|
}
|
|
footer {
|
|
flex-shrink: 0;
|
|
}
|
|
</style>
|
|
</body>
|
|
</html>
|