import { Button, Group, Modal, Select, Stack, Text, Textarea, TextInput, } from "@mantine/core"; import { DateInput } from "@mantine/dates"; import type { FC, FormEventHandler, ReactNode } from "react"; import { Controller, useFormContext } from "react-hook-form"; import { useTranslation } from "react-i18next"; import type { BankOperation } from "@/entities/bank-card"; import { formatMoney } from "@/shared/lib"; import classes from "./OperationForm.module.css"; import type { OperationValues } from "./OperationForm.types"; type Choice = { value: string; label: string }; type OperationFieldsProps = { editing: boolean; refundCardId: string; kind: OperationValues["kind"]; cards: Choice[]; targets: Choice[]; categories: Choice[]; defaultCategory: string; kinds: Choice[]; dateInputValue: (value: string) => string; validDate: (value: string) => boolean; maxDate: () => string; }; const OperationFields: FC = (props) => { const { t } = useTranslation(); const { control, register, setValue, formState: { errors, isSubmitting }, } = useFormContext(); return ( ( )} /> {props.kind === "transfer" && ( ( )} /> )}