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

View File

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