-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemployeeadd.php
495 lines (448 loc) · 21.2 KB
/
employeeadd.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<?php include('header.php'); ?>
<?php
$CountryId = 0;
$StateId = 0;
$CityId = 0;
include_once('controller/connect.php');
$dbs = new database();
$db=$dbs->connection();
//$cityn = mysqli_query($db,"select * from city ORDER BY Name");
//$staten = mysqli_query($db,"select * from state ORDER BY Name");
$countryn = mysqli_query($db,"select * from country ORDER BY Name");
$gendern = mysqli_query($db,"select * from gender ORDER BY Name");
$rolen = mysqli_query($db,"select * from role ORDER BY Name");
$statusn = mysqli_query($db,"select * from status ORDER BY Name");
$maritaln = mysqli_query($db,"select * from maritalstatus ORDER BY Name");
$positionn = mysqli_query($db,"select * from position ORDER BY Name");
$result ="";
$id="";
if(isset($_GET['msg']))
{
$result=$_GET['msg'];
}
else if(isset($_GET['id']))
{
$id=$_GET['id'];
}
else if (isset($_GET['empid']))
{
$empid = $_GET['empid'];
$editempid = mysqli_query($db,"SELECT e.*,ss.StateId,cc.CountryId FROM employee e join city c on e.CityId=c.CityId join state ss on c.StateId=ss.StateId join country cc on cc.CountryId=ss.CountryId where EmpId='$empid'");
$editemp = mysqli_fetch_assoc($editempid);
$CountryId = $editemp["CountryId"];
$StateId = $editemp['StateId'];
$CityId = $editemp['CityId'];
}
?>
<ol class="breadcrumb" style="margin: 10px 0px ! important;">
<li class="breadcrumb-item"><a href="Home.php">Home</a><i class="fa fa-angle-right"></i>Employee<i class="fa fa-angle-right"></i> Employee Add</li>
</ol>
<!--grid-->
<div class="validation-system" style="margin-top: 0;">
<div class="validation-form">
<!---->
<form method="POST" action="controller/employee.php?empedit=<?php echo $_GET['empid']; ?>" enctype="multipart/form-data">
<?php
if($result)
{
echo '<h4 style="color: #FF0000;">'.$result.'</h4>';
}
else
{
echo '<h4 style="color: #008000;">'.$id.'</h4>';
}
?>
<div class="vali-form-group">
<div class="col-md-4 control-label">
<label class="control-label">Employee ID*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>
<input type="text" name="empid" title="Employee ID" value="<?php echo(isset($editemp["EmployeeId"]))?$editemp["EmployeeId"]:""; ?>" class="form-control" placeholder="Employee ID" required="">
</div>
</div>
<div class="col-md-4 control-label">
<label class="control-label">Profile Image*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-picture-o" aria-hidden="true"></i>
</span>
<input type="file" name="pfimg" title="Profile Image" class="form-control" name="fileupload" >
</div>
</div>
<div class="col-md-4 control-label">
<label class="control-label">Gender*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-male" aria-hidden="true"></i>
</span>
<select name="gender" title="Gender" required="" style="padding: 5px 5px; text-transform: capitalize;"">
<option value="">-- Select Gender --</option>
<?php while($rw = mysqli_fetch_assoc($gendern)){ ?>
<option value="<?php echo $rw["GenderId"]; ?>" <?php if(isset($editemp["Gender"]) && $editemp["Gender"]==$rw["GenderId"]){ echo "Selected"; }?>> <?php echo $rw["Name"]; ?> </option>
<?php } ?>
</select>
</div>
</div>
</div>
<div class="clearfix"> </div>
<div class="vali-form-group">
<div class="col-md-4 control-label">
<label class="control-label">First Name*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>
<input type="text" name="fname" title="First Name" value="<?php echo(isset($editemp["FirstName"]))?$editemp["FirstName"]:""; ?>" class="form-control" placeholder="First Name" required="">
</div>
</div>
<div class="col-md-4 control-label">
<label class="control-label">Middel Name*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>
<input type="text" name="mname" title="Middel Name" value="<?php echo(isset($editemp["MiddleName"]))?$editemp["MiddleName"]:""; ?>" class="form-control" placeholder="Middel Name" required="">
</div>
</div>
<div class="col-md-4 control-label">
<label class="control-label">Last Name*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>
<input type="text" name="lname" title="Last Name" value="<?php echo(isset($editemp["LastName"]))?$editemp["LastName"]:""; ?>" class="form-control" placeholder="Last Name" required="">
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="vali-form-group">
<div class="col-md-4 control-label">
<label class="control-label">Birth Date*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar" aria-hidden="true"></i>
</span>
<input type="text" id="Birthdate" title="Birth Date" name="bdate" placeholder="Birth Date" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" value="<?php echo(isset($editemp["Birthdate"]))?$editemp["Birthdate"]:""; ?>" class="form-control" required="">
</div>
</div>
<div class="col-md-4 control-label">
<label class="control-label">Marital*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>
<select name="marital" title="Marital" required="" style="text-transform: capitalize;">
<option value="">-- Select Marital --</option>
<?php while($rw = mysqli_fetch_assoc($maritaln)){ ?>
<option value="<?php echo $rw["MaritalId"]; ?>" <?php if(isset($editemp["MaritalStatus"]) && $editemp["MaritalStatus"]==$rw["MaritalId"]){ echo "Selected"; }?>> <?php echo $rw["Name"]; ?> </option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-4 control-label">
<label class="control-label">Mobile Number*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-mobile" aria-hidden="true"></i>
</span>
<input type="text" name="mnumber" title="Mobile Number" value="<?php echo(isset($editemp["Mobile"]))?$editemp["Mobile"]:""; ?>" class="form-control" placeholder="Mobile Number" min="10" maxlength="10" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')" required="">
</div>
</div>
</div>
<div class="clearfix"> </div>
<div class="col-md-12 control-label">
<label class="control-label">Address 1*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-pencil " aria-hidden="true"></i>
</span>
<input type="text" name="address1" title="Address 1" value="<?php echo(isset($editemp["Address1"]))?$editemp["Address1"]:""; ?>" class="form-control" placeholder="Address Line 1" required="">
</div>
</div>
<div class="clearfix"> </div>
<div class="col-md-12 control-label">
<label class="control-label">Address 2*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-pencil " aria-hidden="true"></i>
</span>
<input type="text" name="address2" title="Address 2" value="<?php echo(isset($editemp["Address2"]))?$editemp["Address2"]:""; ?>" class="form-control" placeholder="Address Line 2" required="">
</div>
</div>
<div class="clearfix"> </div>
<div class="col-md-12 control-label">
<label class="control-label">Address 3</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-pencil " aria-hidden="true"></i>
</span>
<input type="text" name="address3" title="Address 3" value="<?php echo(isset($editemp["Address3"]))?$editemp["Address3"]:""; ?>" class="form-control" placeholder="Address Line 3">
</div>
</div>
<div class="clearfix"> </div>
<div class="vali-form-group">
<div class="col-md-3 control-label">
<label class="control-label">Country*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-globe" aria-hidden="true"></i>
</span>
<select name="country" id="contryid" title="Country" required="" onchange="contrychange()" style="text-transform: capitalize;">
<option value="">-- Select Country --</option>
<?php while($rw = mysqli_fetch_assoc($countryn)){ ?>
<option value="<?php echo $rw["CountryId"]; ?>" <?php if(isset($editemp["CountryId"]) && $editemp["CountryId"]==$rw["CountryId"]){ echo "Selected"; }?>> <?php echo $rw["Name"]; ?> </option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">State*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-map-marker" aria-hidden="true"></i>
</span>
<select name="state" id="stateid" title="State" onchange="statechange()" required="" style="text-transform: capitalize;">
<option value="">-- Select State --</option>
</select>
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">City*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-map-marker" aria-hidden="true"></i>
</span>
<select name="city" id="cityid" title="City" required="" style="text-transform: capitalize;">
<option value="">-- Select City --</option>
</select>
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">Aadhar Card Number*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
<input type="text" name="aadharcard" title="Aadhar Number" value="<?php echo(isset($editemp["AadharNumber"]))?$editemp["AadharNumber"]:""; ?>" placeholder="Aadhar Card Number" class="form-control" required="">
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="vali-form-group">
<div class="col-md-3 control-label">
<label class="control-label">Join Date*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar" aria-hidden="true"></i>
</span>
<input type="text" id="JoinDate" title="Join Date" name="joindate" placeholder="Join Date" value="<?php echo(isset($editemp["JoinDate"]))?$editemp["JoinDate"]:""; ?>" class="form-control" required="" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">Leave Date</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-calendar" aria-hidden="true"></i>
</span>
<input type="text" id="LeaveDate" title="Leave Date" name="leavedate" placeholder="Leave Date" value="<?php echo(isset($editemp["LeaveDate"]))?$editemp["LeaveDate"]:""; ?>" class="form-control" onkeyup="if (/\D/g.test(this.value)) this.value = this.value.replace(/\D/g,'')">
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">Status</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-map-marker" aria-hidden="true"></i>
</span>
<select name="status" title="Status" required="" style="text-transform: capitalize;">
<option value="">-- Select Status --</option>
<?php while($rw = mysqli_fetch_assoc($statusn)){ ?>
<option value="<?php echo $rw["StatusId"]; ?>" <?php if(isset($editemp["StatusId"]) && $editemp["StatusId"]==$rw["StatusId"]){ echo "Selected"; }?>> <?php echo $rw["Name"]; ?> </option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">Role*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>
<select name="role" required="" title="Role" style="text-transform: capitalize;" >
<option value="">-- Select Role --</option>
<?php while($rw = mysqli_fetch_assoc($rolen)){ ?>
<option value="<?php echo $rw["RoleId"]; ?>" <?php if(isset($editemp["RoleId"]) && $editemp["RoleId"]==$rw["RoleId"]){ echo "Selected"; }?>> <?php echo $rw["Name"]; ?> </option>
<?php } ?>
</select>
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="vali-form-group">
<div class="col-md-3 control-label">
<label class="control-label">Position*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-language" aria-hidden="true"></i>
</span>
<select name="position" title="Position" style="text-transform: capitalize;" required="">
<option value="">-- Select Position --</option>
<?php while($rw = mysqli_fetch_assoc($positionn)){ ?>
<option value="<?php echo $rw["PositinId"]; ?>" <?php if(isset($editemp["PositionId"]) && $editemp["PositionId"]==$rw["PositinId"]){ echo "Selected"; }?>> <?php echo $rw["Name"]; ?> </option>
<?php } ?>
</select>
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">Email*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-envelope" aria-hidden="true"></i>
</span>
<input type="email" name="email" title="Email" value="<?php echo(isset($editemp["Email"]))?$editemp["Email"]:""; ?>" class="form-control" placeholder="Email Address" required="">
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">Password*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
<input type="password" id="Psw" title="Password" value="<?php echo(isset($editemp["Password"]))?$editemp["Password"]:""; ?>" name="password" placeholder="Password " class="form-control" required="">
<span class="input-group-addon">
<a><i class='fa fa-eye' aria-hidden='false' onclick="passwordeyes()"></i></a>
</span>
</div>
</div>
<div class="col-md-3 control-label">
<label class="control-label">MAC Address*</label>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-pencil" aria-hidden="true"></i>
</span>
<input type="text" name="macaddress" title="MAC Address" id="mac" onkeydown="return nmac1(this.value,event)" onkeyup="nmac(this.value,event)" value="<?php echo(isset($editemp["MacAddress"]))?$editemp["MacAddress"]:""; ?>" placeholder="MAC Address" class="form-control" required="">
</div>
</div>
<div class="clearfix"> </div>
</div>
<div class="col-md-12 form-group">
<button type="submit" name="submit" class="btn btn-primary">Submit</button>
<button type="reset" class="btn btn-default">Reset</button>
<input type="text" name="imagefilename" hidden="" value="<?php echo(isset($editemp['ImageName']))?$editemp['ImageName']:''; ?>">
</div>
<div class="clearfix"> </div>
</form>
<!---->
</div>
</div>
<script>
function passwordeyes() {
var x = document.getElementById("Psw").type;
if(x=="password")
document.getElementById("Psw").type="text";
else
document.getElementById("Psw").type="password";
}
</script>
<script>
var OneStepBack;
function nmac(val,e){
if(e.keyCode!=8)
{
if(val.length==2)
document.getElementById("mac").value = val+"-";
if(val.length==5)
document.getElementById("mac").value = val+"-";
if(val.length==8)
document.getElementById("mac").value = val+"-";
if(val.length==11)
document.getElementById("mac").value = val+"-";
if(val.length==14)
{
document.getElementById("mac").value = val+"-";
}
}
}
function nmac1(val,e){
if(e.keyCode==32){
return false;
}
if(e.keyCode!=8){
if(val.length==2)
document.getElementById("mac").value = val+"-";
if(val.length==5)
document.getElementById("mac").value = val+"-";
if(val.length==8)
document.getElementById("mac").value = val+"-";
if(val.length==11)
document.getElementById("mac").value = val+"-";
if(val.length==14){
document.getElementById("mac").value = val+"-";
}
if(val.length==17){
return false;
}
}
}
</script>
<script>
contrychange();
function contrychange()
{
var selectedstateid = "<?php echo $StateId; ?>";
var selectedstateid = parseInt(selectedstateid);
var selectedcountry = $('#contryid').val();
$.get("controller/getstatecity.php?Type=s&ci="+selectedcountry+"&ss="+selectedstateid,function(data,status){
$("#stateid").html(data);
});
statechange(selectedstateid);
}
function statechange(si)
{
var selectedstate = $('#stateid').val();
if(si!=undefined)
selectedstate=si;
var selectedcityid = "<?php echo $CityId; ?>";
selectedcityid = parseInt(selectedcityid);
$.get("controller/getstatecity.php?Type=c&si="+selectedstate+"&sc="+selectedcityid,function(data,status){
$("#cityid").html(data);
});
}
</script>
<script>
var birthdate = $('#Birthdate').val();
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;
var yy = today.getFullYear();
var tdate = yy+"/"+mm+"/"+dd;
$('#Birthdate').datetimepicker({
yearOffset:0,
lang:'ch',
timepicker:false,
format:'Y/m/d',
formatDate:'Y/m/d',
//minDate:'-1980/01/01', // yesterday is minimum date
maxDate: tdate // and tommorow is maximum date calendar
});
$('#JoinDate').datetimepicker({
yearOffset:0,
lang:'ch',
timepicker:false,
format:'Y/m/d',
formatDate:'Y/m/d',
//minDate:'-1980/01/01', // yesterday is minimum date
//maxDate: tdate // and tommorow is maximum date calendar
});
$('#LeaveDate').datetimepicker({
yearOffset:0,
lang:'ch',
timepicker:false,
format:'Y/m/d',
formatDate:'Y/m/d',
//minDate:'-1980/01/01', // yesterday is minimum date
//maxDate: tdate // and tommorow is maximum date calendar
});
</script>
<?php include('footer.php'); ?>