/* * Copyright © 2024 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ import { Typography } from "@mui/material"; import { Controller, useFormContext } from "react-hook-form"; import { ContentContainer } from "@/app-components/dialogs/layouts/ContentContainer"; import { ContentItem } from "@/app-components/dialogs/layouts/ContentItem"; import AutoCompleteEntitySelect from "@/app-components/inputs/AutoCompleteEntitySelect"; import { Input } from "@/app-components/inputs/Input"; import { useTranslate } from "@/hooks/useTranslate"; import { EntityType, Format } from "@/services/types"; import { IBlockAttributes } from "@/types/block.types"; import { ILabelFull } from "@/types/label.types"; import { IUser } from "@/types/user.types"; import { useBlock } from "./BlockFormProvider"; import ContextVarsInput from "./inputs/options/ContextVarsInput"; import LocalFallbackInput from "./inputs/options/LocalFallbackInput"; export const OptionsForm = () => { const { t } = useTranslate(); const block = useBlock(); const { control, register, watch } = useFormContext(); const computed = watch("options.typing"); return ( = {(computed || 0) / 1000} {t("label.seconds")} { const { onChange, ...rest } = field; return ( searchFields={["title", "name"]} entity={EntityType.LABEL} format={Format.BASIC} labelKey="title" label={t("label.assign_labels")} multiple={true} onChange={(_e, selected) => onChange(selected.map(({ id }) => id)) } {...rest} /> ); }} /> { const { onChange, ...rest } = field; return ( multiple={false} searchFields={["first_name", "last_name"]} entity={EntityType.USER} format={Format.BASIC} labelKey="first_name" label={t("label.assign_to")} onChange={(_e, selected) => { onChange(selected?.id); }} getOptionLabel={(option) => { return `${option.first_name} ${option.last_name}`; }} {...rest} /> ); }} /> ( )} /> ( )} /> ); }; OptionsForm.displayName = "OptionsForm";