-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallocate_team_leader.php
More file actions
87 lines (75 loc) · 3.59 KB
/
Copy pathallocate_team_leader.php
File metadata and controls
87 lines (75 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
session_start();
$manager = $_SESSION['user']['role'] ;
if (!isset($_SESSION['user']) || $manager !== 'Manager') {
header('Location: login.php');
exit();
}
require 'db.php.inc';
if (isset($_GET['project_id'])) {
$projectId = $_GET['project_id'];
} else {
die('Error: project_id is missing.');
}
$stmt = $pdo->prepare("SELECT * FROM projects WHERE project_id = :project_id");
$stmt->execute([':project_id' => $projectId]);
$project = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$project) {
die('Error: Project not found.');
}
$leadersStmt = $pdo->prepare("SELECT user_id, full_name FROM users WHERE role = 'Project Leader'");
$leadersStmt->execute();
$leaders = $leadersStmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Allocate Team Leader</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'header.php'; ?>
<main>
<?php include 'sidebar.php'; ?>
<section class="form-section">
<h2>Allocate Team Leader</h2>
<?php if (isset($_GET['success'])): ?>
<div class="success">Team Leader successfully allocated to Project <?= $_GET['project_id'] ?>.</div>
<?php endif; ?>
<form action="allocate_team_leader_process.php" method="POST">
<fieldset>
<legend>Project Details</legend>
<label for="project_id">Project ID</label>
<input type="text" id="project_id" name="project_id" value="<?= ($project['project_id']) ?>" readonly>
<label for="project_title">Project Title</label>
<input type="text" id="project_title" name="project_title" value="<?= ($project['title']) ?>" readonly>
<label for="project_description">Project Description</label>
<textarea id="project_description" name="project_description" readonly><?= ($project['description']) ?></textarea>
<label for="customer_name">Customer Name</label>
<input type="text" id="customer_name" name="customer_name" value="<?= ($project['customer_name']) ?>" readonly>
<label for="total_budget">Total Budget</label>
<input type="number" id="total_budget" name="total_budget" value="<?= ($project['budget']) ?>" readonly>
<label for="start_date">Start Date</label>
<input type="date" id="start_date" name="start_date" value="<?= ($project['start_date']) ?>" readonly>
<label for="end_date">End Date</label>
<input type="date" id="end_date" name="end_date" value="<?= ($project['end_date']) ?>" readonly>
</fieldset>
<fieldset>
<legend>Select Team Leader</legend>
<label for="team_leader">Team Leader</label>
<select id="team_leader" name="team_leader" required>
<option value="">-- Select Team Leader --</option>
<?php foreach ($leaders as $leader): ?>
<option value="<?= $leader['user_id'] ?>"><?= $leader['full_name'] ?> - <?= $leader['user_id'] ?></option>
<?php endforeach; ?>
</select>
</fieldset>
<button type="submit" class="btn-primary">Confirm Allocation</button>
</form>
</section>
</main>
<?php include 'footer.php'; ?>
</body>
</html>