Compare commits

..

No commits in common. "999ebe162314cca47d53ed96414649342bb4d38c" and "079dfb8861104103edaae91f81a8a008ec5a0fc2" have entirely different histories.

2 changed files with 12 additions and 35 deletions

View File

@ -36,30 +36,7 @@ const ManageEmployee = () => {
FirstName: z.string().min(1, { message: "First Name is required" }),
MiddleName: z.string().optional(),
LastName: z.string().min(1, { message: "Last Name is required" }),
Email: z
.string()
.optional()
.refine(
(val) =>
!val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val),
{
message: "Invalid email format",
}
)
.refine(
(val) => {
if (!val) return true;
const [local, domain] = val.split("@");
return (
val.length <= 320 &&
local?.length <= 64 &&
domain?.length <= 255
);
},
{
message: "Email local or domain part is too long",
}
),
Email: z.string().optional(),
CurrentAddress: z
.string()
.min(1, { message: "Current Address is required" })
@ -109,7 +86,7 @@ const ManageEmployee = () => {
.refine((val) => !val || /^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(val), {
message: "Invalid PAN number",
}),
PermanentAddress: z
PeramnentAddress: z
.string()
.min(1, { message: "Permanent Address is required" })
.max(150, { message: "Address cannot exceed 150 characters" }),
@ -143,7 +120,7 @@ const ManageEmployee = () => {
AadharNumber: currentEmployee?.aadharNumber || "",
Gender: currentEmployee?.gender || "",
PanNumber: currentEmployee?.panNumber || "",
PermanentAddress: currentEmployee?.permanentAddress || "",
PeramnentAddress: currentEmployee?.peramnentAddress || "",
PhoneNumber: currentEmployee?.phoneNumber || "",
JobRoleId: currentEmployee?.jobRoleId || "",
},
@ -214,7 +191,7 @@ const ManageEmployee = () => {
AadharNumber: currentEmployee.aadharNumber || "",
Gender: currentEmployee.gender || "",
PanNumber: currentEmployee.panNumber || "",
PermanentAddress: currentEmployee.permanentAddress || "",
PeramnentAddress: currentEmployee.peramnentAddress || "",
PhoneNumber: currentEmployee.phoneNumber || "",
JobRoleId: currentEmployee.jobRoleId?.toString() || "",
}
@ -444,22 +421,22 @@ const ManageEmployee = () => {
)}
</div>
<div className="col-sm-6">
<div className="form-text text-start">Permanent Address</div>
<div className="form-text text-start">Permnant Address</div>
<textarea
id="PermanentAddress"
id="PeramnentAddress"
className="form-control form-control-sm"
placeholder="Permanent Address"
aria-label="Permanent Address"
placeholder="Permnant Address"
aria-label="Permnant Address"
aria-describedby="basic-icon-default-message2"
{...register("PermanentAddress")}
{...register("PeramnentAddress")}
></textarea>
{errors.PermanentAddress && (
{errors.PeramnentAddress && (
<div
className="danger-text text-start"
style={{ fontSize: "12px" }}
>
{errors.PermanentAddress.message}
{errors.PeramnentAddress.message}
</div>
)}
</div>

View File

@ -174,7 +174,7 @@ const EmployeeProfile = () => {
</li>
<li className="d-flex align-items-start test-start mb-2">
<span className={`${currentEmployee?.permanentAddress ? "" : "ms-4"}`}>
{currentEmployee?.permanentAddress}
{currentEmployee?.peramnentAddress}
</span>
</li>