-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarden_room.php
More file actions
85 lines (68 loc) · 3.38 KB
/
warden_room.php
File metadata and controls
85 lines (68 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
include 'include/connect.php';
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'warden') {
header('Location: warden_login.php');
exit();
}
$hostelId = $_SESSION['hostel_id'];
$sql = "SELECT * FROM application WHERE type = 'room_reallotment' AND status = 'requested' AND hostel_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $hostelId);
$stmt->execute();
$result = $stmt->get_result();
$reallotmentApplications = $result->fetch_all(MYSQLI_ASSOC);
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Warden Dashboard</title>
<link rel="stylesheet" href="https://cdn.tailwindcss.com">
</head>
<body>
<?php include 'include/header.php'; ?>
<div class="container mx-auto mt-[10vh]">
<h1 class="text-2xl font-bold mb-4">Warden Dashboard</h1>
<?php if (!empty($reallotmentApplications)) { ?>
<table class="table-auto">
<thead>
<tr>
<th class="px-4 py-2">Application ID</th>
<th class="px-4 py-2">Student Roll Number</th>
<th class="px-4 py-2">New Room Requested</th>
<th class="px-4 py-2">Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($reallotmentApplications as $application) { ?>
<tr>
<td class="border px-4 py-2"><?php echo $application['application_id']; ?></td>
<td class="border px-4 py-2"><?php echo $application['roll_number']; ?></td>
<td class="border px-4 py-2"><?php echo $application['transaction_id']; ?></td>
<td class="border px-4 py-2">
<form action="include/warden_room_process.php" method="post">
<input type="hidden" name="type" value="room_reallotment">
<input type="hidden" name="application_id" value="<?php echo $application['application_id']; ?>">
<?php if ($application['transaction_id'] == NULL) {
?><input type="number" name="transaction_id" placeholder="Enter room alloted" class="p-2 border rounded"><?php
} ?>
<select name="status" class="p-2 border rounded">
<option value="verified">Approve</option>
<option value="denied">Deny</option>
</select>
<input type="text" name="remarks" placeholder="Add remarks" class="p-2 border rounded">
<button type="submit" class="p-2 bg-green-500 text-white rounded">Submit</button>
</form>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } else { ?>
<p>No room reallotment applications to review.</p>
<?php } ?>
</div>
</body>
</html>