Merge branch 'Ashutosh_Enhancement#132_Int_To_Guid' of https://git.marcoaiot.com/admin/marco.pms.web into Ashutosh_Enhancement#132_Int_To_Guid

This commit is contained in:
ashutosh.nehete 2025-05-04 11:54:18 +05:30
commit abdb17ecf4

View File

@ -23,10 +23,10 @@ const ManageEmployee = () => {
employee,
error,
loading: empLoading,
} = useEmployeeProfile( employeeId );
dispatch( changeMaster( "Job Role" ) );
} = useEmployeeProfile(employeeId);
dispatch(changeMaster("Job Role"));
const [disabledEmail, setDisabledEmail] = useState(false);
const { data: job_role, loading } = useMaster();
const [isloading, setLoading] = useState(false);
@ -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" })
@ -152,8 +155,7 @@ const ManageEmployee = () => {
mode: "onChange",
});
const AadharNumberValue = watch( "AadharNumber" ) || "";
const AadharNumberValue = watch("AadharNumber") || "";
const onSubmit = (data) => {
setLoading(true);
@ -184,11 +186,11 @@ const ManageEmployee = () => {
.then((response) => {
showToast("Employee details updated successfully.", "success");
clearCacheKey("employeeListByProject");
clearCacheKey( "allEmployeeList" );
clearCacheKey("employeeProfile")
clearCacheKey("allEmployeeList");
clearCacheKey("employeeProfile");
setLoading( false );
reset()
setLoading(false);
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>
)}
@ -445,7 +447,7 @@ const ManageEmployee = () => {
placeholder="Current Address"
aria-label="Current Address"
aria-describedby="basic-icon-default-message2"
{...register( "CurrentAddress" )}
{...register("CurrentAddress")}
maxLength={500}
onChange={(e) => {
setCurrentAddressLength(e.target.value.length);
@ -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
@ -476,7 +481,7 @@ const ManageEmployee = () => {
placeholder="Permanent Address"
aria-label="Permanent Address"
aria-describedby="basic-icon-default-message2"
{...register( "PermanentAddress" )}
{...register("PermanentAddress")}
maxLength={500}
onChange={(e) => {
setPermanentAddressLength(e.target.value.length);
@ -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