employee module changes-1 vadivel J 09-12-2024

This commit is contained in:
vadivelJ96 2024-12-09 10:04:14 +05:30
parent 67407c10a9
commit 25515a7104
2 changed files with 127 additions and 109 deletions

View File

@ -314,10 +314,17 @@
$("#photo").src("");
}
function capitalizeFirstLetter(word) {
if (!word) return ""; // Handle empty or undefined strings
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
}
function ValidatePassport() {
var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/;
var passport = $("#passportno").val().trim();
var regsaid =/^[A-Z][1-9]\d\s?\d{4}[1-9]$/;
var passport = capitalizeFirstLetter($("#passportno").val().trim());
if (regsaid.test(passport) == false) {
alert('You have entered invalid Passport.');
@ -1042,7 +1049,6 @@
<input type="text" id="passportno" maxlength="9"
onchange="ValidatePassport();" name="passportno"
style="text-transform:uppercase" class="form-control"
pattern="^[A-Z][1-9]\d\s?\d{4}[1-9]$"
title="
The first character must be an uppercase alphabet.
The next two characters should be numbers,
@ -1540,14 +1546,23 @@
<script>
function capitalizeFirstFourLetters(value) {
if (!value) return ""; // Handle empty or undefined strings
return (
value.slice(0, 4).toUpperCase() + // Capitalize the first four letters
value.slice(4).toLowerCase() // Lowercase the rest of the string
);
}
function ifscCodeValidation(value) {
// Define the regex pattern for a valid IFSC code
const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/;
// Check if the value matches the pattern
if (ifscPattern.test(value)) {
if (ifscPattern.test(capitalizeFirstFourLetters(value))) {
return;
} else {
alert("Invalid IFSC Code. Please enter a valid one.");

View File

@ -109,13 +109,13 @@ if (!empty($EmpDetails)) {
}
$isactive = $Emp->IsActive;
$ProfilePicPath='';
$ProfilePicPath = '';
if (!empty($Emp->ProfilePic)) {
$ProfilePicPath = base_url().'public/uploads/images/' . $Emp->ProfilePic;
$ProfilePicPath = base_url() . 'public/uploads/images/' . $Emp->ProfilePic;
} else {
$ProfilePicPath = base_url().'public/assets/dist/img/avatar.png';
$ProfilePicPath = base_url() . 'public/assets/dist/img/avatar.png';
}
$Reference_Name = $Emp->Reference_Name;
$Reference_ContactNumber = $Emp->Reference_ContactNumber;
@ -202,9 +202,8 @@ if (!empty($EmpDetails)) {
<div class="tab-pane active" id="first">
<form id="accountForm" method="post" action="#"
enctype="multipart/form-data"
class="form-horizontal">
<form id="accountForm" method="post" action="#" enctype="multipart/form-data"
class="form-horizontal">
<div class="row">
<div class="col-md-2">
@ -213,8 +212,8 @@ if (!empty($EmpDetails)) {
<div class="box-header">
<img id="profilepicture"
src="<?php echo $ProfilePicPath; ?>"
alt="your image" style="width: 139px;" />
src="<?php echo $ProfilePicPath; ?>" alt="your image"
style="width: 139px;" />
@ -239,8 +238,8 @@ if (!empty($EmpDetails)) {
<input type="hidden" name="oldImageName" id="Image"
value="<?php echo $Emp->ProfilePic; ?>" class="form-control"
readonly>
readonly>
</div>
@ -1004,34 +1003,33 @@ if (!empty($EmpDetails)) {
maxlength="14" onchange="ValidateAadhar();"
class="form-control"
onkeypress="return isNumberKey(event)" required
value="<?=$AadharNo?>">
value="<?= $AadharNo ?>">
</div>
<div class="col-md-3">
<label>Aadhar File Name</label>
<input type="text" id="file_name" name="file_name1"
maxlength="255" class="form-control"
value="Aadhar" readonly>
maxlength="255" class="form-control" value="Aadhar"
readonly>
</div>
<?php
if(!empty($aadharFile)){ ?>
if (!empty($aadharFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $aadharFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $aadharFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Aadhar File</label><br>
<input type="file" name="emp_file1" class=""
value="">
<label>Update Aadhar File</label><br>
<input type="file" name="emp_file1" class="" value="">
</div>
</div>
<div class="row">
@ -1042,33 +1040,32 @@ if (!empty($EmpDetails)) {
onchange="validatePAN();" class="form-control"
pattern="([a-zA-Z]){5}([0-9]){4}([a-zA-Z]){1}"
title=" 5 character,4 Digit Numbers,1 character (ex:ABCDE1234A) "
onkeypress="return alpha(event);"
value="<?=$PANNo?>"
>
onkeypress="return alpha(event);" value="<?= $PANNo ?>">
</div>
<div class="col-md-3">
<label>PAN File Name</label>
<input type="text" id="file_name" name="file_name2"
maxlength="255" class="form-control" value="PAN" readonly>
maxlength="255" class="form-control" value="PAN"
readonly>
</div>
<?php if(!empty($panFile)) { ?>
<?php if (!empty($panFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $panFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $panFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update PAN File</label><br>
<input type="file" name="emp_file2" class="">
</div>
</div>
<div class="row">
@ -1077,36 +1074,35 @@ if (!empty($EmpDetails)) {
<input type="text" id="passportno" maxlength="9"
onchange="ValidatePassport();" name="passportno"
style="text-transform:uppercase" class="form-control"
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)"
(eg:A12 34567)"
onkeypress="return alpha(event);"
value="<?=$PassportNo?>"
>
value="<?= $PassportNo ?>">
</div>
<div class="col-md-3">
<label>Passport File Name</label>
<input type="text" id="file_name" name="file_name3"
maxlength="255" class="form-control" value="Passport" readonly>
maxlength="255" class="form-control" value="Passport"
readonly>
</div>
<?php if(!empty($passportFile)){?>
<?php if (!empty($passportFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $passportFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $passportFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Passport File</label><br>
<input type="file" name="emp_file3" class="">
</div>
</div>
@ -1118,23 +1114,23 @@ if (!empty($EmpDetails)) {
maxlength="255" class="form-control"
value="Bank Passbook" readonly>
</div>
<?php if(!empty($bankPassBookFile)){?>
<?php if (!empty($bankPassBookFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $bankPassBookFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $bankPassBookFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Bank PassBok File</label><br>
<input type="file" name="emp_file4" class="">
</div>
</div>
<div class="row">
@ -1143,25 +1139,25 @@ if (!empty($EmpDetails)) {
<label> Other Document File Name</label>
<input type="text" id="file_name" name="file_name5"
maxlength="255" class="form-control"
value="<?= $otherDocumentFileName?>" >
value="<?= $otherDocumentFileName ?>">
</div>
<?php if(!empty($otherDocumentFile)){?>
<?php if (!empty($otherDocumentFile)) { ?>
<div class="col-md-1">
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $otherDocumentFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php }else{?>
<div class="col-md-1"></div>
<?php }?>
<a href="<?php echo base_url() . 'public/uploads/images/emp_files/' . $otherDocumentFile; ?>"
download>
<i class="fa fa-download mt-4" aria-hidden="true"
style="font-size: 25px;"></i>
</a>
</div>
<?php } else { ?>
<div class="col-md-1"></div>
<?php } ?>
<div class="col-md-4">
<label>Update Other Document File </label><br>
<input type="file" name="emp_file5" class="">
</div>
</div>
@ -1211,8 +1207,8 @@ if (!empty($EmpDetails)) {
<div class="col-md-4"><label>Passport Number</label>
<input type="text" id="passportno" maxlength="9"
name="passportno"
style="text-transform:uppercase" class="form-control"
name="passportno" style="text-transform:uppercase"
class="form-control"
pattern="^[A-Z][1-9]\d\s?\d{4}[1-9]$"
title="
The first character must be an uppercase alphabet.
@ -1220,8 +1216,7 @@ if (!empty($EmpDetails)) {
with the first character ranging from 1 to 9 and the second character from 0 to 9.
It may include zero or one white space character.
The subsequent four characters can be any number from 0 to 9.
The last character should be any number from 1 to 9."
>
The last character should be any number from 1 to 9.">
</div>
<div class="col-md-4">
<label>Passport File Name</label>
@ -1698,17 +1693,16 @@ if (!empty($EmpDetails)) {
}
function ValidatePassport() {
var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/ig;
var passport = $("#passportno").val().trim();
var regsaid = /^[A-Z][1-9]\d\s?\d{4}[1-9]$/;
var passport = capitalizeFirstLetter($("#passportno").val().trim());
if (regsaid.test(passport) == false) {
alert('You have entered invalid Passport.');
alert(` The first character must be an uppercase alphabet.
The next two characters should be numbers,
with the first character ranging from 1 to 9 and the second character from 0 to 9.
It may include zero or one white space character.
The subsequent four characters can be any number from 0 to 9.
The last character should be any number from 1 to 9."`);
return;
alert(`The first character must be an uppercase alphabet. The next two characters should be numbers,with the first character ranging from 1 to 9 and the second character from 0 to 9. It may include zero or one white space character. The subsequent four characters can be any number from 0 to 9. The last character should be any number from 1 to 9."`);
return (false);
} else {
return true;
}
}
@ -2063,16 +2057,25 @@ if (!empty($EmpDetails)) {
</script>
<script>
function capitalizeFirstFourLetters(value) {
if (!value) return ""; // Handle empty or undefined strings
return (
value.slice(0, 4).toUpperCase() + // Capitalize the first four letters
value.slice(4).toLowerCase() // Lowercase the rest of the string
);
}
function ifscCodeValidation(value) {
// Define the regex pattern for a valid IFSC code
const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/;
// Check if the value matches the pattern
if (ifscPattern.test(value)) {
return;
if (ifscPattern.test(capitalizeFirstFourLetters(value))) {
return;
} else {
alert("Invalid IFSC Code. Please enter a valid one.");
$('#ifsccode').val('<?=$IFSCCode?>');
$('#ifsccode').val('');
return;
}
}