fix(customers): improve form field value binding and import organization
- Reorganize imports in alphabetical order for better maintainability - Add value binding to role select field using watch hook for proper form state synchronization - Add value binding to type select field using watch hook for consistent form behavior - Ensure form fields properly reflect current values during editing and user interaction
This commit is contained in:
@@ -6,12 +6,12 @@ import MultiSelect from "@/components/FormElements/MultiSelect";
|
||||
import { Select } from "@/components/FormElements/select";
|
||||
import { ShowcaseSection } from "@/components/Layouts/showcase-section";
|
||||
import FormFooter from "@/components/ui/FormFooter";
|
||||
import { AdminRoles } from "@/constants/enums";
|
||||
import { REGEX } from "@/constants/regex";
|
||||
import { FormErrorMessages } from "@/constants/Texts";
|
||||
import { CreateCustomerCredentials } from "@/lib/api";
|
||||
import useCreateCustomerPresenter from "./useCreateCustomerPresenter";
|
||||
import { getEnumAsArray } from "@/utils/shared";
|
||||
import { AdminRoles } from "@/constants/enums";
|
||||
import useCreateCustomerPresenter from "./useCreateCustomerPresenter";
|
||||
|
||||
interface IProps {
|
||||
editMode?: boolean;
|
||||
@@ -99,6 +99,7 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
|
||||
required: { message: FormErrorMessages.required, value: true },
|
||||
})}
|
||||
name="role"
|
||||
value={watch("role")}
|
||||
items={getEnumAsArray(AdminRoles)}
|
||||
placeholder="Select Role"
|
||||
/>
|
||||
@@ -183,6 +184,7 @@ const CreateCustomer = ({ defaultValues, editMode, id }: IProps) => {
|
||||
})}
|
||||
name="type"
|
||||
label="Type"
|
||||
value={watch("type")}
|
||||
placeholder="Select Type"
|
||||
prefixIcon={<GlobeIcon />}
|
||||
items={[
|
||||
|
||||
Reference in New Issue
Block a user