import React from 'react'; import { Form, FastField, ErrorMessage, useFormikContext } from 'formik'; import { Button, Classes, FormGroup, InputGroup, Intent, Checkbox, } from '@blueprintjs/core'; import { CLASSES } from 'common/classes'; import { Row, Col, ListSelect } from 'components'; import { FormattedMessage as T, useIntl } from 'react-intl'; import { inputIntent } from 'utils'; import { moneyFormat, negativeFormat, decimalPlaces, } from 'common/numberFormatsOptions'; import classNames from 'classnames'; /** * Number Formats Fields. */ export default function NumberFormatFields({ // #ownProps onCancelClick, }) { const { isSubmitting } = useFormikContext(); return (
{/*------------ Money formats -----------*/} {({ form, field: { value }, meta: { error, touched } }) => ( } helperText={} intent={inputIntent({ error, touched })} className={classNames(CLASSES.FILL)} > { form.setFieldValue('format_money', format.name); }} filterable={false} selectedItem={value} selectedItemProp={'id'} textProp={'text'} popoverProps={{ minimal: true, captureDismiss: true }} /> )} {/*------------ Negative formats -----------*/} {({ form, field: { value }, meta: { error, touched } }) => ( } helperText={} intent={inputIntent({ error, touched })} className={classNames(CLASSES.FILL)} > { form.setFieldValue('negative_format', format.name); }} filterable={false} selectedItem={value} selectedItemProp={'id'} textProp={'text'} popoverProps={{ minimal: true, captureDismiss: true }} /> )} {/*------------ Decimal places -----------*/} {({ form, field: { value }, meta: { error, touched } }) => ( } helperText={} intent={inputIntent({ error, touched })} className={classNames(CLASSES.FILL)} > { form.setFieldValue('precision', format.key); }} filterable={false} selectedItem={value} selectedItemProp={'id'} labelProp={'label'} textProp={'text'} popoverProps={{ minimal: true, captureDismiss: true }} /> )} {/*------------ show zero -----------*/} {({ field }) => ( } name={'show_zero'} {...field} /> )} {/*------------ show negative in red-----------*/} {({ field }) => ( } name={'show_in_red'} {...field} /> )} {/*------------ Divide on 1000 -----------*/} {({ field }) => ( } name={'divide_on_1000'} {...field} /> )}
); }