362 lines
12 KiB
PHP
362 lines
12 KiB
PHP
|
|
<script>
|
|
function validate_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();
|
|
|
|
//save_employee();
|
|
}
|
|
</script>
|
|
<script>
|
|
$(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){
|
|
BootstrapDialog.alert('Employee Saved Successfully.');
|
|
$("#flex1").flexReload();
|
|
$('.close').click();
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Saving Employee');
|
|
$('.close').click();
|
|
return;
|
|
}
|
|
});
|
|
});
|
|
|
|
//file type validation
|
|
$("#photo").change(function() {
|
|
var file = this.files[0];
|
|
var imagefile = file.type;
|
|
var match= ["image/jpeg","image/png","image/jpg"];
|
|
if(!((imagefile==match[0]) || (imagefile==match[1]) || (imagefile==match[2]))){
|
|
alert('Please select a valid image file (JPEG/JPG/PNG).');
|
|
$("#file").val('');
|
|
return false;
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
function ValidateSize(file) {
|
|
var FileSize = file.files[0].size / 250 / 250; // in MB
|
|
if (FileSize > 2) {
|
|
alert('File size exceeds 250 KB');
|
|
// $(file).val(''); //for clearing with Jquery
|
|
} else {
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
#modal-add-ailment{
|
|
overflow-y:scroll;
|
|
}
|
|
</style>
|
|
<div class="modal fade" id="modal-add-employee" name="modal-add-employee" role="dialog" aria-hidden="true">
|
|
<form role="form" id="employee_form" name="employee_form" enctype="multipart/form-data" action="#" method="post">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="widget-header">
|
|
<h5 class="widget-title">Employee</h5>
|
|
<div class="widget-toolbar">
|
|
<div class="widget-menu">
|
|
<a href="#" class="close" data-action="close" data-dismiss="modal">
|
|
<i class="ace-icon fa fa-times"></i>
|
|
</a>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Photo (Max : 250kb)</label>
|
|
<img src="" height="72" width="70" style="border-radius: 40%; margin-left: 40px;" id="profile_photo" name="profile_photo" class="img-thumnail" />
|
|
|
|
<input style=" height:30px" type="file" id="photo" class="form-control" name="photo" onchange="ValidateSize(this)" required/>
|
|
</div>
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="role">First Name</label>
|
|
<input style=" height:30px" type="text" class="form-control" name="fname"
|
|
id="fname" placeholder="Enter First Name" autofocus="autofocus" required/>
|
|
<input type="hidden" class="form-control" name="employee_id"
|
|
id="employee_id" placeholder="Enter First Name" required/>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Last Name</label>
|
|
<input style=" height:30px" type="text" class="form-control" name="lname"
|
|
id="lname" placeholder="Enter Last Name" required/>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Father's Name</label>
|
|
<input style=" height:30px" type="text" class="form-control" name="father_name"
|
|
id="father_name" placeholder="Enter Father's Name" required/>
|
|
</div>
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="dob">Date Of Birth</label><br>
|
|
<div class="input-group">
|
|
<input style=" height:30px" class="form-control date-picker" name="dob" id="dob" type="text" data-date-format="dd/mm/yyyy" />
|
|
<span class="input-group-addon">
|
|
<i class="fa fa-calendar bigger-110"></i>
|
|
</span>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="doj">Date Of Joining</label><br>
|
|
<div class="input-group">
|
|
<input style=" height:30px" class="form-control date-picker" name="doj" id="doj" type="text" data-date-format="dd/mm/yyyy" />
|
|
<span class="input-group-addon">
|
|
<i class="fa fa-calendar bigger-110"></i>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="section_head">Designation </label>
|
|
<select style=" height:30px" class="form-control" name="designation_id" id="designation_id" >
|
|
<?php echo generateOption('designation','designation_name','designation_id','2',''); ?>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Employee Code</label>
|
|
<input style=" height:30px" type="text" class="form-control" name="emp_code"
|
|
id="emp_code" placeholder="Enter Employee Code" required/>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Employment Type </label>
|
|
<select style=" height:30px" class="form-control" name="emp_type_id"
|
|
id="emp_type_id" >
|
|
<?php echo generateOption('employee_category','emp_cat_name','emp_cat_id','',''); ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="section_head">Business Unit</label>
|
|
<select style=" height:30px" class="form-control" name="bu_id" id="bu_id" >
|
|
<?php echo generateOption('tbl_firms','firm_name','firm_id','',''); ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="section_head">Sub Business unit</label>
|
|
<select style=" height:30px" class="form-control" name="sbu_id" id="sbu_id" >
|
|
<?php echo generateOption('sub_business_unit','sbu_name','sbu_id','',''); ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="section_head">Section </label>
|
|
<select style=" height:30px" class="form-control" name="section_id" id="section_id" >
|
|
<?php echo generateOption('section','section_name','section_id',''); ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="section_head">Sub Section </label>
|
|
<select style=" height:30px" class="form-control" name="sub_section_id" id="sub_section_id" >
|
|
<?php echo generateOption('sub_section','sub_section_name','sub_section_id',''); ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Manager</label>
|
|
<select style=" height:30px" class="form-control" name="mgr_emp_id" id="mgr_emp_id" >
|
|
<?php echo generateOption('employee','fname','id',''); ?>
|
|
</select>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Gender</label><br>
|
|
<select style=" height:30px" class="form-control" name="gender"
|
|
id="gender" >
|
|
<option selected value="M">Male</option>
|
|
<option value="F">Female</option>
|
|
<option value="O">Others</option>
|
|
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class= "row">
|
|
|
|
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Address</label>
|
|
<input style=" height:30px" style=" height:30px" type="text" class="form-control" name="address"
|
|
id="address" placeholder="Enter Address" required/>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Primary Phone</label>
|
|
<input style=" height:30px" type="text" class="form-control" name="primary_phone"
|
|
id="primary_phone" placeholder="Enter Primary Phone No." required/>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Email</label>
|
|
<input style=" height:30px" type="text" class="form-control" name="email"
|
|
id="email" placeholder="Enter Email" required/>
|
|
</div>
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Aadhar No</label>
|
|
<input style=" height:30px" type="text" class="form-control" name="aadhar_no"
|
|
id="aadhar_no" placeholder="Enter Aadhar No" required/>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
|
|
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Blood Group</label><br>
|
|
|
|
<select style=" height:30px" class="form-control" name="blood_group"
|
|
id="blood_group" >
|
|
<?php echo generateOption('blood_group','type','type','O+',''); ?>
|
|
</select>
|
|
</div>
|
|
|
|
|
|
<div class="form-group col-sm-3">
|
|
<label for="ailment">Is First Aider</label><br>
|
|
|
|
<select style=" height:30px" class="form-control" name="has_first_aid"
|
|
id="has_first_aid" >
|
|
<option value="1">Yes</option>
|
|
<option value="0" selected>No</option>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="widget-toolbox padding-8 clearfix" >
|
|
<button type="button" class="btn btn-info btn-sm save_button" onclick="validate_employee();"><i class="ace-icon fa fa-floppy-o bigger-110"></i>Save </button>
|
|
<button type="button" class="btn btn-danger btn-sm" data-dismiss="modal"><i class="ace-icon fa fa-times bigger-110"></i>Cancel</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|