Remove AADHAR card validation while creating user
This commit is contained in:
parent
bb23d10996
commit
3d62071fb6
@ -23,10 +23,10 @@ const ManageEmployee = () => {
|
|||||||
employee,
|
employee,
|
||||||
error,
|
error,
|
||||||
loading: empLoading,
|
loading: empLoading,
|
||||||
} = useEmployeeProfile( employeeId );
|
} = useEmployeeProfile(employeeId);
|
||||||
|
|
||||||
dispatch( changeMaster( "Job Role" ) );
|
dispatch(changeMaster("Job Role"));
|
||||||
|
|
||||||
const [disabledEmail, setDisabledEmail] = useState(false);
|
const [disabledEmail, setDisabledEmail] = useState(false);
|
||||||
const { data: job_role, loading } = useMaster();
|
const { data: job_role, loading } = useMaster();
|
||||||
const [isloading, setLoading] = useState(false);
|
const [isloading, setLoading] = useState(false);
|
||||||
@ -41,7 +41,8 @@ const ManageEmployee = () => {
|
|||||||
MiddleName: z.string().optional(),
|
MiddleName: z.string().optional(),
|
||||||
LastName: z.string().min(1, { message: "Last Name is required" }),
|
LastName: z.string().min(1, { message: "Last Name is required" }),
|
||||||
Email: z
|
Email: z
|
||||||
.string().max(80,"Email cannot exceed 80 characters")
|
.string()
|
||||||
|
.max(80, "Email cannot exceed 80 characters")
|
||||||
.optional()
|
.optional()
|
||||||
.refine((val) => !val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
|
.refine((val) => !val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
|
||||||
message: "Invalid email format",
|
message: "Invalid email format",
|
||||||
@ -96,8 +97,10 @@ const ManageEmployee = () => {
|
|||||||
}),
|
}),
|
||||||
AadharNumber: z
|
AadharNumber: z
|
||||||
.string()
|
.string()
|
||||||
.regex(/^\d{12}$/, "Aadhar card must be exactly 12 digits long")
|
.optional()
|
||||||
.nonempty("Aadhar card is required"),
|
.refine((val) => !val || /^\d{12}$/.test(val), {
|
||||||
|
message: "Aadhar card must be exactly 12 digits long",
|
||||||
|
}),
|
||||||
Gender: z
|
Gender: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, { message: "Gender is required" })
|
.min(1, { message: "Gender is required" })
|
||||||
@ -152,8 +155,7 @@ const ManageEmployee = () => {
|
|||||||
mode: "onChange",
|
mode: "onChange",
|
||||||
});
|
});
|
||||||
|
|
||||||
const AadharNumberValue = watch( "AadharNumber" ) || "";
|
const AadharNumberValue = watch("AadharNumber") || "";
|
||||||
|
|
||||||
|
|
||||||
const onSubmit = (data) => {
|
const onSubmit = (data) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@ -184,11 +186,11 @@ const ManageEmployee = () => {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
showToast("Employee details updated successfully.", "success");
|
showToast("Employee details updated successfully.", "success");
|
||||||
clearCacheKey("employeeListByProject");
|
clearCacheKey("employeeListByProject");
|
||||||
clearCacheKey( "allEmployeeList" );
|
clearCacheKey("allEmployeeList");
|
||||||
clearCacheKey("employeeProfile")
|
clearCacheKey("employeeProfile");
|
||||||
|
|
||||||
setLoading( false );
|
setLoading(false);
|
||||||
reset()
|
reset();
|
||||||
navigation("/employees");
|
navigation("/employees");
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@ -257,7 +259,7 @@ const ManageEmployee = () => {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
{(!currentEmployee && empLoading && employeeId ) && (
|
{!currentEmployee && empLoading && employeeId && (
|
||||||
<p>Loading Employee Data...</p>
|
<p>Loading Employee Data...</p>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -445,7 +447,7 @@ const ManageEmployee = () => {
|
|||||||
placeholder="Current Address"
|
placeholder="Current Address"
|
||||||
aria-label="Current Address"
|
aria-label="Current Address"
|
||||||
aria-describedby="basic-icon-default-message2"
|
aria-describedby="basic-icon-default-message2"
|
||||||
{...register( "CurrentAddress" )}
|
{...register("CurrentAddress")}
|
||||||
maxLength={500}
|
maxLength={500}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setCurrentAddressLength(e.target.value.length);
|
setCurrentAddressLength(e.target.value.length);
|
||||||
@ -454,7 +456,10 @@ const ManageEmployee = () => {
|
|||||||
}}
|
}}
|
||||||
></textarea>
|
></textarea>
|
||||||
<div className="text-end muted">
|
<div className="text-end muted">
|
||||||
<small> {500 - currentAddressLength} characters left</small>
|
<small>
|
||||||
|
{" "}
|
||||||
|
{500 - currentAddressLength} characters left
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
{errors.CurrentAddress && (
|
{errors.CurrentAddress && (
|
||||||
<div
|
<div
|
||||||
@ -476,7 +481,7 @@ const ManageEmployee = () => {
|
|||||||
placeholder="Permanent Address"
|
placeholder="Permanent Address"
|
||||||
aria-label="Permanent Address"
|
aria-label="Permanent Address"
|
||||||
aria-describedby="basic-icon-default-message2"
|
aria-describedby="basic-icon-default-message2"
|
||||||
{...register( "PermanentAddress" )}
|
{...register("PermanentAddress")}
|
||||||
maxLength={500}
|
maxLength={500}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setPermanentAddressLength(e.target.value.length);
|
setPermanentAddressLength(e.target.value.length);
|
||||||
@ -484,7 +489,9 @@ const ManageEmployee = () => {
|
|||||||
}}
|
}}
|
||||||
></textarea>
|
></textarea>
|
||||||
<div className="text-end muted">
|
<div className="text-end muted">
|
||||||
<small>{500 - permanentAddressLength} characters left</small>
|
<small>
|
||||||
|
{500 - permanentAddressLength} characters left
|
||||||
|
</small>
|
||||||
</div>
|
</div>
|
||||||
{errors.PermanentAddress && (
|
{errors.PermanentAddress && (
|
||||||
<div
|
<div
|
||||||
|
Loading…
x
Reference in New Issue
Block a user