Remove AADHAR card validation while creating user

This commit is contained in:
Vikas Nale 2025-05-04 11:41:11 +05:30
parent bb23d10996
commit 3d62071fb6

View File

@ -41,7 +41,8 @@ const ManageEmployee = () => {
MiddleName: z.string().optional(),
LastName: z.string().min(1, { message: "Last Name is required" }),
Email: z
.string().max(80,"Email cannot exceed 80 characters")
.string()
.max(80, "Email cannot exceed 80 characters")
.optional()
.refine((val) => !val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
message: "Invalid email format",
@ -96,8 +97,10 @@ const ManageEmployee = () => {
}),
AadharNumber: z
.string()
.regex(/^\d{12}$/, "Aadhar card must be exactly 12 digits long")
.nonempty("Aadhar card is required"),
.optional()
.refine((val) => !val || /^\d{12}$/.test(val), {
message: "Aadhar card must be exactly 12 digits long",
}),
Gender: z
.string()
.min(1, { message: "Gender is required" })
@ -154,7 +157,6 @@ const ManageEmployee = () => {
const AadharNumberValue = watch("AadharNumber") || "";
const onSubmit = (data) => {
setLoading(true);
@ -185,10 +187,10 @@ const ManageEmployee = () => {
showToast("Employee details updated successfully.", "success");
clearCacheKey("employeeListByProject");
clearCacheKey("allEmployeeList");
clearCacheKey("employeeProfile")
clearCacheKey("employeeProfile");
setLoading(false);
reset()
reset();
navigation("/employees");
})
.catch((error) => {
@ -257,7 +259,7 @@ const ManageEmployee = () => {
</span>
</div>
<div className="card-body">
{(!currentEmployee && empLoading && employeeId ) && (
{!currentEmployee && empLoading && employeeId && (
<p>Loading Employee Data...</p>
)}
@ -454,7 +456,10 @@ const ManageEmployee = () => {
}}
></textarea>
<div className="text-end muted">
<small> {500 - currentAddressLength} characters left</small>
<small>
{" "}
{500 - currentAddressLength} characters left
</small>
</div>
{errors.CurrentAddress && (
<div
@ -484,7 +489,9 @@ const ManageEmployee = () => {
}}
></textarea>
<div className="text-end muted">
<small>{500 - permanentAddressLength} characters left</small>
<small>
{500 - permanentAddressLength} characters left
</small>
</div>
{errors.PermanentAddress && (
<div