hr module bug fix
This commit is contained in:
parent
3d3000e0f6
commit
24039a3d2e
@ -452,7 +452,15 @@ class Employeedetails extends BaseController
|
||||
$emailId = $this->request->getPost('emailId');
|
||||
//print_r($id);
|
||||
|
||||
$response = $this->employeedetails_model->checkMailExists($emailId);
|
||||
$result = $this->employeedetails_model->checkMailExists($emailId);
|
||||
|
||||
$result = $result->getResultArray();
|
||||
|
||||
$response = [
|
||||
"message" => "success",
|
||||
"data" => $result
|
||||
];
|
||||
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
@ -463,8 +471,14 @@ class Employeedetails extends BaseController
|
||||
$panNo = $this->request->getPost('panNo');
|
||||
//print_r($id);
|
||||
|
||||
$response = $this->employeedetails_model->checkPANExists($panNo);
|
||||
|
||||
$result = $this->employeedetails_model->checkPANExists($panNo);
|
||||
|
||||
$result = $result->getResultArray();
|
||||
|
||||
$response = [
|
||||
"message" => "success",
|
||||
"data" => $result
|
||||
];
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
|
||||
@ -477,7 +491,14 @@ class Employeedetails extends BaseController
|
||||
$aadharNo = $this->request->getPost('aadharNo');
|
||||
//print_r($id);
|
||||
|
||||
$response = $this->employeedetails_model->checkAadharExists($aadharNo);
|
||||
$result = $this->employeedetails_model->checkAadharExists($aadharNo);
|
||||
|
||||
$result = $result->getResultArray();
|
||||
|
||||
$response = [
|
||||
"message" => "success",
|
||||
"data" => $result
|
||||
];
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
@ -139,11 +139,7 @@ class Employeedetails_model extends Model
|
||||
}
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() > 0) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
return $query;
|
||||
}
|
||||
|
||||
function checkAadharExists($aadharNo, $Empid = '')
|
||||
@ -156,30 +152,22 @@ class Employeedetails_model extends Model
|
||||
}
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() > 0) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
return $query;
|
||||
|
||||
|
||||
}
|
||||
function checkPANExists($PANNo, $Empid = '')
|
||||
function checkPANExists($panNo, $Empid = '')
|
||||
{
|
||||
|
||||
$builder = $this->db->table('t_employee_details')->select('PANNo')
|
||||
->where('PANNo', $PANNo);
|
||||
->where('PANNo', $panNo);
|
||||
if ($Empid != '') {
|
||||
$builder->where('EmpID !=', $Empid);
|
||||
}
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() > 0) {
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1244,59 +1244,70 @@
|
||||
|
||||
}
|
||||
$("#emailid").change(function() {
|
||||
var emailId = $('#emailid').val();
|
||||
var emailId = $('#emailid').val();
|
||||
|
||||
// Validate email before proceeding
|
||||
if (validateEmail()) {
|
||||
$('#loader').show(); // Show loader before sending AJAX request
|
||||
// Validate email before proceeding
|
||||
if (validateEmail()) {
|
||||
$('#loader').show(); // Show loader before sending AJAX request
|
||||
|
||||
$.ajax({
|
||||
data: {
|
||||
emailId
|
||||
},
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeeEmailExist",
|
||||
|
||||
// Success callback for handling a successful response
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
$.ajax({
|
||||
data: {
|
||||
emailId
|
||||
},
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeeEmailExist",
|
||||
|
||||
// Success callback for handling a successful response
|
||||
success: function(response) {
|
||||
$('#loader').hide(); // Hide the loader after a successful response
|
||||
|
||||
alert(response.message);
|
||||
console.log(response.data[0]);
|
||||
console.log(response);
|
||||
|
||||
let responseCheck = response.data[0];
|
||||
let responseEmail=response.data[0].EmailId;
|
||||
|
||||
// Confirmation dialogue when email already exists
|
||||
var answer = confirm("Employee mail Id already exists in the database. Kindly Provide us another Email id");
|
||||
if(responseCheck ){
|
||||
if ( responseEmail == emailId) {
|
||||
|
||||
|
||||
// Confirmation dialogue when email already exists
|
||||
var answer = confirm("Employee mail Id already exists in the database. Kindly Provide us another Email id");
|
||||
|
||||
|
||||
$('#emailid').val(''); // Clear email input if user wants to change
|
||||
$('#emailid').focus(); // Set focus back to email input
|
||||
|
||||
|
||||
$('#emailid').val(''); // Clear email input if user wants to change
|
||||
$('#emailid').focus(); // Set focus back to email input
|
||||
|
||||
} else {
|
||||
$('#loader').hide(); // Hide loader if no data returned
|
||||
} else {
|
||||
$('#loader').hide(); // Hide loader if no data returned
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// Error callback to handle any errors in the request
|
||||
error: function(xhr, status, error) {
|
||||
$('#loader').hide(); // Ensure the loader is hidden on error
|
||||
console.log("AJAX Error: ", error); // Log the error for debugging
|
||||
console.log("Response Status: ", status); // Log status
|
||||
console.log("XHR Object: ", xhr); // Log full XHR object to see details
|
||||
alert('An error occurred while checking the email. Please try again.'); // Alert user of the error
|
||||
},
|
||||
|
||||
// Complete callback that always runs after the request (whether success or error)
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
},
|
||||
|
||||
// Error callback to handle any errors in the request
|
||||
error: function(xhr, status, error) {
|
||||
$('#loader').hide(); // Ensure the loader is hidden on error
|
||||
console.log("AJAX Error: ", error); // Log the error for debugging
|
||||
console.log("Response Status: ", status); // Log status
|
||||
console.log("XHR Object: ", xhr); // Log full XHR object to see details
|
||||
alert('An error occurred while checking the email. Please try again.'); // Alert user of the error
|
||||
},
|
||||
|
||||
// Complete callback that always runs after the request (whether success or error)
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#panno').change(function() {
|
||||
|
||||
var panNo = $('#panno').val();
|
||||
if (panNo != '') {
|
||||
if (validatePAN()) {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
@ -1305,9 +1316,20 @@
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeePANExist",
|
||||
success: function(data) {
|
||||
success: function(response) {
|
||||
$('#loader').hide();
|
||||
if (data) {
|
||||
|
||||
console.log(panNo);
|
||||
alert(response.message);
|
||||
console.log(response.data[0]);
|
||||
console.log(response);
|
||||
|
||||
|
||||
let responseCheck = response.data[0];
|
||||
let responsePanNo=response.data[0].PANNo;
|
||||
|
||||
if(responseCheck ){
|
||||
if (responsePanNo == panNo) {
|
||||
// alert( data+""+" Employee already exists in the database.Please Change the Pan Card Number");
|
||||
// $('#panno').val('');
|
||||
// $('#panno').focus();
|
||||
@ -1322,25 +1344,22 @@
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
//alert();
|
||||
alert('Please enter the PAN Number');
|
||||
$('#panno').focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
//
|
||||
$('#aadharno').change(function() {
|
||||
|
||||
var aadharNo = $('#aadharno').val();
|
||||
if (aadharNo) {
|
||||
if (ValidateAadhar()) {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
@ -1349,34 +1368,42 @@
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeecheckAadharNoExist",
|
||||
success: function(data) {
|
||||
success: function(response) {
|
||||
$('#loader').hide();
|
||||
console.log(data);
|
||||
if (data) {
|
||||
|
||||
console.log(aadharNo);
|
||||
alert(response.message);
|
||||
console.log(response.data[0]);
|
||||
console.log(response);
|
||||
|
||||
let responseCheck = response.data[0];
|
||||
let responseAadharNo=response.data[0].AadharNo;
|
||||
|
||||
|
||||
//let response=response.data[0];
|
||||
if(responseCheck ){
|
||||
if ( responseAadharNo == aadharNo) {
|
||||
|
||||
|
||||
var answer = confirm(
|
||||
" Aadhar details is already exists !!.Kindly Change Aadhar Details"
|
||||
)
|
||||
|
||||
$('#aadharno').val('');
|
||||
$('#aadharno').focus();
|
||||
return false;
|
||||
|
||||
var answer = confirm(
|
||||
" Aadhar details is already exists !!.Kindly Change Aadhar Details"
|
||||
)
|
||||
|
||||
$('#aadharno').val('');
|
||||
$('#aadharno').focus();
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
//alert();
|
||||
alert('Please enter the Aadhar Number');
|
||||
$('#aadharno').focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -353,9 +353,9 @@ if (!empty($EmpDetails)) {
|
||||
<div class="row mb-3">
|
||||
|
||||
<div class="col-md-4 pad">
|
||||
<label>Official Email ID</label>
|
||||
<label>Official Email ID</label><span class="badge">*</span>
|
||||
<input type="mail" name="emailid"
|
||||
value="<?php echo $EmailId; ?>" id="email"
|
||||
value="<?php echo $EmailId; ?>" id="email" required
|
||||
placeholder="Email ID" maxlength="100" class="form-control">
|
||||
</div>
|
||||
|
||||
@ -913,9 +913,9 @@ if (!empty($EmpDetails)) {
|
||||
value="<?php echo $AadharNo; ?>" title=" : 12 digit number">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>PAN Number</label>
|
||||
<label>PAN Number</label><span class="badge">*</span>
|
||||
<input type="text" id="panno" style="text-transform: uppercase"
|
||||
maxlength="10" name="panno" placeholder="PAN Number"
|
||||
maxlength="10" name="panno" placeholder="PAN Number" required
|
||||
onchange="validatePAN();" class="form-control"
|
||||
value="<?php echo $PANNo; ?>"
|
||||
onkeypress="return alpha(event);"
|
||||
@ -1583,7 +1583,7 @@ if (!empty($EmpDetails)) {
|
||||
$("#email").change(function() {
|
||||
|
||||
var emailId = $('#email').val();
|
||||
if (validateEmail()) {
|
||||
if (validateEmail() && emailId != "<?= $EmailId ?>") {
|
||||
$('#loader').show();
|
||||
|
||||
$.ajax({
|
||||
@ -1593,14 +1593,25 @@ if (!empty($EmpDetails)) {
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeeEmailExist",
|
||||
success: function(data) {
|
||||
$('#loader').hide();
|
||||
success: function(response) {
|
||||
$('#loader').hide(); // Hide the loader after a successful response
|
||||
|
||||
if (data != emailId) {
|
||||
alert(data + "" +
|
||||
alert(response.message);
|
||||
console.log(response.data[0]);
|
||||
console.log(response);
|
||||
|
||||
let responseCheck = response.data[0];
|
||||
let responseEmail=response.data[0].EmailId;
|
||||
|
||||
if(responseCheck ){
|
||||
if ( responseEmail == emailId) {
|
||||
alert(
|
||||
"Another Employee already exists !!.Please Change the mail id");
|
||||
$("#email").val('');
|
||||
$("#email").focus();
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
@ -1614,7 +1625,7 @@ if (!empty($EmpDetails)) {
|
||||
$('#panno').change(function() {
|
||||
|
||||
var panNo = $('#panno').val();
|
||||
if (panNo != '') {
|
||||
if (validatePAN() && panNo != "<?= $PANNo ?>" ) {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
@ -1623,16 +1634,28 @@ if (!empty($EmpDetails)) {
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeePANExist",
|
||||
success: function(data) {
|
||||
success: function(response) {
|
||||
$('#loader').hide();
|
||||
if (data != panNo ) {
|
||||
|
||||
console.log(panNo);
|
||||
alert(response.message);
|
||||
console.log(response.data[0]);
|
||||
console.log(response);
|
||||
|
||||
|
||||
let responseCheck = response.data[0];
|
||||
let responsePanNo=response.data[0].PANNo;
|
||||
|
||||
if(responseCheck ){
|
||||
if (responsePanNo == panNo) {
|
||||
alert(
|
||||
" Employee with this pan number already exists in the database.Please Change the Pan Card Number"
|
||||
);
|
||||
$('#panno').val('');
|
||||
$('#panno').focus();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
,
|
||||
@ -1646,7 +1669,7 @@ if (!empty($EmpDetails)) {
|
||||
$('#aadharno').change(function() {
|
||||
|
||||
var aadharNo = $('#aadharno').val();
|
||||
if (aadharNo != '') {
|
||||
if (ValidateAadhar() && aadharNo != "<?= $AadharNo ?>" ) {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
@ -1654,9 +1677,21 @@ if (!empty($EmpDetails)) {
|
||||
},
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeecheckAadharNoExist",
|
||||
success: function(data) {
|
||||
success: function(response) {
|
||||
$('#loader').hide();
|
||||
if (data != aadharNo) {
|
||||
|
||||
console.log(aadharNo);
|
||||
alert(response.message);
|
||||
console.log(response.data[0]);
|
||||
console.log(response);
|
||||
|
||||
let responseCheck = response.data[0];
|
||||
let responseAadharNo=response.data[0].AadharNo;
|
||||
|
||||
|
||||
//let response=response.data[0];
|
||||
if(responseCheck ){
|
||||
if ( responseAadharNo == aadharNo) {
|
||||
alert(
|
||||
"Another Employee with this aadhar number already exists ..!!.Please Change the Aadhar card Number"
|
||||
);
|
||||
@ -1665,6 +1700,7 @@ if (!empty($EmpDetails)) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
,
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
|
||||
Loading…
Reference in New Issue
Block a user