-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwarden_application.php
More file actions
88 lines (70 loc) · 3.52 KB
/
Copy pathwarden_application.php
File metadata and controls
88 lines (70 loc) · 3.52 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
88
<?php
include 'include/connect.php';
if (!isset($_SESSION['user_id']) || $_SESSION['user_type'] !== 'warden') {
header('Location: warden_login.php');
exit();
}
$wardenId = $_SESSION['user_id'];
$hostelId = $_SESSION['hostel_id'];
$sql = "SELECT application_id, roll_number, type, description, status, room_number, remark FROM application WHERE hostel_id = ? AND status=?";
$stmt = $conn->prepare($sql);
$state = 'requested';
$stmt->bind_param("ss", $hostelId, $state);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
$applications = $result->fetch_all(MYSQLI_ASSOC);
} else {
$applications = [];
}
$stmt->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Warden Application Dashboard</title>
<link rel="stylesheet" href="https://cdn.tailwindcss.com">
</head>
<body class="bg-gray-100 ">
<?php include 'include/header.php'; ?>
<div class="container px-5 mx-auto mt-[10vh]">
<h1 class="text-2xl font-bold mb-4">Warden Application Dashboard - <?php echo $hostelId ?></h1>
<?php if (!empty($applications)) { ?>
<?php foreach ($applications as $application) { ?>
<div class="bg-white p-8 mb-4 shadow-md">
<h2 class="text-xl font-semibold mb-2"><?php echo ucfirst($application['type']); ?> Application</h2>
<p><strong>Application ID:</strong> <?php echo $application['application_id']; ?></p>
<p><strong>Roll Number:</strong> <?php echo $application['roll_number']; ?></p>
<p><strong>Description:</strong> <?php echo $application['description']; ?></p>
<p><strong>Status:</strong> <?php echo ucfirst($application['status']); ?></p>
<p><strong>Room Number:</strong> <?php echo $application['room_number']; ?></p>
<p><strong>Remark:</strong> <?php echo $application['remark']; ?></p>
<form action="include/update_application_status.php" method="post">
<input type="hidden" name="application_id" value="<?php echo $application['application_id']; ?>">
<input type="hidden" name="type" value="<?php echo $application['type']; ?>">
<?php
if ($application['type'] != 'room_reallotment') { ?>
<div class="flex items-center space-x-4 mt-2">
<select name="status" class="p-2 border rounded">
<option value="verified">Verified</option>
<option value="denied">Denied</option>
<option value="remark_only">Remark Only</option>
</select>
<input type="text" name="remark" placeholder="Remark" class="p-2 border rounded">
<button type="submit" class="p-2 bg-blue-500 text-white rounded">Update Status</button>
</div>
<?php }
else{
echo '<a href="warden_room.php" class="text-blue-500 mt-2 block">Go to Room Reallotment Dashboard</a>';
}?>
</form>
</div>
<?php } ?>
<?php } else { ?>
<p>No applications found in the hostel.</p>
<?php } ?>
</div>
</body>
</html>