1283 lines
47 KiB
PHP
1283 lines
47 KiB
PHP
<?php include('techsyn_header.php'); ?>
|
|
|
|
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
|
|
<link rel="stylesheet"
|
|
href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />
|
|
|
|
<!-- page specific plugin styles -->
|
|
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
|
|
<link rel="stylesheet" href="assets/css/jquery.gritter.min.css" />
|
|
<link rel="stylesheet" href="assets/css/select2.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
|
|
<link rel="stylesheet" href="assets/css/bootstrap-editable.min.css" />
|
|
|
|
<!-- text fonts -->
|
|
<link rel="stylesheet" href="assets/css/fonts.googleapis.com.css" />
|
|
|
|
<!-- ace styles -->
|
|
<link rel="stylesheet" href="assets/css/ace.min.css"
|
|
class="ace-main-stylesheet" id="main-ace-style" />
|
|
|
|
<!--[if lte IE 9]>
|
|
<link rel="stylesheet" href="assets/css/ace-part2.min.css" class="ace-main-stylesheet" />
|
|
<![endif]-->
|
|
<link rel="stylesheet" href="assets/css/ace-skins.min.css" />
|
|
<link rel="stylesheet" href="assets/css/ace-rtl.min.css" />
|
|
|
|
<!--[if lte IE 9]>
|
|
<link rel="stylesheet" href="assets/css/ace-ie.min.css" />
|
|
<![endif]-->
|
|
|
|
<!-- inline styles related to this page -->
|
|
|
|
<!-- ace settings handler -->
|
|
<script src="assets/js/ace-extra.min.js"></script>
|
|
|
|
<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->
|
|
|
|
<!--[if lte IE 8]>
|
|
<script src="assets/js/html5shiv.min.js"></script>
|
|
<script src="assets/js/respond.min.js"></script>
|
|
<![endif]-->
|
|
|
|
|
|
|
|
<!-- Main Content Container for side bar and body-->
|
|
<div class="main-container ace-save-state" id="main-container">
|
|
<script type="text/javascript">
|
|
try{ace.settings.loadState('main-container')}catch(e){}
|
|
</script>
|
|
<?php include('techsyn_sidebar.php'); ?>
|
|
<?php
|
|
|
|
$emp_id = $_REQUEST['emp_id'];
|
|
|
|
// echo $id;
|
|
|
|
$query = "select * from employee where id = " . $emp_id . " ";
|
|
// echo $query;
|
|
if (! $result = @mysqli_query($conn,$query)) {
|
|
exit(mysqli_error($conn));
|
|
} else {
|
|
$row = @mysqli_fetch_array($result);
|
|
@extract($row);
|
|
}
|
|
|
|
$accessOption= $_REQUEST['accessOption'];
|
|
|
|
?>
|
|
<!--breadcrumb-->
|
|
<div class="main-content">
|
|
<div class="main-content-inner">
|
|
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
|
|
<ul class="breadcrumb">
|
|
<li class="active">Employee</li>
|
|
<li class="active">Update Employee Info</li>
|
|
</ul>
|
|
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="well-sm" style="margin-left: 5px;">
|
|
<div>
|
|
<div id="user-profile-2">
|
|
<form class="form-horizontal" id="employee_form"
|
|
name="employee_form" enctype="multipart/form-data" action="#"
|
|
method="post">
|
|
<div class="tabbable">
|
|
<ul class="nav nav-tabs padding-18">
|
|
<li class="active"><a data-toggle="tab" href="#edit-basic"> <i
|
|
class="green ace-icon fa fa-user bigger-120"></i> Basic Info
|
|
</a></li>
|
|
|
|
<li><a data-toggle="tab" href="#contacts"> <i
|
|
class="blue ace-icon fa fa-phone bigger-120"></i>Contacts
|
|
|
|
</a></li>
|
|
|
|
<li><a data-toggle="tab" href="#edit-settings"> <i
|
|
class="blue ace-icon fa fa-users bigger-120"></i> Family
|
|
Members
|
|
</a></li>
|
|
|
|
|
|
<li><a data-toggle="tab" href="#edit-password"> <i
|
|
class="pink ace-icon fa fa-picture-o bigger-120"></i> Advices
|
|
& Risks
|
|
</a></li>
|
|
</ul>
|
|
|
|
<div class="tab-content no-border padding-24">
|
|
<div id="edit-basic" class="tab-pane in active">
|
|
<div id="user-profile-1" class="user-profile row">
|
|
<div class="col-xs-12 col-sm-3 center">
|
|
<span class="profile-picture">
|
|
<?php if(isset($row['photo']) && $row['photo']!=null){?>
|
|
<img class="editable img-responsive"
|
|
id="avatar"
|
|
src="data:<?php echo $row['image_type']?>;base64,<?php echo base64_encode( $row['photo'] )?>"
|
|
style="display: block; width: 180px; height: 200px;" />
|
|
|
|
<?php }else{?>
|
|
<img class="editable img-responsive"
|
|
alt="Alex's Avatar" id="avatar"
|
|
src="assets/images/avatars/profile-pic.jpg" />
|
|
<?php }?>
|
|
|
|
|
|
|
|
|
|
</span>
|
|
<div class="space space-4"></div>
|
|
<div class="hide" id="uploadForm"></div>
|
|
</div>
|
|
<!-- /.col -->
|
|
<div class="col-xs-12 col-sm-9">
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-4 control-label no-padding-right"
|
|
for="form-field-first">Name</label>
|
|
|
|
<div class="col-sm-8">
|
|
<input class="input-small" type="text" name="fname"
|
|
id="fname" placeholder="First Name"
|
|
value="<?php echo $fname; ?>"> <input class="input-small"
|
|
type="text" name="lname" id="lname"
|
|
placeholder="Last Name" value="<?php echo $lname; ?>"> <input
|
|
type="hidden" class="form-control" name="employee_id"
|
|
id="employee_id"
|
|
value="<?php echo $_REQUEST['emp_id']; ?>" />
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="space-4"></div>
|
|
<div class="form-group">
|
|
<label class="col-sm-4 control-label no-padding-right"
|
|
for="form-field-username">Father's Name</label>
|
|
|
|
<div class="col-sm-8">
|
|
<input class="col-xs-12 col-sm-6" type="text"
|
|
name="father_name" id="father_name"
|
|
value="<?php echo $father_name; ?>" placeholder="Father's Name">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<!-- /.row -->
|
|
|
|
<div class="space-20"></div>
|
|
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-date">Birth Date</label>
|
|
|
|
<div class="col-sm-4">
|
|
<div class="input-medium">
|
|
<div class="input-group">
|
|
<input class="input-medium date-picker" id="dob"
|
|
name="dob" type="text" data-date-format="dd/mm/yyyy"
|
|
value="<?php echo date("d/m/Y", strtotime($dob)); ?>"
|
|
placeholder="dd/mm/yyyy"> <span
|
|
class="input-group-addon"> <i
|
|
class="ace-icon fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-date">Date Of Joining</label>
|
|
<div class="col-sm-4">
|
|
<div class="input-medium">
|
|
<div class="input-group">
|
|
<input class="input-medium date-picker" id="doj"
|
|
name="doj" type="text" data-date-format="dd/mm/yyyy"
|
|
value="<?php echo date("d/m/Y", strtotime($doj));?>"
|
|
placeholder="dd/mm/yyyy"> <span
|
|
class="input-group-addon"> <i
|
|
class="ace-icon fa fa-calendar"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right">Gender</label>
|
|
|
|
<div class="col-sm-4">
|
|
<label class="inline"> <input name="gender" id="gender"
|
|
type="radio" class="ace"
|
|
<?php if($gender=='M'){ echo "checked";} ?> value="M"> <span
|
|
class="lbl middle"> Male</span>
|
|
</label> <label class="inline"> <input
|
|
name="gender" id="gender"
|
|
<?php if($gender=='F'){ echo "checked";} ?> value="F"
|
|
type="radio" class="ace"> <span class="lbl middle">
|
|
Female</span>
|
|
</label> <label class="inline"> <input
|
|
name="gender" id="gender"
|
|
<?php if($gender=='O'){ echo "checked";} ?> value="O"
|
|
type="radio" class="ace"> <span class="lbl middle">
|
|
Others</span>
|
|
</label>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right">Designation</label>
|
|
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="designation_id" id="designation_id">
|
|
<?php echo generateOption('designation','designation_name','designation_id',$designation_id,''); ?>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Employee Code</label>
|
|
<div class="col-sm-4">
|
|
<input class="col-xs-12 col-sm-10" type="text"
|
|
id="emp_code" name="emp_code"
|
|
value="<?php echo $emp_code;?>"
|
|
placeholder="Employee Code">
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Employment Type</label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="emp_type_id" id="emp_type_id">
|
|
<?php echo generateOption('employee_category','emp_cat_name','emp_cat_id',$employment_type_id,''); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Business Unit</label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="bu_id" id="bu_id">
|
|
<?php echo generateOption('tbl_firms','firm_name','firm_id',$bu_id,''); ?>
|
|
</select>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Sub Business unit</label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="sbu_id" id="sbu_id">
|
|
<?php echo generateOption('sub_business_unit','sbu_name','sbu_id',$sbu_id,''); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Section </label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="section_id" id="section_id">
|
|
<?php echo generateOption('section','section_name','section_id',$section_id); ?>
|
|
</select>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Sub Section </label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="sub_section_id" id="sub_section_id">
|
|
<?php echo generateOption('sub_section','sub_section_name','sub_section_id',$sub_section_id); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Manager </label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="mgr_emp_id" id="mgr_emp_id">
|
|
<?php echo generate_options("SELECT id, CONCAT(fname, ' ', lname, '-', emp_code) AS emp_details FROM employee order by fname",$mgr_emp_id,'id','emp_details',$id); ?>
|
|
</select>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Aadhar No </label>
|
|
<div class="col-sm-4">
|
|
<input class="col-xs-12 col-sm-10" type="text"
|
|
name="aadhar_no" value="<?php echo $aadhar_no;?>"
|
|
id="aadhar_no" placeholder="Enter Aadhar No">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Blood Group </label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="blood_group" id="blood_group">
|
|
<?php echo generateOption('blood_group','type','type',$blood_group); ?>
|
|
</select>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Is First Aider </label>
|
|
<div class="col-sm-4">
|
|
<select style="height: 30px" class="col-xs-12 col-sm-10"
|
|
name="has_first_aid" id="has_first_aid">
|
|
<option value="1" <?php if($is_first_aid==1) echo "selected"; ?> >Yes</option>
|
|
<option value="0" <?php if($is_first_aid==0) echo "selected"; ?> >No</option>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-comment">Address </label>
|
|
<div class="col-sm-4">
|
|
<textarea class="col-xs-12 col-sm-10" id="address"
|
|
name="address"><?php echo $address?></textarea>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
<!-- /#home -->
|
|
<div id="contacts" class="tab-pane">
|
|
<div class="row">
|
|
<div class="space"></div>
|
|
<h4 class="header blue bolder smaller">Contact</h4>
|
|
|
|
<div class="form-group">
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-email">Email</label>
|
|
|
|
<div class="col-sm-4">
|
|
<span class="input-icon input-icon-right"> <input
|
|
type="email" id="email" name="email"
|
|
value="<?php echo $email_id?>"> <i
|
|
class="ace-icon fa fa-envelope"></i>
|
|
</span>
|
|
</div>
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-phone">Personal Phone</label>
|
|
|
|
<div class="col-sm-4">
|
|
<span class="input-icon input-icon-right"> <input
|
|
class="input-medium input-mask-mobile" type="text"
|
|
name="primary_phone" id="primary_phone"
|
|
value="<?php echo $primary_phone?>"> <i
|
|
class="ace-icon fa fa-phone fa-flip-horizontal"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div class="space"></div>
|
|
<h4 class="header blue bolder smaller">Emergency Contact</h4>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="row">
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-phone">Primary Contact Person</label>
|
|
|
|
<div class="col-sm-4">
|
|
<span class="input-icon input-icon-right"> <input
|
|
class="input-medium input-mask-mobile" type="text"
|
|
name="primary_contact_person" id="primary_contact_person"
|
|
value="<?php echo $primary_contact_person?>">
|
|
</span>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-phone">Primary Contact No </label>
|
|
|
|
<div class="col-sm-4">
|
|
<span class="input-icon input-icon-right"> <input
|
|
class="input-medium input-mask-mobile" type="text"
|
|
name="primary_contact_no" id="primary_contact_no"
|
|
value="<?php echo $primary_contact_no?>"> <i
|
|
class="ace-icon fa fa-phone fa-flip-horizontal"></i>
|
|
</span>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div class="row">
|
|
<div class="form-group">
|
|
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-phone">Sec Contact Person</label>
|
|
|
|
<div class="col-sm-4">
|
|
<span class="input-icon input-icon-right"> <input
|
|
class="input-medium input-mask-mobile" type="text"
|
|
name="secondary_contact_person" id="secondary_contact_person"
|
|
value="<?php echo $secondary_contact_person; ?>">
|
|
</span>
|
|
</div>
|
|
|
|
<label class="col-sm-2 control-label no-padding-right"
|
|
for="form-field-phone">Sec Contact No </label>
|
|
|
|
<div class="col-sm-4">
|
|
<span class="input-icon input-icon-right"> <input
|
|
class="input-medium input-mask-mobile" type="text"
|
|
name="secondary_contact_no" id="secondary_contact_no"
|
|
value="<?php echo $secondary_contact_no; ?>"> <i
|
|
class="ace-icon fa fa-phone fa-flip-horizontal"></i>
|
|
</span>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="edit-password" class="tab-pane">
|
|
|
|
|
|
<div class="space-12"></div>
|
|
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
Known Health Advices And Health Risks
|
|
<?php if (strcmp($accessOption, "E") ==0){?>
|
|
<div class="btn-group" style="margin-left: 750px">
|
|
<button type="button" class="btn btn-info"
|
|
onclick="addHealthAdvicesAndRisksRow()">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<?php }else{
|
|
|
|
|
|
|
|
|
|
}?>
|
|
|
|
</div>
|
|
<div class="panel-body">
|
|
<table class="table table-bordered table-hover"
|
|
id="health_advices_and_risks">
|
|
<tbody>
|
|
<tr>
|
|
<th width="50%">Known Health Advices</th>
|
|
|
|
|
|
<th width="50%">Known Health Risks</th>
|
|
</tr>
|
|
<tr>
|
|
<td><?php
|
|
|
|
$advices = explode(",", trim($row['known_health_advices'], ','));
|
|
// echo $advices;
|
|
$str_advices = '';
|
|
for ($i = 0; $i < count($advices); $i ++) {
|
|
if ($i == 0)
|
|
$str_advices .= getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $advices[$i], '');
|
|
else
|
|
$str_advices .= ',' . getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $advices[$i], '');
|
|
}
|
|
echo $str_advices;
|
|
|
|
?></td>
|
|
<td>
|
|
<?php
|
|
|
|
$risks = explode(",", trim($row['known_health_risks'], ','));
|
|
// echo $advices;
|
|
$str_risks = '';
|
|
for ($i = 0; $i < count($risks); $i ++) {
|
|
if ($i == 0)
|
|
$str_risks .= getTableFieldValue('health_advice', 'health_advice_name', 'health_advice_id', $risks[$i], '');
|
|
else
|
|
$str_risks .= ',' . getTableFieldValue('health_risk', 'health_risk_name', 'health_risk_id', $risks[$i], '');
|
|
}
|
|
echo $str_risks;
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!-- /#feed -->
|
|
|
|
<div id="edit-settings" class="tab-pane">
|
|
<div class="space-10"></div>
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
Family Members
|
|
<?php if (strcmp($accessOption, "E") ==0){?>
|
|
<div class="btn-group" style="margin-left: 900px">
|
|
<button type="button" class="btn btn-info"
|
|
onclick="addFamilyMembersRow()" id="addButton">
|
|
<span class="glyphicon glyphicon-plus"></span>
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
<?php }else{
|
|
|
|
|
|
|
|
}?>
|
|
|
|
</div>
|
|
<div class="panel-body">
|
|
<table class="table table-bordered table-hover"
|
|
id="familyMembersTable">
|
|
<tbody>
|
|
<tr>
|
|
<th>Sr</th>
|
|
<th>Name</th>
|
|
<th>Age</th>
|
|
<th>Gender</th>
|
|
<th>Relation Type</th>
|
|
<th></th>
|
|
</tr>
|
|
<?php
|
|
$count = 0;
|
|
$sql_family_members = "select * from emp_family_members where emp_id=$emp_id ";
|
|
|
|
$result_family_members = @mysqli_query($conn,$sql_family_members);
|
|
$no_of_rows = mysqli_num_rows($result_family_members);
|
|
if ($no_of_rows > 0) {
|
|
?>
|
|
<input type="hidden"
|
|
name="rowCount" id="rowCount"
|
|
value="<?php echo $no_of_rows; ?>" />
|
|
|
|
<?php }else{?>
|
|
<input type="hidden"
|
|
name="rowCount" id="rowCount" value="1" />
|
|
<?php
|
|
}
|
|
?>
|
|
|
|
<?php
|
|
if ($no_of_rows > 0) {
|
|
while ($row_family_members = @mysqli_fetch_array($result_family_members)) {
|
|
?>
|
|
<tr
|
|
id="familyMembersTableRow<?php echo $count;?>">
|
|
<td> <?php echo $count+1;?></td>
|
|
<td><input type="text" name="name<?php echo $count;?>"
|
|
id="name<?php echo $count;?>"
|
|
value="<?php echo $row_family_members['name'] ?>"
|
|
class="form-control" /></td>
|
|
<td><input type="number" id="age<?php echo $count?>"
|
|
name="age<?php echo $count;?>"
|
|
value="<?php echo $row_family_members['age'] ?>"
|
|
class="form-control" /></td>
|
|
<td><select class="form-control" name="gender<?php echo $count?>"
|
|
id="gender<?php echo $count?>">
|
|
<option value="" disabled>--Select Gender</option>
|
|
<option value="M"
|
|
<?php if($row_family_members['gender']=="M") echo "selected" ?>>Male</option>
|
|
<option value="F"
|
|
<?php if($row_family_members['gender']=="F") echo "selected" ?>>Female</option>
|
|
<option value="O"
|
|
<?php if($row_family_members['gender']=="O") echo "selected" ?>>Others</option>
|
|
|
|
|
|
</select></td>
|
|
<td><input type="text" name="relation_type<?php echo $count?>"
|
|
id="relation_type<?php echo $count?>"
|
|
value="<?php echo $row_family_members['relation_type'] ?>"
|
|
class="form-control" /></td>
|
|
<th></th>
|
|
</tr>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
++ $count;
|
|
}
|
|
} else {
|
|
?>
|
|
|
|
<td>1</td>
|
|
<td><input type="text" name="name0" id="name0"
|
|
class="form-control" /></td>
|
|
<td><input type="number" id="age0" name="age0"
|
|
class="form-control" /></td>
|
|
<td><select class="form-control" name="gender0"
|
|
id="gender0">
|
|
<option value="" selected disabled>--Select Gender</option>
|
|
<option value="M">Male</option>
|
|
<option value="F">Female</option>
|
|
<option value="O">Others</option>
|
|
|
|
|
|
</select></td>
|
|
<td><input type="text" name="relation_type0"
|
|
id="relation_type0" class="form-control" /></td>
|
|
<th></th>
|
|
</tr>
|
|
<?php
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<?php
|
|
|
|
if (strcmp($accessOption, "E") ==0) {
|
|
|
|
?>
|
|
<div class="clearfix form-actions">
|
|
<div class="col-md-offset-3 col-md-9">
|
|
<button class="btn btn-info" type="button"
|
|
onclick="save_employee()">
|
|
<i class="ace-icon fa fa-check bigger-110"></i> Save
|
|
</button>
|
|
|
|
|
|
<button class="btn" type="reset">
|
|
<i class="ace-icon fa fa-undo bigger-110"></i> Reset
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<?php }?>
|
|
|
|
</form>
|
|
</div>
|
|
<!-- end user profile2 -->
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
<!-- /.page-content -->
|
|
</div>
|
|
</div>
|
|
<!-- /.main-content -->
|
|
|
|
|
|
<!-- page specific plugin scripts -->
|
|
|
|
<!--[if lte IE 8]>
|
|
<script src="assets/js/excanvas.min.js"></script>
|
|
<![endif]-->
|
|
<script src="assets/js/jquery-ui.custom.min.js"></script>
|
|
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
|
|
<script src="assets/js/jquery.gritter.min.js"></script>
|
|
<script src="assets/js/bootbox.js"></script>
|
|
<script src="assets/js/jquery.easypiechart.min.js"></script>
|
|
<script src="assets/js/bootstrap-datepicker.min.js"></script>
|
|
<script src="assets/js/jquery.hotkeys.index.min.js"></script>
|
|
<script src="assets/js/bootstrap-wysiwyg.min.js"></script>
|
|
<script src="assets/js/select2.min.js"></script>
|
|
<script src="assets/js/spinbox.min.js"></script>
|
|
<script src="assets/js/bootstrap-editable.min.js"></script>
|
|
<script src="assets/js/ace-editable.min.js"></script>
|
|
<script src="assets/js/jquery.maskedinput.min.js"></script>
|
|
|
|
<!-- ace scripts -->
|
|
<script src="assets/js/ace-elements.min.js"></script>
|
|
<script src="assets/js/ace.min.js"></script>
|
|
|
|
<!-- inline scripts related to this page -->
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
jQuery(function($) {
|
|
|
|
//editables on first profile page
|
|
$.fn.editable.defaults.mode = 'inline';
|
|
$.fn.editableform.loading = "<div class='editableform-loading'><i class='ace-icon fa fa-spinner fa-spin fa-2x light-blue'></i></div>";
|
|
$.fn.editableform.buttons = '<button type="submit" class="btn btn-info editable-submit"><i class="ace-icon fa fa-check"></i></button>'+
|
|
'<button type="button" class="btn editable-cancel"><i class="ace-icon fa fa-times"></i></button>';
|
|
|
|
//editables
|
|
|
|
|
|
|
|
// *** editable avatar *** //
|
|
try {//ie8 throws some harmless exceptions, so let's catch'em
|
|
|
|
//first let's add a fake appendChild method for Image element for browsers that have a problem with this
|
|
//because editable plugin calls appendChild, and it causes errors on IE at unpredicted points
|
|
try {
|
|
document.createElement('IMG').appendChild(document.createElement('B'));
|
|
} catch(e) {
|
|
Image.prototype.appendChild = function(el){}
|
|
}
|
|
|
|
var last_gritter
|
|
$('#avatar').editable({
|
|
type: 'image',
|
|
name: 'avatar',
|
|
value: null,
|
|
//onblur: 'ignore', //don't reset or hide editable onblur?!
|
|
image: {
|
|
//specify ace file input plugin's options here
|
|
btn_choose: 'Change Image',
|
|
droppable: true,
|
|
|
|
maxSize: 660000,//~600Kb
|
|
|
|
//and a few extra ones here
|
|
name: 'photo',//put the field name here as well, will be used inside the custom plugin
|
|
on_error : function(error_type) {//on_error function will be called when the selected file has a problem
|
|
if(last_gritter) $.gritter.remove(last_gritter);
|
|
if(error_type == 1) {//file format error
|
|
last_gritter = $.gritter.add({
|
|
title: 'File is not an image!',
|
|
text: 'Please choose a jpg|gif|png image!',
|
|
class_name: 'gritter-error gritter-center'
|
|
});
|
|
} else if(error_type == 2) {//file size rror
|
|
last_gritter = $.gritter.add({
|
|
title: 'File too big!',
|
|
text: 'Image size should not exceed 600Kb!',
|
|
class_name: 'gritter-error gritter-center'
|
|
});
|
|
}
|
|
else {//other error
|
|
}
|
|
},
|
|
on_success : function() {
|
|
$.gritter.removeAll();
|
|
}
|
|
},
|
|
url: function(params) {
|
|
// ***UPDATE AVATAR HERE*** //
|
|
//for a working upload example you can replace the contents of this function with
|
|
//examples/profile-avatar-update.js
|
|
|
|
var deferred = new $.Deferred
|
|
|
|
var value = $('#avatar').next().find('input[type=hidden]:eq(0)').val();
|
|
if(!value || value.length == 0) {
|
|
deferred.resolve();
|
|
return deferred.promise();
|
|
}
|
|
var formData_object = new FormData();
|
|
var avatar = '#avatar';
|
|
var $form = $(avatar).next().find('.editableform:eq(0)')
|
|
var file_input = $form.find('input[type=file]:eq(0)');
|
|
$form.find('input[type=file]').each(function(){
|
|
var field_name = $(this).attr('name');
|
|
var files = $(this).data('ace_input_files');
|
|
if(files && files.length > 0) {
|
|
var clone = $(this).clone();
|
|
clone.attr('name', 'photo');
|
|
$("#uploadForm").html(clone);
|
|
}
|
|
});
|
|
|
|
//dummy upload
|
|
setTimeout(function(){
|
|
if("FileReader" in window) {
|
|
//for browsers that have a thumbnail of selected image
|
|
var thumb = $('#avatar').next().find('img').data('thumb');
|
|
if(thumb) $('#avatar').get(0).src = thumb;
|
|
}
|
|
|
|
deferred.resolve({'status':'OK'});
|
|
|
|
if(last_gritter) $.gritter.remove(last_gritter);
|
|
last_gritter = $.gritter.add({
|
|
title: 'Image Updated!',
|
|
text: '',
|
|
class_name: 'gritter-info gritter-center'
|
|
});
|
|
|
|
} , parseInt(Math.random() * 800 + 800))
|
|
|
|
return deferred.promise();
|
|
|
|
// ***END OF UPDATE AVATAR HERE*** //
|
|
},
|
|
|
|
success: function(response, newValue) {
|
|
}
|
|
})
|
|
}catch(e) {}
|
|
|
|
|
|
//let's display edit mode by default?
|
|
var blank_image = true;
|
|
<?php if(!isset($row['photo']) || $row['photo']==null){?>
|
|
blank_image = false;
|
|
<?php } ?>
|
|
//somehow you determine if image is initially blank or not, or you just want to display file input at first
|
|
/*if(blank_image) {
|
|
$('#avatar').editable('show').on('hidden', function(e, reason) {
|
|
if(reason == 'onblur') {
|
|
$('#avatar').editable('show');
|
|
return;
|
|
}
|
|
$('#avatar').off('hidden');
|
|
})
|
|
}*/
|
|
|
|
|
|
//another option is using modals
|
|
$('#avatar2').on('click', function(){
|
|
var modal =
|
|
'<div class="modal fade">\
|
|
<div class="modal-dialog">\
|
|
<div class="modal-content">\
|
|
<div class="modal-header">\
|
|
<button type="button" class="close" data-dismiss="modal">×</button>\
|
|
<h4 class="blue">Change Profile Image</h4>\
|
|
</div>\
|
|
\
|
|
<form class="no-margin">\
|
|
<div class="modal-body" style="width:100%; height:100%;">\
|
|
<div class="space-4"></div>\
|
|
<div style="width:75%; height:80%; margin-left:12%;">';
|
|
modal+=$("#fileUploadDiv").html();
|
|
modal+= '</div>\
|
|
</div>\
|
|
\
|
|
<div class="modal-footer center">\
|
|
<button type="submit" class="btn btn-sm btn-success"><i class="ace-icon fa fa-check"></i> Submit</button>\
|
|
<button type="button" class="btn btn-sm" data-dismiss="modal"><i class="ace-icon fa fa-times"></i> Cancel</button>\
|
|
</div>\
|
|
</form>\
|
|
</div>\
|
|
</div>\
|
|
</div>';
|
|
|
|
|
|
var modal = $(modal);
|
|
modal.modal("show").on("hidden", function(){
|
|
modal.remove();
|
|
});
|
|
|
|
var working = false;
|
|
|
|
var form = modal.find('form:eq(0)');
|
|
var file = form.find('input[type=file]').eq(0);
|
|
file.ace_file_input({
|
|
style:'well',
|
|
btn_choose:'Click to choose new Image',
|
|
btn_change:null,
|
|
no_icon:'ace-icon fa fa-picture-o',
|
|
thumbnail:'large',
|
|
before_remove: function() {
|
|
//don't remove/reset files while being uploaded
|
|
return !working;
|
|
},
|
|
allowExt: ['jpg', 'jpeg', 'png', 'gif'],
|
|
allowMime: ['image/jpg', 'image/jpeg', 'image/png', 'image/gif']
|
|
});
|
|
|
|
form.on('submit', function(){
|
|
if(!file.data('ace_input_files')) return false;
|
|
|
|
file.ace_file_input('disable');
|
|
form.find('button').attr('disabled', 'disabled');
|
|
form.find('.modal-body').append("<div class='center'><i class='ace-icon fa fa-spinner fa-spin bigger-150 orange'></i></div>");
|
|
|
|
var deferred = new $.Deferred;
|
|
working = true;
|
|
deferred.done(function() {
|
|
form.find('button').removeAttr('disabled');
|
|
form.find('input[type=file]').ace_file_input('enable');
|
|
form.find('.modal-body > :last-child').remove();
|
|
|
|
modal.modal("hide");
|
|
|
|
var thumb = file.next().find('img').data('thumb');
|
|
if(thumb){
|
|
$('#avatar2').get(0).src = thumb;
|
|
}
|
|
|
|
|
|
working = false;
|
|
});
|
|
|
|
|
|
setTimeout(function(){
|
|
deferred.resolve();
|
|
} , parseInt(Math.random() * 800 + 800));
|
|
|
|
return false;
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
///////////////////////////////////////////
|
|
|
|
//right & left position
|
|
//show the user info on right or left depending on its position
|
|
$('#user-profile-2 .memberdiv').on('mouseenter touchstart', function(){
|
|
var $this = $(this);
|
|
var $parent = $this.closest('.tab-pane');
|
|
|
|
var off1 = $parent.offset();
|
|
var w1 = $parent.width();
|
|
|
|
var off2 = $this.offset();
|
|
var w2 = $this.width();
|
|
|
|
var place = 'left';
|
|
if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) place = 'right';
|
|
|
|
$this.find('.popover').removeClass('right left').addClass(place);
|
|
}).on('click', function(e) {
|
|
e.preventDefault();
|
|
});
|
|
|
|
|
|
|
|
////////////////////
|
|
//change profile
|
|
$('[data-toggle="buttons"] .btn').on('click', function(e){
|
|
var target = $(this).find('input[type=radio]');
|
|
var which = parseInt(target.val());
|
|
$('.user-profile').parent().addClass('hide');
|
|
$('#user-profile-'+which).parent().removeClass('hide');
|
|
});
|
|
|
|
|
|
|
|
/////////////////////////////////////
|
|
$(document).one('ajaxloadstart.page', function(e) {
|
|
//in ajax mode, remove remaining elements before leaving page
|
|
try {
|
|
$('.editable').editable('destroy');
|
|
} catch(e) {}
|
|
$('[class*=select2]').remove();
|
|
});
|
|
});
|
|
</script>
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<?php include('common_ace.php'); ?>
|
|
|
|
<script>
|
|
|
|
|
|
function addHealthAdvicesAndRisksRow(){
|
|
var table = document.getElementById("health_advices_and_risks");
|
|
|
|
var rowCount = table.rows.length;
|
|
var newRow = table.insertRow(rowCount);
|
|
var health_advices="<?php echo generateOption('health_advice','health_advice_name','health_advice_id','',''); ?>"
|
|
var health_risks="<?php echo generateOption(' health_risk','health_risk_name','health_risk_id','',''); ?>"
|
|
var content=""
|
|
content+="<td><select multiple=\"\" name=\"known_health_advices[]\" id=\"known_health_advices\" class=\"chosen-select form-control\">"
|
|
//content+="<option value=\"\"> </option>";
|
|
content+=health_advices;
|
|
content+="</select></td>"
|
|
content+="<td><select multiple=\"\" id=\"known_health_risks\" name=\"known_health_risks[]\" class=\"chosen-select form-control\">"
|
|
// content+="<option value=\"\"> </option>";
|
|
content+=health_risks;
|
|
content+="</select></td>"
|
|
|
|
|
|
$(newRow).append(content);
|
|
$('#known_health_advices').chosen({allow_single_deselect:true});
|
|
$('#known_health_advices').next().css({'width': '100%'});
|
|
$('#known_health_risks').chosen({allow_single_deselect:true});
|
|
$('#known_health_risks').next().css({'width': '100%'});
|
|
|
|
var heath_advice_array=<?php echo json_encode($advices)?>;
|
|
|
|
var element = document.getElementById('known_health_advices');
|
|
|
|
|
|
for (var i = 0; i < element.options.length; i++) {
|
|
element.options[i].selected = heath_advice_array.indexOf(element.options[i].value) >= 0;
|
|
}
|
|
$('#known_health_advices').trigger('chosen:updated');
|
|
|
|
var heath_risk_array=<?php echo json_encode($risks)?>;
|
|
|
|
var element1 = document.getElementById('known_health_risks');
|
|
|
|
|
|
for (var i = 0; i < element1.options.length; i++) {
|
|
element1.options[i].selected = heath_risk_array.indexOf(element1.options[i].value) >= 0;
|
|
}
|
|
$('#known_health_risks').trigger('chosen:updated');
|
|
|
|
}
|
|
function addFamilyMembersRow(){
|
|
|
|
var count=parseInt($("#rowCount").val());
|
|
|
|
var table = document.getElementById("familyMembersTable");
|
|
|
|
var rowCount = table.rows.length;
|
|
var newRow = table.insertRow(rowCount);
|
|
|
|
var content="";
|
|
content+="<td>"+(count+1)+"</td>"
|
|
+"<td><input type=\"text\" name=\"name"+count+"\" id=\"name"+count+"\" class=\"form-control\"/></td>"
|
|
+"<td><input type=\"number\" id=\"age"+count+"\" name=\"age"+count+"\" class=\"form-control\"/></td>"
|
|
+"<td><select class=\"form-control\" name=\"gender"+count+"\" id=\"gender"+count+"\">"
|
|
+"<option selected disabled>--Select Gender</option>"
|
|
+" <option value=\"M\">Male</option>"
|
|
+" <option value=\"F\">Female</option>"
|
|
+" <option value=\"O\">Others</option>"
|
|
|
|
|
|
+"</select></td><td><input type=\"text\" class=\"form-control\" name=\"relation_type"+count+"\" id=\"relation_type"+count+"\" /></td>"
|
|
+"<td><a href=\"#\" onclick=\"deleteFamilyMembersRow("+count+")\"><span class=\"glyphicon glyphicon-trash\"></span> </a></td>"
|
|
|
|
|
|
|
|
|
|
$(newRow).append(content);
|
|
$(newRow).attr("id", "familyMembersTableRow" + count);
|
|
$("#rowCount").val(++count);
|
|
|
|
|
|
|
|
}
|
|
|
|
function deleteFamilyMembersRow(count){
|
|
$("#familyMembersTableRow"+count).remove();
|
|
$("#rowCount").val(count);
|
|
|
|
}
|
|
|
|
function myDateFormater(myDate){
|
|
var d=new Date(myDate);
|
|
var m=d.getMonth()+1;
|
|
var y=d.getFullYear();
|
|
var date=d.getDate();
|
|
// alert(date+"/"+m+"/"+y);
|
|
return date+"/"+m+"/"+y;
|
|
|
|
|
|
}
|
|
|
|
$(document).ready(function(e){
|
|
$("#employee_form").on('submit', function(e){
|
|
e.preventDefault();
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: 'save_employee.php',
|
|
data: new FormData(this),
|
|
contentType: false,
|
|
cache: false,
|
|
processData:false,
|
|
beforeSend: function(){
|
|
// $('.submitBtn').attr("disabled","disabled");
|
|
//$('#fupForm').css("opacity",".5");
|
|
},
|
|
success: function(msg){
|
|
var emp_id=JSON.parse(msg);
|
|
BootstrapDialog.alert('Employee Saved Successfully.');
|
|
$("#flex1").flexReload();
|
|
$("#employee_id").val(emp_id);
|
|
$('.close').click();
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Saving Employee');
|
|
$('.close').click();
|
|
return;
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
function save_employee(){
|
|
var fname = $('#fname').val();
|
|
if(fname == ''){
|
|
BootstrapDialog.alert('Please Enter First Name.!!!');
|
|
return false;
|
|
}
|
|
var lname = $('#lname').val();
|
|
if(lname == ''){
|
|
BootstrapDialog.alert('Please Enter Last Name.!!!');
|
|
return false;
|
|
}
|
|
var fathername = $('#father_name').val();
|
|
if(fathername == ''){
|
|
BootstrapDialog.alert('Please Enter Father Name.!!!');
|
|
return false;
|
|
}
|
|
var dob = $('#dob').val();
|
|
if(dob == ''){
|
|
BootstrapDialog.alert('Please Enter DOB.!!!');
|
|
return false;
|
|
}
|
|
var doj = $('#doj').val();
|
|
if(doj == ''){
|
|
BootstrapDialog.alert('Please Enter DOJ.!!!');
|
|
return false;
|
|
}
|
|
var designationid = $('#designationid').val();
|
|
if(designationid == ''){
|
|
BootstrapDialog.alert('Please Enter Designation Id.!!!');
|
|
return false;
|
|
}
|
|
var emp_code = $('#emp_code').val();
|
|
if(emp_code == ''){
|
|
BootstrapDialog.alert('Please Enter Employee Code.!!!');
|
|
return false;
|
|
}
|
|
var emp_type_id = $('#emp_type_id').val();
|
|
if(emp_type_id == ''){
|
|
BootstrapDialog.alert('Please Enter Employee Type Id.!!!');
|
|
return false;
|
|
}
|
|
var bu_id = $('#bu_id').val();
|
|
if(bu_id == ''){
|
|
BootstrapDialog.alert('Please Enter Bu Id.!!!');
|
|
return false;
|
|
}
|
|
var sbu_id = $('#sbu_id').val();
|
|
if(sbu_id == ''){
|
|
BootstrapDialog.alert('Please Enter SBU Id.!!!');
|
|
return false;
|
|
}
|
|
var section_id = $('#section_id').val();
|
|
if(section_id == ''){
|
|
BootstrapDialog.alert('Please Enter Section Id.!!!');
|
|
return false;
|
|
}
|
|
var sub_section_id = $('#sub_section_id').val();
|
|
if(sub_section_id == ''){
|
|
BootstrapDialog.alert('Please Enter Sub Section Id.!!!');
|
|
return false;
|
|
}
|
|
var mgr_emp_id = $('#mgr_emp_id').val();
|
|
if(mgr_emp_id == ''){
|
|
BootstrapDialog.alert('Please Enter Manager.!!!');
|
|
return false;
|
|
}
|
|
var gender = $('#gender').val();
|
|
if(gender == ''){
|
|
BootstrapDialog.alert('Please Select Gender.!!!');
|
|
return false;
|
|
}
|
|
var address = $('#address').val();
|
|
if(address == ''){
|
|
BootstrapDialog.alert('Please Enter Address.!!!');
|
|
return false;
|
|
}
|
|
var primary_phone = $('#primary_phone').val();
|
|
if(primary_phone == ''){
|
|
BootstrapDialog.alert('Please Enter Phone No.!!!');
|
|
return false;
|
|
}
|
|
var email = $('#email').val();
|
|
if(email == ''){
|
|
BootstrapDialog.alert('Please Enter Email.!!!');
|
|
return false;
|
|
}
|
|
var aadhar_no = $('#aadhar_no').val();
|
|
if(aadhar_no == ''){
|
|
BootstrapDialog.alert('Please Aadhar No.!!!');
|
|
return false;
|
|
}
|
|
var blood_group = $('#blood_group').val();
|
|
if(blood_group == ''){
|
|
BootstrapDialog.alert('Please Select Blood Group.!!!');
|
|
return false;
|
|
}
|
|
$("#employee_form").submit();
|
|
/* $.ajax({
|
|
type: 'POST',
|
|
url: 'save_employee.php',
|
|
data:$("#employee_form").serialize(),
|
|
|
|
success: function(msg){
|
|
BootstrapDialog.alert('Employee Saved Successfully.');
|
|
$("#flex1").flexReload();
|
|
$('.close').click();
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Saving Employee');
|
|
$('.close').click();
|
|
return;
|
|
}
|
|
}); */
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
$('#doj').datepicker({
|
|
autoclose:true,
|
|
|
|
format: 'dd/mm/yyyy',
|
|
startDate: '1d/1m/2000y',
|
|
endDate: 'current',
|
|
todayHighlight: true,
|
|
|
|
}).next().on(ace.click_event, function(){
|
|
$(this).prev().focus();
|
|
});
|
|
$('#dob').datepicker({
|
|
autoclose:true,
|
|
format: 'dd/mm/yyyy',
|
|
startDate: '1d/1m/1970y',
|
|
|
|
}).next().on(ace.click_event, function(){
|
|
$(this).prev().focus();
|
|
|
|
});
|
|
|
|
</script>
|