feat(CreateCustomer): add password visibility toggle and enhance form handling

- Integrated EyeIcon for password visibility toggle in the CreateCustomer component.
- Updated useCreateCustomerPresenter to manage password visibility state.
- Improved form handling by adding showPassword and setShowPassword to the presenter.
This commit is contained in:
AmirReza Jamali
2026-04-15 12:31:43 +03:30
parent fb3301169e
commit 2f28ae8625
2 changed files with 27 additions and 5 deletions
@@ -1,6 +1,6 @@
"use client";
import { GlobeIcon } from "@/assets/icons";
import { EyeIcon, GlobeIcon } from "@/assets/icons";
import InputGroup from "@/components/FormElements/InputGroup";
import MultiSelect from "@/components/FormElements/MultiSelect";
import { Select } from "@/components/FormElements/select";
@@ -20,8 +20,16 @@ interface IProps {
}
const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
const { errors, handleSubmit, register, watch, onSubmit, companies, router } =
useCreateCustomerPresenter({ defaultValues, editMode, id });
const {
errors,
handleSubmit,
register,
watch,
onSubmit,
companies,
showPassword,
setShowPassword,
} = useCreateCustomerPresenter({ defaultValues, editMode, id });
return (
<form className="grid grid-cols-1 gap-9" onSubmit={handleSubmit(onSubmit)}>
@@ -120,8 +128,19 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
})}
disabled={editMode}
name="password"
icon={
<span
className="cursor-pointer"
onClick={() => {
setShowPassword(!showPassword);
}}
>
<EyeIcon />
</span>
}
iconPosition="right"
label="Password"
type="password"
type={showPassword ? "text" : "password"}
placeholder="Enter password"
required={!editMode}
/>