import { FormItem, FormControl, FormMessage, FormLabel, FormField, Checkbox, ScrollArea, EntityFieldCard, } from "@marzneshin/common/components"; import { useInboundsQuery, type InboundType, } from "@marzneshin/modules/inbounds"; import { useFormContext, type FieldValues, type ControllerRenderProps, } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { cn } from "@marzneshin/common/utils"; import { Box, GlobeLock } from "lucide-react"; export const InboundCard = ({ inbound, field, }: { inbound: InboundType; field: ControllerRenderProps; }) => { return (
{ return checked ? field.onChange([...field.value, inbound.id]) : field.onChange( field.value?.filter((value: number) => value !== inbound.id), ); }} />
); }; export const InboundsField = () => { const { data } = useInboundsQuery({ page: 1, size: 100 }); const form = useFormContext(); const { t } = useTranslation(); return ( ( {t("inbounds")} {data.entities.map((inbound) => ( ( )} /> ))} )} /> ); };