-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemp_view_applied_leave.php
170 lines (126 loc) · 6.04 KB
/
emp_view_applied_leave.php
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Leave applied by employees</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="libs\css\applied_leave.css">
<link rel="stylesheet" href="libs\css\profile_card.css">
.
</head>
<body>
<?php session_start();
//$_SESSION['username']='e000100004';
if (!isset($_SESSION['username'])){
header("location: access_restricted.php");
exit();
}
?>
<div class="container">
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-6">
<h2><b>Leave Applied by Employees</b></h2>
</div>
</div>
</div>
<?php
include 'config\database.php';
include 'objects\applied_leave.php';
$db=new Database();
$application=new ViewAppliedLeave($db->getConnection(),$_SESSION['username']);
if (($application->role)==1 or ($application->role)==5){
header("location: access_restricted.php");
exit();
}
$stmt = $application->readAppliedLeave();
$num = $stmt->rowCount();
if($num>0){
?>
<table class='table table-hover table-responsive table-bordered'>
<tr>;
<th>Employee Id</th>
<th>Applied Date</th>
<th>Type of leave</th>
<th>From Date</th>
<th>Number of days</th>
<th>Actions</th>
</tr>
<?php while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);?>
<tr>
<td ><?php echo $row['emp_id']?></td>
<td ><?php echo $row['applied_date']?></td>
<td><?php echo $row['leave_type']?></td>
<td><?php echo $row['from_date']?></td>
<td><?php echo $row['no_of_days']?></td>
<td>
<a href='#viewEmployeeModal' data-toggle='modal' name="view" value="view" id="<?php echo $row['emp_id']; ?>" class='btn btn-info left-margin view_data'>
<span class='glyphicon glyphicon-eye-open'></span> View
</a>
<a href="assets\applied_leave_approve.inc.php?id=<?php echo $row['emp_id'];?>&date=<?php echo $row['applied_date']?>" class='btn btn-success left-margin'>
<span class='glyphicon glyphicon-ok'></span> Approve
</a>
<a href="assets\applied_leave_reject.inc.php?id=<?php echo $row['emp_id'];?>&date=<?php echo $row['applied_date']?>" class='btn btn-danger left-margin' onclick="return confirm('Are you sure you want to reject the leave application ?')">
<span class='glyphicon glyphicon-remove'></span> Reject
</a>
</td>
</tr>
<?php } ?>
</table>
<?php
// paging buttons will be here
}
// tell the user there are no products
else{
echo "<div class='alert alert-info'>No Leave Applications were found.</div>";
}
?>
</div>
</div>
<!--Profile Card -->
<div id="viewEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="card profile-card-5">
<div class="card-img-block">
<img class="card-img-top" src="libs/css/index.jpg" alt="Card image cap">
</div>
<div class="card-body " >
<p class="card-text" id="employee_detail"></p>
<a href="#" class="btn btn-primary center">More information</a>
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
</div>
</div>
</div>
</div>
<script>
$(document).on('click', '.view_data', function(){
var employee_id = $(this).attr("id");
if(employee_id != '')
{
$.ajax({
url:"assets/ajax_emp_info.php",
method:"POST",
data:{employee_id:employee_id},
success:function(data){
$('#employee_detail').html(data);
$('#viewEmployeeModal').modal('show');
}
});
}
});
</script>
</body>
</html>