add auto suggestion field for orgnaization
This commit is contained in:
parent
db75cec8e7
commit
77e3082000
@ -14,10 +14,11 @@ import useMaster, {
|
|||||||
} from "../../hooks/masterHook/useMaster";
|
} from "../../hooks/masterHook/useMaster";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { changeMaster } from "../../slices/localVariablesSlice";
|
import { changeMaster } from "../../slices/localVariablesSlice";
|
||||||
import { useBuckets } from "../../hooks/useDirectory";
|
import { useBuckets, useOrganization } from "../../hooks/useDirectory";
|
||||||
import { useProjects } from "../../hooks/useProjects";
|
import { useProjects } from "../../hooks/useProjects";
|
||||||
import SelectMultiple from "../common/SelectMultiple";
|
import SelectMultiple from "../common/SelectMultiple";
|
||||||
import { ContactSchema } from "./DirectorySchema";
|
import { ContactSchema } from "./DirectorySchema";
|
||||||
|
import InputSuggestions from "../common/InputSuggestion";
|
||||||
|
|
||||||
const UpdateContact = ({ submitContact, existingContact, onCLosed }) => {
|
const UpdateContact = ({ submitContact, existingContact, onCLosed }) => {
|
||||||
const selectedMaster = useSelector(
|
const selectedMaster = useSelector(
|
||||||
@ -34,6 +35,7 @@ const UpdateContact = ({ submitContact, existingContact, onCLosed }) => {
|
|||||||
const [ IsSubmitting, setSubmitting ] = useState( false );
|
const [ IsSubmitting, setSubmitting ] = useState( false );
|
||||||
const [isInitialized, setIsInitialized] = useState(false);
|
const [isInitialized, setIsInitialized] = useState(false);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const {organizationList} = useOrganization()
|
||||||
|
|
||||||
const methods = useForm({
|
const methods = useForm({
|
||||||
resolver: zodResolver(ContactSchema),
|
resolver: zodResolver(ContactSchema),
|
||||||
@ -137,7 +139,7 @@ await submitContact({ ...cleaned, id: existingContact.id });
|
|||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
const orgValue = watch("organization")
|
||||||
const handleClosed = () => {
|
const handleClosed = () => {
|
||||||
onCLosed();
|
onCLosed();
|
||||||
};
|
};
|
||||||
@ -193,12 +195,15 @@ await submitContact({ ...cleaned, id: existingContact.id });
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div className="col-md-6 text-start">
|
<div className="col-md-6 text-start">
|
||||||
<label className="form-label">Organization</label>
|
<label className="form-label">Organization</label>
|
||||||
<input
|
<InputSuggestions
|
||||||
className="form-control form-control-sm"
|
organizationList={organizationList}
|
||||||
{...register("organization")}
|
value={getValues("organization") || ""}
|
||||||
/>
|
onChange={(val) => setValue("organization", val)}
|
||||||
|
error={errors.organization?.message}
|
||||||
|
/>
|
||||||
{errors.organization && (
|
{errors.organization && (
|
||||||
<small className="danger-text">
|
<small className="danger-text">
|
||||||
{errors.organization.message}
|
{errors.organization.message}
|
||||||
|
|||||||
@ -24,11 +24,11 @@ const DirectoryListTableHeader = ( {children, IsActive} ) =>
|
|||||||
<span>Phone</span>
|
<span>Phone</span>
|
||||||
</div>
|
</div>
|
||||||
</th>
|
</th>
|
||||||
<th className="mx-2">
|
<th colSpan={2} className="mx-2 ps-20">
|
||||||
<div className="d-flex align-items-center gap-1">
|
|
||||||
|
|
||||||
<span>Organization</span>
|
Organization
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
<th className="mx-2">Category</th>
|
<th className="mx-2">Category</th>
|
||||||
{IsActive && <th>Action</th>}
|
{IsActive && <th>Action</th>}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user