import { Select, Space, Tag } from "antd";
import { useTranslation } from "react-i18next";

//To be used as a form element only.

const EmployeeSearchSelectEmail = ({ options, ...props }) => {
  const { t } = useTranslation();

  return (
    <Select
      showSearch={{
        optionFilterProp: "search"
      }}
      style={{
        width: 400
      }}
      options={options?.map((o) => ({
        key: o.id,
        value: o.user_email,
        search: `${o.employee_number}  ${o.first_name} ${o.last_name}`,
        label: (
          <Space>
            {`${o.employee_number}  ${o.first_name} ${o.last_name}`}
            <Tag color="green">
              {o.flat_rate ? t("timetickets.labels.flat_rate") : t("timetickets.labels.straight_time")}
            </Tag>
          </Space>
        )
      }))}
      {...props}
    />
  );
};
export default EmployeeSearchSelectEmail;
