-
Notifications
You must be signed in to change notification settings - Fork 0
/
view-employees.php
175 lines (149 loc) · 6.69 KB
/
view-employees.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
171
172
173
174
175
<?php
require_once "importance.php";
if (!User::loggedIn()) {
Config::redir("login.php");
}
?>
<html>
<head>
<title><?php echo CONFIG::SYSTEM_NAME; ?> : Profile</title>
<?php require_once "inc/head.inc.php"; ?>
</head>
<body>
<?php require_once "inc/header.inc.php"; ?>
<div class='container-fluid'>
<div class='row'>
<div class='col-md-3'><?php require_once "inc/sidebar.inc.php"; ?></div> <!-- this should be a sidebar -->
<div class='col-md-8'>
<div class='content-area'>
<div class='content-header'>
<?php echo "Employee Details"; ?>
</div>
<div class='content-body'>
<?php
$token = $_GET['token'];
$pic = User::get($token, "profile");
$img = (!empty($pic)) ? ($pic) : ("profile.png");
$empid = User::get($token, "id");
$userFirstName = User::get($token, "firstName");
$userSecondName = User::get($token, "secondName");
$userDob = date("d M Y", strtotime(User::get($token, "date_of_birth")));
$userDoj = date("d M Y", strtotime(User::get($token, "date_of_joining")));
$userEmail = User::get($token, "email");
$userPassword = User::get($token, "password");
$userToken = User::get($token, "token");
$userStatus = User::get($token, "status");
$userPhone = User::get($token, "phone");
$userProfile = User::get($token, "profile");
$userGender = User::get($token, "gender");
$userRole = User::get($token, "designation");
$userSalary = User::get($token, "salary");
$userAccount = User::get($token, "account_no");
if ($userStatus == 1) {
$userRole = "admin";
} else {
$userRole = $userRole;
}
echo "<div class='form-holder'>";
$form = new Form(3, "post");
$form->init();
echo "
<div class='form-group'>
<label class='col-md-3' style='font-size:15px'>Photo</label>
<div class='col-md-9'>
<img src='images/$img' width='70px' height='70px'>
</div>
</div>
";
$form->textBox("Employee Id", "user-ei", "text", $empid, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("First Name", "user-fn", "text", $userFirstName, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Last Name", "user-sn", "text", $userSecondName, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Date Of Birth", "user-dob", "text", $userDob, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Email", "user-em", "text", $userEmail, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Designation", "user-role", "text", $userRole, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Gender", "user-gender", "text", $userGender, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Phone", "user-phone", "text", $userPhone, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Date Of Joining", "user-doj", "text", $userDoj, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Salary", "user-sl", "text", "kshs " . $userSalary, array("readonly='readonly'", " style='font-size: 17px;' "));
$form->textBox("Account No.", "user-ac", "text", $userAccount, array("readonly='readonly'", " style='font-size: 17px;' "));
?>
<div class='row'>
<div class='col-md-6'>
<label style="font-size:15px">Allowances</label><br>
<div class='col-md-11'>
<ul class="list-group" style="list-style-type:none;">
<?php
$con = Db::connect();
$sql = "SELECT ea.*, a.allowance_name as aname FROM emp_allowances ea inner join allowances a on ea.a_id=a.a_id where ea.e_id= $empid ";
$query = $con->prepare($sql);
$query->execute();
while ($data = Db::assoc($query)) : ?>
<li class="list-group-item" data-id="<?php echo $data['a_id'] ?>">
<div class='row'>
<div class='col-md-6'>
<p style="font-size:15px">
<?php echo $data['aname'];
$aid = $data['sno'];
?>
</p>
</div>
<div class='col-md-4'>
<p style="font-size:15px">
<?php echo "Kshs " . $data['amount'] ?>
</p>
</div>
<div class='col-md-2'>
<button class="btn btn-danger" onclick="location.href='actions.php?action=remove-empalw&sno=<?php echo $aid; ?>&tkn=<?php echo $token; ?>'" type="button" id="del_ea_btn" style="height: 1px width: 1px"><i class="fa fa-trash"></i></button>
</div>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
<button class="btn btn-primary" onclick="location.href='add-empallowance.php?token=<?php echo $token; ?>'" type="button" id="new_ea_btn">Add Allowance</button>
</div>
<div class='col-md-6'>
<label style="font-size:15px">Deductions</label><br>
<div class='col-md-11'>
<ul class="list-group" style="list-style-type:none;">
<?php
$con = Db::connect();
$sql = "SELECT ed.*, d.deduction_name as dname FROM emp_deductions ed inner join deductions d on ed.d_id=d.d_id where ed.e_id= $empid ";
$query = $con->prepare($sql);
$query->execute();
while ($data = Db::assoc($query)) : ?>
<li class="list-group-item" data-id="<?php echo $data['d_id'] ?>">
<div class='row'>
<div class='col-md-6'>
<p style="font-size:15px">
<?php echo $data['dname'];
$did = $data['sno']; ?>
</p>
</div>
<div class='col-md-4'>
<p style="font-size:15px">
<?php echo "kshs" . $data['amount'] ?>
</p>
</div>
<div class='col-md-2'>
<button class="btn btn-danger" onclick="location.href='actions.php?action=remove-empded&sno=<?php echo $did; ?>&tkn=<?php echo $token; ?>'" type="button" id="del_empded_btn" style="height: 1px width: 1px"><i class="fa fa-trash"></i></button>
</div>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
<button class="btn btn-primary" onclick="location.href='add-empdeduction.php?token=<?php echo $token; ?>'" type="button" id="new_ed_btn">Add deduction</button>
</div>
</div>
<?php
$form->close("");
echo "</div>"; ?>
</div><!-- end of the content area -->
</div>
</div><!-- col-md-8 -->
<!-- this should be a sidebar -->
</div>
</div>
</body>
</html>