-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleave.jsp
More file actions
148 lines (139 loc) · 5.73 KB
/
leave.jsp
File metadata and controls
148 lines (139 loc) · 5.73 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!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/authentication.css">
<link rel="stylesheet" href="styles/common.css">
<link rel="stylesheet" href="styles/leave.css">
<link rel="icon" href="images/icon.png">
<title>Leave</title>
</head>
<body onload="setDates();">
<style>
#appNoResult, #applicationStatus
{
color: white;
font-weight: bold;
text-align: center;
margin-top: 2vw;
font-size: 1.5vw;
text-transform: capitalize;
}
</style>
<jsp:include page="navigationPannel.jsp"></jsp:include>
<jsp:include page="svg.jsp"></jsp:include>
<div class="container">
<div class="workspace">
<form onsubmit="return getApplicationNo()">
<h1>Request For Leave</h1>
<select id="reason" required>
<option value="" disabled selected style="color: rgb(214, 205, 205);">Reason</option>
<option>Casual/Incidental</option>
<option>Hospitalization</option>
<option>Recovery After Hospitalization</option>
<option>Medical Ground</option>
<option>For Study</option>
<option>Election Duty</option>
<option>Apearing In Exam</option>
<option>Family Walfare Program</option>
<option>For Care of Childrens</option>
<option>Marrige</option>
</select>
<select id="type" required>
<option value="" disabled selected style="color: rgb(214, 205, 205);">Type</option>
<option>Casual Leave (CL)</option>
<option>Half Pay Leave (HPL)</option>
<option>Maternity Leave (ML)</option>
<option>Maternity Leave (ML)</option>
<option>Child Care Leave (CCL)</option>
<option>Leave Without Pay (LWP)</option>
<option>Compansative Casual Leave (CCL)</option>
<option>Priviledge Leave (PL)</option>
</select>
<input required type="date" id="from" onchange="updateMin(this.value);" name="from" style="display: block;">
<input required type="date" id="to" value="2018-07-22" name="to" style="display: block;">
<input required type="text" name="tempAddress" id="tempAddress" placeholder="Address During Leave">
<input type="submit" value="Request">
<p id="appNoResult"></p>
</form>
</div>
</div>
<div class="container" style="margin: 0;
height: 22vw;">
<div class="workspace">
<form onsubmit="return getStatus();">
<h1>Check Status</h1>
<input type="text" name="applicationNo" id="applicationNo" placeholder="Application No.">
<input type="submit" value="Check Status">
<p id="applicationStatus"></p>
</form>
</div>
</div>
<jsp:include page="footer.jsp"></jsp:include>
</body>
<%
if(session.getAttribute("email") == null)
{
response.sendRedirect("authentication.jsp");
}
else if(session.getAttribute("role").equals("admin"))
{
response.sendRedirect("authentication.jsp");
}
else if(session.getAttribute("role").equals("passanger"))
{
response.sendRedirect("authentication.jsp");
}
%>
<script src="scripts/navPannel.js"></script>
<script src="scripts/leave.js"></script>
<script>
function getApplicationNo()
{
var reason = document.getElementById("reason").value;
var type = document.getElementById("type").value;
var from = document.getElementById("from").value;
var to = document.getElementById("to").value;
var tempAddress = document.getElementById("tempAddress").value;
var param = "?reason=" + reason + "&type=" + type + "&from=" + from + "&to=" + to + "&tempAddress=" + tempAddress;
param = param.replace("+", "%2b")
param = param.replace("(", "%28")
param = param.replace(")", "%29")
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "leaveRequestAJAX.jsp" + param, false);
xmlhttp.onreadystatechange = function(){
document.getElementById("appNoResult").innerText = xmlhttp.responseText.trim();
}
xmlhttp.send();
return false;
}
function getStatus()
{
var applicationNO = document.getElementById("applicationNo").value;
var param = "?applicationNO=" + applicationNO;
param = param.replace("+", "%2b")
param = param.replace("(", "%28")
param = param.replace(")", "%29")
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "leaveStatusAJAX.jsp" + param, false);
xmlhttp.onreadystatechange = function(){
var result = document.getElementById("applicationStatus")
var status = xmlhttp.responseText.trim();
if(status == "pending")
result.style.color = "yellow";
else if(status == "declined")
result.style.color = "rgb(78, 12, 12)";
else if(status == "approved")
result.style.color = "rgb(90, 218, 90)";
else
result.style.color = "white";
result.innerText = status;
}
xmlhttp.send();
return false;
}
</script>
</html>