-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleaveRequests.jsp
More file actions
133 lines (131 loc) · 4.65 KB
/
leaveRequests.jsp
File metadata and controls
133 lines (131 loc) · 4.65 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="styles/style.css">
<link rel="stylesheet" href="styles/common.css">
<link rel="stylesheet" href="styles/policies.css">
<link rel="icon" href="images/icon.png">
<style>
.policy
{
width: 95%;
}
.policy table
{
width: 100%;
}
.approved, .declined
{
box-shadow: 7px 7px 12px rgba(255, 255, 255, 0.45), -7px -7px 12px rgba(70, 70, 70, 0.13);
color: black;
float: left;
border-radius: 5vw;
width: 2.8vw;
height: 2.8vw;
font-size:2vw;
padding: .2vw;
transition: ease all .5s;
}
.approved:active, .declined:active
{
box-shadow: inset 7px 7px 12px rgba(255, 255, 255, 0.45), inset -7px -7px 12px rgba(70, 70, 70, 0.13);
}
.approved
{
margin-left: 1vw;
}
.approved:hover
{
cursor: pointer;
color: green;
background-color: rgba(0, 128, 0, 0.15);
}
.declined:hover
{
cursor: pointer;
color: red;
background-color: rgba(255, 0, 0, 0.15);
}
</style>
<title>Leave Requests</title>
</head>
<body>
<%
if(session.getAttribute("email") == null || !session.getAttribute("role").equals("admin"))
{
response.sendRedirect("authentication.jsp");
}
%>
<%@page import="java.sql.*"%>
<jsp:include page="navigationPannel.jsp"></jsp:include>
<div class="container">
<jsp:include page="svg.jsp"></jsp:include>
<div class="innerContainer">
<h1>-- Leave Requests --</h1>
<p>We understand problems of our people<br>That's why most applications approved</p>
</div>
<div class="policy">
<h1>Pending Leave Requests</h1>
<table>
<tr>
<th>Application No</th>
<th>Reason</th>
<th>Type</th>
<th>From</th>
<th>To</th>
<th>Address</th>
<th>Email</th>
<th>Action</th>
</tr>
<%
Connection con = null;
Statement st = null;
ResultSet rs = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/shivajiroadways", "root", "1234");
st = con.createStatement();
String query = "select * from leave_request where status='pending'";
rs = st.executeQuery(query);
while(rs.next())
{%>
<tr>
<td><%=rs.getInt("applicationNo")%></td>
<td><%=rs.getString("reason")%></td>
<td><%=rs.getString("type")%></td>
<td><%=rs.getString("date_from")%></td>
<td><%=rs.getString("date_to")%></td>
<td><%=rs.getString("address")%></td>
<td><%=rs.getString("email")%></td>
<td><div class="declined" onclick="changeStatus('<%=rs.getInt("applicationNo")%>', 'declined');">✘</div><div class="approved" onclick="changeStatus('<%=rs.getInt("applicationNo")%>', 'approved');">✔</div></td>
</tr>
<%}
}
catch(Exception e){out.print(e.getMessage());}
%>
</table>
</div>
</div>
<jsp:include page="footer.jsp"></jsp:include>
</body>
<script src="scripts/navPannel.js"></script>
<script>
function changeStatus(applicationNo, status)
{
var param = "?applicationNo=" + applicationNo + "&status=" + status;
param = param.replace("+", "%2b")
param = param.replace("(", "%28")
param = param.replace(")", "%29")
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "changeLeaveStatus.jsp" + param, false);
xmlhttp.onreadystatechange = function(){
location.reload();
}
xmlhttp.send();
}
</script>
</html>