0ct/09 -vadivel j
This commit is contained in:
parent
22de98c308
commit
3d3000e0f6
@ -380,14 +380,14 @@ class Employeedetails extends BaseController
|
||||
|
||||
// $this->session->set_flashdata('Success', 'New Employee created successfully!');
|
||||
$this->session->setFlashdata('success', 'New Employee created successfully!');
|
||||
return json_encode('true');
|
||||
// echo "<script>alert('New Employee Created successfully!');</script>";
|
||||
// return json_encode('true');
|
||||
echo "<script>alert('New Employee Created successfully!');</script>";
|
||||
} else {
|
||||
|
||||
// $this->session->set_flashdata('Error', 'New Employee details not saved');
|
||||
$this->session->setFlashdata('error', 'Record Not Saved!');
|
||||
return json_encode('false');
|
||||
// echo "<script>alert('Record Not Saved!');</script>";
|
||||
// return json_encode('false');
|
||||
echo "<script>alert('Record Not Saved!');</script>";
|
||||
// redirect('employeeListing', 'refresh');
|
||||
}
|
||||
// return redirect()->route('employeeListing');
|
||||
@ -449,34 +449,36 @@ class Employeedetails extends BaseController
|
||||
* This function is used to check whether the Employee is existing in the database or not */
|
||||
function CheckEmail()
|
||||
{
|
||||
$id = $this->request->getPost('id');
|
||||
$emailId = $this->request->getPost('emailId');
|
||||
//print_r($id);
|
||||
|
||||
$query = $this->employeedetails_model->checkMailExists($id);
|
||||
$response = ($query !== null && !empty($query)) ? $query[0]['EmailId'] : null;
|
||||
$response = $this->employeedetails_model->checkMailExists($emailId);
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
function checkPAN()
|
||||
{
|
||||
|
||||
$id = $this->request->getPost('id');
|
||||
$panNo = $this->request->getPost('panNo');
|
||||
//print_r($id);
|
||||
|
||||
$query = $this->employeedetails_model->checkPANExists($id);
|
||||
$response = ($query !== null && !empty($query)) ? $query[0]['PANNo'] : null;
|
||||
$response = $this->employeedetails_model->checkPANExists($panNo);
|
||||
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
// print_r($query);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function checkAadharNo()
|
||||
{
|
||||
|
||||
$id = $this->request->getPost('id');
|
||||
$aadharNo = $this->request->getPost('aadharNo');
|
||||
//print_r($id);
|
||||
|
||||
$query = $this->employeedetails_model->checkAadharExists($id);
|
||||
$response = ($query !== null && !empty($query)) ? $query[0]['AadharNo'] : null;
|
||||
$response = $this->employeedetails_model->checkAadharExists($aadharNo);
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
|
||||
@ -129,34 +129,40 @@ class Employeedetails_model extends Model
|
||||
return $query->getResultArray();
|
||||
}
|
||||
|
||||
function checkMailExists($email = '', $Empid = '')
|
||||
function checkMailExists($emailId = '', $Empid = '')
|
||||
{
|
||||
|
||||
$builder = $this->db->table('t_employee_details')->select('EmailId')
|
||||
->where('EmailId', $email);
|
||||
->where('EmailId', $emailId);
|
||||
if ($Empid != '') {
|
||||
$builder->where('EmpID !=', $Empid);
|
||||
}
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() > 0) {
|
||||
return $query->getResultArray();
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkAadharExists($AadharNo, $Empid = '')
|
||||
function checkAadharExists($aadharNo, $Empid = '')
|
||||
{
|
||||
|
||||
$builder = $this->db->table('t_employee_details')->select('AadharNo')
|
||||
->where('AadharNo', $AadharNo);
|
||||
->where('AadharNo', $aadharNo);
|
||||
if ($Empid != '') {
|
||||
$builder->where('EmpID !=', $Empid);
|
||||
}
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() > 0) {
|
||||
return $query->getResultArray();
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
function checkPANExists($PANNo, $Empid = '')
|
||||
{
|
||||
@ -166,10 +172,15 @@ class Employeedetails_model extends Model
|
||||
if ($Empid != '') {
|
||||
$builder->where('EmpID !=', $Empid);
|
||||
}
|
||||
|
||||
$query = $builder->get();
|
||||
|
||||
if ($query->getNumRows() > 0) {
|
||||
return $query->getResultArray();
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -523,12 +523,12 @@
|
||||
</div>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-4 pad">
|
||||
<label>Personal Email ID</label><span class="badge">*</span>
|
||||
<label>Official Email ID</label><span class="badge">*</span>
|
||||
<input type="email" name="emailid" id="emailid" maxlength="100"
|
||||
class="form-control" required>
|
||||
</div>
|
||||
<div class="col-md-4 pad">
|
||||
<label>Official Email ID</label>
|
||||
<label>Personal Email ID</label>
|
||||
<input type="email" name="comemailid" id="mail" maxlength="100"
|
||||
class="form-control">
|
||||
</div>
|
||||
@ -1010,46 +1010,14 @@
|
||||
pattern="[aA-prPR-wyWY]{1}[1-9]{1}\d{1}\s\d{4}[1-9]{1}" title="The first digit or the last digit will never be 0
|
||||
The first character cannot be Q, X or Z. (eg:A12 34567)" onkeypress="return alpha(event);">
|
||||
</div>
|
||||
<div class="col-md-3"><label>Passport Expiry Date</label>
|
||||
<input id="ValidTill" name="ValidTill" onkeypress="return false;"
|
||||
maxlength="10" class="form-control">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
</div>
|
||||
<div class="col-md-11">
|
||||
<div class="row">
|
||||
<div class="col-md-3"><label>Voter ID</label>
|
||||
<input type="text" id="VoterID" name="voterID" maxlength="12"
|
||||
class="form-control" style="text-transform: uppercase">
|
||||
</div>
|
||||
<div class="col-md-3"><label>Driving License</label>
|
||||
<input type="text" id="Driverlicense"
|
||||
onchange="validateDriverLicense();" style="text-transform:uppercase"
|
||||
pattern="[a-zA-Z]{2}[0-9]{2}\s[0-9]{11}" title="EX:TN82 12345678900"
|
||||
maxlength="16" name="driverlicense" class="form-control"
|
||||
onkeypress="return alpha(event);">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3"><label>Driving License Expiry Date</label>
|
||||
<input id="LicenseExpiryDate" name="licenseExpiryDate"
|
||||
onkeypress="return false;" maxlength="10" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3"><label>Nominee reference</label>
|
||||
<input type="text" id="nomineename" name="nomineename" maxlength="255"
|
||||
class="form-control">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
<ul class="list-inline wizard mb-0">
|
||||
<li class="previous list-inline-item"><a href="javascript: void(0);" class="btn btn-secondary">Previous</a>
|
||||
@ -1276,51 +1244,63 @@
|
||||
|
||||
}
|
||||
$("#emailid").change(function() {
|
||||
var emailId = $('#emailid').val();
|
||||
|
||||
var id = $('#emailid').val();
|
||||
if (validateEmail()) {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
// Validate email before proceeding
|
||||
if (validateEmail()) {
|
||||
$('#loader').show(); // Show loader before sending AJAX request
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeeEmailExist",
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
// alert(data+""+" Employee already exists in the database.Please Change the Email id")
|
||||
// $('#emailid').val('');
|
||||
// $('#emailid').focus();
|
||||
$.ajax({
|
||||
data: {
|
||||
emailId
|
||||
},
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeeEmailExist",
|
||||
|
||||
// Success callback for handling a successful response
|
||||
success: function(data) {
|
||||
if (data) {
|
||||
$('#loader').hide(); // Hide the loader after a successful response
|
||||
|
||||
var answer = confirm(data + "" +
|
||||
" Employee already exists in the database.Do you want to change the Email id ?"
|
||||
)
|
||||
if (answer) {
|
||||
$('#emailid').val('');
|
||||
$('#emailid').focus();
|
||||
} else {
|
||||
alert('please edit the emailid in the edit employee screen');
|
||||
window.location = 'employeedetails/employeeListing';
|
||||
}
|
||||
|
||||
}
|
||||
$('#loader').hide();
|
||||
// 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
|
||||
|
||||
} 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
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#panno').change(function() {
|
||||
|
||||
var id = $('#panno').val();
|
||||
if (id != '') {
|
||||
var panNo = $('#panno').val();
|
||||
if (panNo != '') {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
id: id
|
||||
panNo
|
||||
},
|
||||
|
||||
type: "POST",
|
||||
@ -1332,20 +1312,20 @@
|
||||
// $('#panno').val('');
|
||||
// $('#panno').focus();
|
||||
|
||||
var answer = confirm(data + " " +
|
||||
" Employee details is already exists in the database.Do you want to change the Employee details?"
|
||||
var answer = confirm(
|
||||
" Pan Number details is already exists !!.Kindly Provide us another Pan Number"
|
||||
)
|
||||
if (answer) {
|
||||
|
||||
$('#panno').val('');
|
||||
$('#panno').focus();
|
||||
return false;
|
||||
} else {
|
||||
alert('please edit the PAN number in the Edit employee screen');
|
||||
window.location = 'employeeListing';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
@ -1359,37 +1339,36 @@
|
||||
//
|
||||
$('#aadharno').change(function() {
|
||||
|
||||
var id = $('#aadharno').val();
|
||||
if (id != '') {
|
||||
var aadharNo = $('#aadharno').val();
|
||||
if (aadharNo) {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
id: id
|
||||
aadharNo
|
||||
},
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeecheckAadharNoExist",
|
||||
success: function(data) {
|
||||
$('#loader').hide();
|
||||
console.log(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?"
|
||||
var answer = confirm(
|
||||
" Aadhar details is already exists !!.Kindly Change Aadhar Details"
|
||||
)
|
||||
if (answer) {
|
||||
|
||||
$('#aadharno').val('');
|
||||
$('#aadharno').focus();
|
||||
return false;
|
||||
} else {
|
||||
alert('please edit the aadhar number in the edit employee screen');
|
||||
window.location = 'employeeListing';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
|
||||
@ -353,14 +353,14 @@ if (!empty($EmpDetails)) {
|
||||
<div class="row mb-3">
|
||||
|
||||
<div class="col-md-4 pad">
|
||||
<label>Personal Email ID</label>
|
||||
<label>Official Email ID</label>
|
||||
<input type="mail" name="emailid"
|
||||
value="<?php echo $EmailId; ?>" id="email"
|
||||
placeholder="Email ID" maxlength="100" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="col-md-4 pad">
|
||||
<label>Official Email ID</label>
|
||||
<label>Personal Email ID</label>
|
||||
<input type="email" name="comemailid" id="mail"
|
||||
placeholder="Official Email ID"
|
||||
value="<?php echo $personalEmailId; ?>" maxlength="100"
|
||||
@ -934,60 +934,12 @@ if (!empty($EmpDetails)) {
|
||||
The first character cannot be Q, X or Z. (eg:A12 34567)"
|
||||
style="text-transform: uppercase">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>Passport Expiry Date</label>
|
||||
<input id="ValidTill" name="ValidTill" maxlength="10"
|
||||
placeholder="Passport Expiry Date" class="form-control"
|
||||
value="<?php echo $DOPassport; ?>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-1">
|
||||
</div>
|
||||
<div class="col-md-11">
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<label>Voter ID</label>
|
||||
<input type="text" id="VoterID" name="voterID" maxlength="12"
|
||||
value="<?php echo $VoterID; ?>" class="form-control"
|
||||
placeholder="VoterID" onkeypress="return alpha(event);"
|
||||
style="text-transform: uppercase">
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label>Driving License</label>
|
||||
<!-- <input type="text" id="Driverlicense" maxlength="16" onchange="validateDriverLicense();" pattern="[A-Z]{2}[0-9]{2}\s[0-9]{11}" value="<?php echo $DriverLicense; ?>"name="Driverlicense" title="EX:TN82 12345678900" class="form-control" value=""placeholder="Driverlicense"> -->
|
||||
<input type="text" id="Driverlicense" maxlength="16"
|
||||
onchange="validateDriverLicense();"
|
||||
pattern="[a-zA-Z]{2}[0-9]{2}\s[0-9]{11}"
|
||||
value="<?php echo $DriverLicense; ?>" name="driverlicense"
|
||||
title="EX:TN82 12345678900" class="form-control"
|
||||
placeholder="Driverlicense"
|
||||
style="text-transform: uppercase"
|
||||
onkeypress="return alpha(event);">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label>Driving License Expiry Date</label>
|
||||
<input id="LicenseExpiryDate" name="LicenseExpiryDate"
|
||||
value="<?php echo $LicenseValidtill; ?>"
|
||||
onkeypress="return false;" class="form-control"
|
||||
placeholder="License Expiry Date">
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<label>Nominee reference</label>
|
||||
<input type="text" id="nomineename" name="nomineename"
|
||||
maxlength="250" class="form-control"
|
||||
placeholder="Nominee Name" value="<?php echo $nominee; ?>">
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
<ul class="list-inline wizard mb-0">
|
||||
@ -1630,84 +1582,93 @@ if (!empty($EmpDetails)) {
|
||||
|
||||
$("#email").change(function() {
|
||||
|
||||
var id = $('#email').val();
|
||||
var emailId = $('#email').val();
|
||||
if (validateEmail()) {
|
||||
$('#loader').show();
|
||||
|
||||
$.ajax({
|
||||
data: {
|
||||
id: id
|
||||
emailId
|
||||
},
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeedetails/CheckEmail",
|
||||
url: "<?php echo base_url(); ?>employeeEmailExist",
|
||||
success: function(data) {
|
||||
$('#loader').hide();
|
||||
|
||||
if (data) {
|
||||
if (data != emailId) {
|
||||
alert(data + "" +
|
||||
" Employee already exists in the database.Please Change the mail id");
|
||||
"Another Employee already exists !!.Please Change the mail id");
|
||||
return false;
|
||||
//window.location = 'Employeedetails/employeeListing';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
$('#panno').change(function() {
|
||||
|
||||
var id = $('#panno').val();
|
||||
if (id != '') {
|
||||
var panNo = $('#panno').val();
|
||||
if (panNo != '') {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
id: id
|
||||
panNo
|
||||
},
|
||||
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeedetails/checkPAN",
|
||||
url: "<?php echo base_url(); ?>employeePANExist",
|
||||
success: function(data) {
|
||||
$('#loader').hide();
|
||||
if (data) {
|
||||
alert(data + "" +
|
||||
" Employee already exists in the database.Please Change the Pan Card Number"
|
||||
if (data != panNo ) {
|
||||
alert(
|
||||
" Employee with this pan number already exists in the database.Please Change the Pan Card Number"
|
||||
);
|
||||
$('#panno').val('');
|
||||
$('#panno').focus();
|
||||
//return false;
|
||||
//window.location = 'Employeedetails/employeeListing';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
,
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
$('#aadharno').change(function() {
|
||||
|
||||
var id = $('#aadharno').val();
|
||||
if (id != '') {
|
||||
var aadharNo = $('#aadharno').val();
|
||||
if (aadharNo != '') {
|
||||
$('#loader').show();
|
||||
$.ajax({
|
||||
data: {
|
||||
id: id
|
||||
aadharNo
|
||||
},
|
||||
type: "POST",
|
||||
url: "<?php echo base_url(); ?>employeedetails/checkAadharNo",
|
||||
url: "<?php echo base_url(); ?>employeecheckAadharNoExist",
|
||||
success: function(data) {
|
||||
$('#loader').hide();
|
||||
if (data) {
|
||||
alert(data + "" +
|
||||
" Employee already exists in the database.Please Change the Aadhar card Number"
|
||||
if (data != aadharNo) {
|
||||
alert(
|
||||
"Another Employee with this aadhar number already exists ..!!.Please Change the Aadhar card Number"
|
||||
);
|
||||
$('#aadharno').val('');
|
||||
$('#aadharno').focus();
|
||||
//return false;
|
||||
//window.location = 'Employeedetails/employeeListing';
|
||||
|
||||
}
|
||||
}
|
||||
,
|
||||
complete: function() {
|
||||
$('#loader').hide(); // Ensure the loader is always hidden after the request completes
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user