diff --git a/application/controllers/employeedetails.php b/application/controllers/employeedetails.php
index 22ed3226..0f1297a6 100644
--- a/application/controllers/employeedetails.php
+++ b/application/controllers/employeedetails.php
@@ -565,9 +565,10 @@ class employeedetails extends BaseController
'IsActive'=>$IsActive,'ProfilePic'=>$Picture,'Reference_Name'=>$referredby,
'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'CreatedBy'=>$createdby,
'personalEmailId'=>$comEmailId,'DriverLicense'=>$driverlicense,
- 'LicenseValidtill'=>$License_ExpiryDate,'PFNO'=>$PFno,'ESI'=>$ESIno,
- 'NomineeDetails'=>$Nominee,'AadharNo'=>$aadharfilename,'PANNo'=>$panfilename,'VoterID'=>$voterfilename);
-
+ 'LicenseValidtill'=>$License_ExpiryDate,'PFNO'=>$PFno,'ESI'=>$ESIno,'NomineeDetails'=>$Nominee,
+ 'AadharNo'=>$aadharno,'PANNo'=>$panno,'VoterID'=>$VoterID,
+ 'AadharFile'=>$aadharfilename,'PANFile'=>$panfilename,'VoterFile'=>$voterfilename);
+
$this->load->model('employeedetails_model');
// print_r($Employee);
@@ -649,8 +650,8 @@ class employeedetails extends BaseController
$this->form_validation->set_rules('departmentname', 'departmentname', 'callback_Dep_validate');
$this->form_validation->set_rules('eduqualifaction', 'eduqualifaction', 'callback_select_validate');
$this->form_validation->set_rules('referrercontno', 'referrercontno', 'trim|min_length[10]|max_length[10]');
- //$this->form_validation->set_rules('aadharno', 'aadharno ','trim|max_length[14]');
- //$this->form_validation->set_rules('panno', 'panno', 'trim|max_length[10]');
+ $this->form_validation->set_rules('aadharno', 'aadharno ','trim|max_length[14]');
+ $this->form_validation->set_rules('panno', 'panno', 'trim|max_length[10]');
$this->form_validation->set_rules('passportno', 'passportno', 'trim|min_length[9]|max_length[9]');
$this->form_validation->set_rules('accountno', 'accountno', 'trim|min_length[10]|max_length[20]');
$this->form_validation->set_rules('pfno', 'pfno', 'trim|min_length[22]|max_length[22]');
@@ -722,15 +723,16 @@ class employeedetails extends BaseController
$bankbranchname = $this->input->post('bankbranchname');
$bankaddress = $this->input->post('bankaddress');
$aadharno = $this->input->post('aadharno');
- //$panno = strtoupper($this->input->post('panno'));
- $panno = $this->input->post('panno');
+ $fileaadharno = $this->input->post('fileaadhar');
+ $panno = strtoupper($this->input->post('panno'));
+ $filepanno = $this->input->post('filepanno');
$passportno = strtoupper($this->input->post('passportno'));
$ValidTill = $this->input->post('ValidTill');
$addinfo = $this->input->post('addinfo');
$driverlicense = strtoupper($this->input->post ( 'Driverlicense' ));
$licenseExpiryDate = $this->input->post ( 'LicenseExpiryDate' );
- //$VoterID = strtoupper($this->input->post ( 'VoterID' ));
- $VoterID = $this->input->post ( 'VoterID' );
+ $VoterID = strtoupper($this->input->post ( 'VoterID' ));
+ $filevoterid = $this->input->post ( 'filevoter' );
$pfno = strtoupper($this->input->post('pfno'));
$esino = $this->input->post('esino');
$Nominee = $this->input->post('nomineename');
@@ -764,9 +766,9 @@ class employeedetails extends BaseController
}
}}
- $voter = (!empty($VoterID)) ? $VoterID : $voterfilename ;
- $pan = (!empty($panno)) ? $panno : $panfilename;
- $aadhar = (!empty($aadharno)) ? $aadharno : $aadharfilename;
+ $filevoter = (!empty($filevoterid)) ? $filevoterid : $voterfilename ;
+ $filepan = (!empty($filepanno)) ? $filepanno : $panfilename;
+ $fileaadhar = (!empty($fileaadharno)) ? $fileaadharno : $aadharfilename;
if( $chked != '')
{
@@ -813,7 +815,8 @@ class employeedetails extends BaseController
'IsActive'=>$IsActive,'ProfilePic'=>$Picture,'Reference_Name'=>$referredby,
'Reference_ContactNumber'=>$referrercontno,'Remarks'=>$addinfo,'UpdatedBY'=>$UpdatedBY,
'personalEmailId'=>$comEmailId,'DriverLicense'=>$driverlicense,'LicenseValidtill'=>$License_ExpiryDate,
- 'VoterID'=>$voter,'PFNO'=>$pfno,'ESI'=>$esino,'NomineeDetails'=>$Nominee);
+ 'VoterID'=>$voter,'PFNO'=>$pfno,'ESI'=>$esino,'NomineeDetails'=>$Nominee,
+ 'AadharFile'=>$fileaadhar,'PANFile'=>$filepan,'VoterFile'=>$filevoter);
// print_r($Employee);
$result = $this->employeedetails_model->UpdateEmployee($Employee,$EmpId);
diff --git a/application/models/employeedetails_model.php b/application/models/employeedetails_model.php
index 98d454e4..e1025c13 100644
--- a/application/models/employeedetails_model.php
+++ b/application/models/employeedetails_model.php
@@ -238,9 +238,9 @@ class employeedetails_model extends CI_Model
function removefiles($value,$Empid){
$str = explode("/",$value);
- if($str[0] == 'pan'){ $this->db->set('PANNo', null); }
- else if( $str[0] == 'aadhar'){ $this->db->set('AadharNo', null); }
- else if( $str[0] == 'voter'){ $this->db->set('VoterID', null); }
+ if($str[0] == 'pan'){ $this->db->set('PANFile', null); }
+ else if( $str[0] == 'aadhar'){ $this->db->set('AadharFile', null); }
+ else if( $str[0] == 'voter'){ $this->db->set('VoterFile', null); }
unlink("uploads/images/".$str[1]);
$this->db->where('EmpID =',$Empid);
$this->db->update('T_Employee_Details');
diff --git a/application/views/addemployee.php b/application/views/addemployee.php
index 9a3fbac6..6b9ed6bc 100644
--- a/application/views/addemployee.php
+++ b/application/views/addemployee.php
@@ -272,24 +272,24 @@
-
+
Passport Number
Passport Expiry Date
-
+
Driving License
@@ -396,7 +396,12 @@ $(function() {
$("#departmentname").select2();
$("#eduqualifaction").select2();
$("#bankbranchname").select2();
-
+
+$('#aadharno').on('keypress change', function () {
+ $(this).val(function (index, value) {
+ return value.replace(/\W/gi, '').replace(/(.{4})/g, '$1 ');
+ });
+});
// document.getElementById('aadharno').addEventListener('input', function (e) {
// e.target.value = e.target.value.replace(/[^\d]/g, '').replace(/(.{4})/g, '$1 ').trim();
// });
@@ -526,47 +531,50 @@ function onlyAlphabets(evt) {
//PAN Validate
-// function validatePAN() {
-// //var reg = /(?=.*[A-Za-z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Za-z]).{1,}$/;
-// var regpan = /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
-// var PAN = $('#panno').val();
+function validatePAN() {
+ //var reg = /(?=.*[A-Za-z]).{5,}(?=.*[0-9]).{4,}(?=.*[A-Za-z]).{1,}$/;
+var regpan = /^([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}?$/;
+var PAN = $('#panno').val();
-// if(PAN != '')
-// {
-// if (regpan.test(PAN) == false)
-// {
-// swal('Please Enter Valid PAN Number');
-// return (false);
-// }
-// else
-// {
-// return true;
-// }
-// }
+ if(PAN != '')
+ {
+ if (regpan.test(PAN) == false)
+ {
+ swal('Please Enter Valid PAN Number');
+ return (false);
+ }
+ else
+ {
+ return true;
+ }
+ }
-// }
-
-// function ValidateAadhar(){
-// //var reg = /^\d{12}$/
-// var reg = /^\d{4}\s\d{4}\s\d{4}$/
-// var aadhar = $('#aadharno').val();
-// //var aadhar_count = $('#aadharno').val().length;
-
-// if(aadhar != '' )// && aadhar_count != '')
-// {
-// if(reg.test(aadhar)== false)
-// {
-// swal('Please Enter Valid Aadhar Number');
-// return (false);
-// }
-// else
-// {
-// return true;
-// }
-// }
-// }
+}
+function ValidateAadhar(){
+ var reg = /^\d{4}\s\d{4}\s\d{4}$/;
+ var aadhar = $('#aadharno').val();
+
+ if(aadhar != '' )
+ {
+ if(reg.test(aadhar)== false)
+ {
+ alert('Please Enter Valid Aadhar Number');
+ return (false);
+ }
+ else
+ {
+ //alert('value inserted into database');
+ return true;
+ }
+ }
+ // else
+ // {
+ // //alert('aadhar is blank');
+ // alert('please Enter Aadhar number');
+ // }
+}
function getMobileValidation() {
var contactNumber = $('#ContactNumber').val().length;
@@ -798,7 +806,6 @@ function Validate()
else if(!getMobileValidation())
{ return false; }
-
if($("#emailid").val().length < 1)
{
swal('Please Enter Personal Email ID');
@@ -895,6 +902,7 @@ function Validate()
}
+// validation for employee email address already exists are not
$("#emailid").change(function () {
var id = $('#emailid').val();
@@ -959,7 +967,138 @@ function Validate()
});
-
+// validation for employee pan no already exists are not
+ $('#panno').change(function() {
+
+ var id = $('#panno').val();
+ if(id != '')
+ {
+ $.ajax({
+ data:{id:id},
+
+ type:"POST",
+ url:"employeedetails/checkPAN",
+ success:function(data) {
+ if(data)
+ {
+ // alert( data+""+" Employee already exists in the database.Please Change the Pan Card Number");
+ // $('#panno').val('');
+ // $('#panno').focus();
+
+ // var answer = confirm(data + " " +" Employee details is already exists in the database.Do you want to change the Employee details?")
+ // if (answer)
+ // {
+ // $('#panno').val('');
+ // $('#panno').focus();
+ // return false;
+ // }
+ // else
+ // {
+ // alert('please edit the PAN number in the Edit employee screen');
+ // window.location = 'employeedetails/employeeListing';
+ // }
+
+
+ swal({
+ title: data+" "+" Pan Card Number already exists in the database.",
+ text: " Do you want to Change the Pan Card Number ?",
+ type: "info",
+ showCancelButton: true,
+ confirmButtonColor: '#5d0411',
+ confirmButtonText: "Yes",
+ closeOnConfirm: false,
+ closeOnCancel: false
+ },
+ function(isConfirm){
+
+ if (isConfirm){
+ swal.close();
+ $('#panno').val('');
+ $('#panno').focus();
+ return false;
+
+ } else {
+ swal("Cancelled", "please edit the Pan Card Number in the edit employee screen", "error");
+ window.location = 'employeedetails/employeeListing';
+ }
+
+ });//sweet alert closed....
+
+ }
+
+ }
+
+ });
+ }
+
+});
+
+ // validation for employee aadharar number already exists are not
+ $('#aadharno').change(function() {
+
+ var id = $('#aadharno').val();
+ if(id != '')
+ {
+ $.ajax({
+ data:{id:id},
+
+ type:"POST",
+ url:"employeedetails/checkAadharNo",
+ success:function(data) {
+ if(data)
+ {
+ // alert( data+""+" Employee already exists in the database.Please Change the Aadhar card Number");
+ // $('#aadharno').val('');
+ // $('#aadharno').focus();
+
+ // var answer = confirm(data + " " +" employee details is already exists in the database.Do you want to change the Employee details?")
+ // if (answer)
+ // {
+ // $('#aadharno').val('');
+ // $('#aadharno').focus();
+ // return false;
+ // }
+ // else
+ // {
+ // alert('please edit the aadhar number in the edit employee screen');
+ // window.location = 'employeedetails/employeeListing';
+ // }
+
+
+ swal({
+ title: data+" "+" Aadhar card Number already exists in the database.",
+ text: " Do you want to change the Aadhar card Number ?",
+ type: "info",
+ showCancelButton: true,
+ confirmButtonColor: '#5d0411',
+ confirmButtonText: "Yes",
+ closeOnConfirm: false,
+ closeOnCancel: false
+ },
+ function(isConfirm){
+
+ if (isConfirm){
+ swal.close();
+ $('#aadharno').val('');
+ $('#aadharno').focus();
+ return false;
+ } else {
+ swal("Cancelled", "please edit the Aadhar card Number in the edit employee screen", "error");
+ window.location = 'employeedetails/employeeListing';
+ }
+
+ });//sweet alert closed....
+
+ }
+
+ }
+
+ });
+ }
+
+});
+
+
$('#bankbranchname').change(function()
{
diff --git a/application/views/editEmployee.php b/application/views/editEmployee.php
index b31d94c4..be71a6a8 100644
--- a/application/views/editEmployee.php
+++ b/application/views/editEmployee.php
@@ -44,7 +44,10 @@
$VoterID='';
$pfno = '';
$esino = '';
- $nominee ='';
+ $nominee ='';
+ $fileaadhar = '';
+ $filepan = '' ;
+ $filevoter = '';
if(!empty($EmpDetails))
{
@@ -108,9 +111,12 @@ if(!empty($EmpDetails))
$VoterID = $Emp->VoterID;
$a=array();
- if (!empty($AadharNo)){array_push($a,$AadharNo);}
- if (!empty($PANNo)){array_push($a,$PANNo); }
- if (!empty($VoterID)){array_push($a,$VoterID); }
+ $fileaadhar = $Emp->AadharFile;
+ $filepan = $Emp->PANFile;
+ $filevoter = $Emp->VoterFile;
+ if (!empty($fileaadhar)){array_push($a,$fileaadhar);}
+ if (!empty($filepan)){array_push($a,$filepan); }
+ if (!empty($filevoter)){array_push($a,$filevoter); }
//print_r($a);
$pfno = $Emp->PFNO;
@@ -558,14 +564,12 @@ if(!empty($EmpDetails))