import React from "react"; import { AppFormController, useAppFormContext, } from "../../hooks/appHooks/useAppForm"; import Label from "../common/Label"; import DatePicker from "../common/DatePicker"; import { SelectFieldSearch, SelectProjectField, } from "../common/Forms/SelectFieldServerSide"; import { useGlobaleOrganizations, useOrganization, useOrganizationsList, } from "../../hooks/useOrganization"; import { ITEMS_PER_PAGE } from "../../utils/constants"; const PurchasePartyDetails = () => { const { register, control, setValue, watch, formState: { errors }, } = useAppFormContext(); const hasNumber = !! watch('proformaInvoiceNumber'); const hasAmount = watch("proformaInvoiceAmount") !== null && watch("proformaInvoiceAmount") > 0; const hasDate = !!watch("proformaInvoiceDate"); // If any one field is filled → all must be valid const anyField = hasNumber || hasAmount || hasDate; return (
{/* Title */}
{errors?.title && (
{errors.title.message}
)}
{/* Project ID */}
setValue("projectId", val, { shouldDirty: true, shouldValidate: true, }) } errors={errors} />
( )} />
( )} />