115 lines
4.5 KiB
PHP
115 lines
4.5 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['worker_id'])) {
|
|
header("Location: login.php");
|
|
exit;
|
|
}
|
|
|
|
require_once 'db/config.php';
|
|
|
|
$worker_id = $_SESSION['worker_id'];
|
|
|
|
$sql = "SELECT j.id, j.title, j.budget, ja.applied_at, ja.status
|
|
FROM job_applications ja
|
|
JOIN jobs j ON ja.job_id = j.id
|
|
WHERE ja.worker_id = ?
|
|
ORDER BY ja.applied_at DESC";
|
|
|
|
$stmt = db()->prepare($sql);
|
|
$stmt->execute([$worker_id]);
|
|
$applications = $stmt->fetchAll();
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>My Dashboard - SkillRunner</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body>
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="index.php">SkillRunner</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="jobs.php">Find Work</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="post-job.php">Post a Job</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="dashboard.php">Dashboard</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="logout.php">Logout</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main class="container mt-5">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h1>Welcome, <?php echo htmlspecialchars($_SESSION['worker_name']); ?>!</h1>
|
|
<a href="jobs.php" class="btn btn-primary">Browse More Jobs</a>
|
|
</div>
|
|
|
|
<h2 class="mb-3">My Job Applications</h2>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<?php if (empty($applications)): ?>
|
|
<p class="text-center">You have not applied for any jobs yet.</p>
|
|
<?php else: ?>
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle">
|
|
<thead class="table-light">
|
|
<tr>
|
|
<th>Job Title</th>
|
|
<th>Budget</th>
|
|
<th>Date Applied</th>
|
|
<th>Status</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($applications as $app): ?>
|
|
<tr>
|
|
<td><?php echo htmlspecialchars($app['title']); ?></td>
|
|
<td>$<?php echo htmlspecialchars(number_format($app['budget'], 2)); ?></td>
|
|
<td><?php echo htmlspecialchars(date('F j, Y', strtotime($app['applied_at']))); ?></td>
|
|
<td>
|
|
<span class="badge bg-<?php echo $app['status'] == 'pending' ? 'warning' : 'success'; ?>">
|
|
<?php echo htmlspecialchars(ucfirst($app['status'])); ?>
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<a href="job-detail.php?id=<?php echo $app['id']; ?>" class="btn btn-sm btn-info">View Job</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="text-center mt-5 py-3 bg-light">
|
|
<p>© <?php echo date("Y"); ?> SkillRunner. All rights reserved.</p>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
|
</body>
|
|
</html>
|