-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathallocate_member.php
More file actions
85 lines (84 loc) · 3.38 KB
/
Copy pathallocate_member.php
File metadata and controls
85 lines (84 loc) · 3.38 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
<?php
session_start();
if (!isset($_SESSION['user']) || $_SESSION['user']['role'] !== 'Project Leader') {
header('Location: login.php');
exit();
}
require 'db.php.inc';
if (!isset($_GET['task_id'])) {
die("Error: Task ID not specified.");
}
$taskId = $_GET['task_id'];
try {
$stmt = $pdo->prepare("
SELECT task_id, task_name, start_date
FROM tasks
WHERE task_id = :task_id");
$stmt->execute([':task_id' => $taskId]);
$task = $stmt->fetch(PDO::FETCH_ASSOC);
$teamStmt = $pdo->query("
SELECT user_id, full_name
FROM users
WHERE role = 'Team Member'
");
$teamMembers = $teamStmt->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Database error: " . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Allocate Team Member</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<?php include 'header.php'; ?>
<main>
<?php include 'sidebar.php'; ?>
<section>
<h2>Allocate Team Member</h2>
<?php if (isset($_GET['success'])): ?>
<div class="success">Team Member successfully assigned to Task <?= $task['task_id'] ?>.</div>
<?php endif; ?>
<?php if (isset($_GET['error'])): ?>
<div class="error"><?=$_GET['error'] ?></div>
<?php endif; ?>
<form action="allocate_member_process.php" method="POST">
<input type="hidden" name="task_id" value="<?= $task['task_id'] ?>">
<fieldset>
<legend>Task Details</legend>
<p><strong>Task ID:</strong> <?= $task['task_id'] ?></p>
<p><strong>Task Name:</strong> <?= $task['task_name'] ?></p>
<p><strong>Start Date:</strong> <?= $task['start_date'] ?></p>
</fieldset>
<fieldset>
<legend>Allocate Team Member</legend>
<label for="team_member">Team Member</label>
<select id="team_member" name="team_member" required>
<option value="">-- Select Team Member --</option>
<?php foreach ($teamMembers as $member): ?>
<option value="<?= $member['user_id'] ?>"><?= $member['full_name'] ?></option>
<?php endforeach; ?>
</select>
<label for="role">Role</label>
<select id="role" name="role" required>
<option value="">-- Select Role --</option>
<option value="Developer">Developer</option>
<option value="Designer">Designer</option>
<option value="Tester">Tester</option>
<option value="Analyst">Analyst</option>
<option value="Support">Support</option>
</select>
<label for="contribution">Contribution Percentage</label>
<input type="number" id="contribution" name="contribution" min="1" max="100" step="1" required>
</fieldset>
<button type="submit">Assign Member</button>
</form>
</section>
</main>
<?php include 'footer.php'; ?>
</body>
</html>