IO-934 Refactor some search select fields & save employee on new ticket
This commit is contained in:
@@ -1,33 +1,21 @@
|
||||
import { Select, Space, Tag } from "antd";
|
||||
import React, { forwardRef, useEffect, useState } from "react";
|
||||
import React, { forwardRef } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
const { Option } = Select;
|
||||
//To be used as a form element only.
|
||||
|
||||
const EmployeeSearchSelect = (
|
||||
{ value, onChange, options, onSelect, onBlur, ...restProps },
|
||||
ref
|
||||
) => {
|
||||
const [option, setOption] = useState(value);
|
||||
const EmployeeSearchSelect = ({ options, ...props }, ref) => {
|
||||
const { t } = useTranslation();
|
||||
useEffect(() => {
|
||||
if (value !== option && onChange) {
|
||||
onChange(option);
|
||||
}
|
||||
}, [value, option, onChange]);
|
||||
|
||||
return (
|
||||
<Select
|
||||
showSearch
|
||||
value={option}
|
||||
// value={option}
|
||||
style={{
|
||||
width: 400,
|
||||
}}
|
||||
onChange={setOption}
|
||||
optionFilterProp="search"
|
||||
onSelect={onSelect}
|
||||
onBlur={onBlur}
|
||||
{...restProps}
|
||||
{...props}
|
||||
>
|
||||
{options
|
||||
? options.map((o) => (
|
||||
|
||||
Reference in New Issue
Block a user