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 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

@ -202,8 +202,7 @@ if (!empty($EmpDetails)) {
<div class="tab-pane active" id="first">
<form id="accountForm" method="post" action="#"
enctype="multipart/form-data"
<form id="accountForm" method="post" action="#" enctype="multipart/form-data"
class="form-horizontal">
<div class="row">
@ -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;" />
@ -1010,8 +1009,8 @@ if (!empty($EmpDetails)) {
<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)) { ?>
@ -1028,8 +1027,7 @@ if (!empty($EmpDetails)) {
<div class="col-md-4">
<label>Update Aadhar File</label><br>
<input type="file" name="emp_file1" class=""
value="">
<input type="file" name="emp_file1" class="" value="">
</div>
</div>
@ -1042,15 +1040,14 @@ 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)) { ?>
<div class="col-md-1">
@ -1077,18 +1074,17 @@ 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)) { ?>
<div class="col-md-1">
@ -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)) {
if (ifscPattern.test(capitalizeFirstFourLetters(value))) {
return;
} else {
alert("Invalid IFSC Code. Please enter a valid one.");
$('#ifsccode').val('<?=$IFSCCode?>');
$('#ifsccode').val('');
return;
}
}