// @ts-nocheck import React from 'react'; import styled from 'styled-components'; import classNames from 'classnames'; import { Form } from 'formik'; import { Button, FormGroup, Intent } from '@blueprintjs/core'; import { TimezonePicker } from '@blueprintjs/timezone'; import { ErrorMessage, FastField } from 'formik'; import { useHistory } from 'react-router-dom'; import { FieldRequiredHint, FormattedMessage as T, FFormGroup, FInputGroup, FSelect, } from '@/components'; import { inputIntent } from '@/utils'; import { CLASSES } from '@/constants/classes'; import { getAllCurrenciesOptions } from '@/constants/currencies'; import { getFiscalYear } from '@/constants/fiscalYearOptions'; import { getLanguages } from '@/constants/languagesOptions'; import { useGeneralFormContext } from './GeneralFormProvider'; import { getAllCountries } from '@/utils/countries'; import { shouldBaseCurrencyUpdate } from './utils'; const Countries = getAllCountries(); /** * Preferences general form. */ export default function PreferencesGeneralForm({ isSubmitting }) { const history = useHistory(); const FiscalYear = getFiscalYear(); const Languages = getLanguages(); const Currencies = getAllCurrenciesOptions(); const { dateFormats, baseCurrencyMutateAbility } = useGeneralFormContext(); const baseCurrencyDisabled = baseCurrencyMutateAbility.length > 0; // Handle close click. const handleCloseClick = () => { history.go(-1); }; return (
{/* ---------- Organization name ---------- */} } labelInfo={} inline={true} helperText={} fastField={true} > {/* ---------- Industry ---------- */} } inline={true} fastField={true} > {/* ---------- Location ---------- */} } inline={true} fastField={true} > } popoverProps={{ minimal: true }} fastField={true} /> {/* ---------- Base currency ---------- */} } labelInfo={} inline={true} helperText={ } fastField={true} shouldUpdate={shouldBaseCurrencyUpdate} > } popoverProps={{ minimal: true }} disabled={baseCurrencyDisabled} fastField={true} shouldUpdate={shouldBaseCurrencyUpdate} baseCurrencyDisabled={baseCurrencyDisabled} /> {/* --------- Fiscal Year ----------- */} } labelInfo={} inline={true} helperText={} fastField={true} > } popoverProps={{ minimal: true }} fastField={true} /> {/* ---------- Language ---------- */} } labelInfo={} inline={true} fastField={true} > } popoverProps={{ minimal: true }} fastField={true} /> {/* ---------- Time zone ---------- */} {({ form, field: { value }, meta: { error, touched } }) => ( } labelInfo={} inline={true} className={classNames( 'form-group--time-zone', CLASSES.FORM_GROUP_LIST_SELECT, CLASSES.FILL, )} intent={inputIntent({ error, touched })} helperText={} > { form.setFieldValue('timezone', timezone); }} valueDisplayFormat="composite" placeholder={} /> )} {/* --------- Data format ----------- */} } labelInfo={} inline={true} helperText={} fastField={true} > } popoverProps={{ minimal: true }} fastField={true} />
); } const CardFooterActions = styled.div` padding-top: 16px; border-top: 1px solid #e0e7ea; margin-top: 30px; .bp3-button { min-width: 70px; + .bp3-button { margin-left: 10px; } } `;