diff --git a/packages/server/src/api/controllers/FinancialStatements/BalanceSheet.ts b/packages/server/src/api/controllers/FinancialStatements/BalanceSheet.ts
index 51df3c9fa..bc9499889 100644
--- a/packages/server/src/api/controllers/FinancialStatements/BalanceSheet.ts
+++ b/packages/server/src/api/controllers/FinancialStatements/BalanceSheet.ts
@@ -41,7 +41,7 @@ export default class BalanceSheetStatementController extends BaseFinancialReport
get balanceSheetValidationSchema(): ValidationChain[] {
return [
...this.sheetNumberFormatValidationSchema,
- query('accounting_method').optional().isIn(['cash', 'accural']),
+ query('accounting_method').optional().isIn(['cash', 'accrual']),
query('from_date').optional(),
query('to_date').optional(),
diff --git a/packages/server/src/api/controllers/Organization.ts b/packages/server/src/api/controllers/Organization.ts
index 6eda6d627..c746a0484 100644
--- a/packages/server/src/api/controllers/Organization.ts
+++ b/packages/server/src/api/controllers/Organization.ts
@@ -58,7 +58,7 @@ export default class OrganizationController extends BaseController {
private get organizationValidationSchema(): ValidationChain[] {
return [
check('name').exists().trim(),
- check('industry').optional().isString(),
+ check('industry').optional({ nullable: true }).isString().trim().escape(),
check('location').exists().isString().isISO31661Alpha2(),
check('base_currency').exists().isISO4217(),
check('timezone').exists().isIn(moment.tz.names()),
diff --git a/packages/server/src/database/seeds/core/20200810121809_seed_settings.ts b/packages/server/src/database/seeds/core/20200810121809_seed_settings.ts
index 4e02409d0..534c4b584 100644
--- a/packages/server/src/database/seeds/core/20200810121809_seed_settings.ts
+++ b/packages/server/src/database/seeds/core/20200810121809_seed_settings.ts
@@ -8,7 +8,7 @@ export default class SeedSettings extends TenantSeeder {
up() {
const settings = [
// Orgnization settings.
- { group: 'organization', key: 'accounting_basis', value: 'accural' },
+ { group: 'organization', key: 'accounting_basis', value: 'accrual' },
// Accounts settings.
{ group: 'accounts', key: 'account_code_unique', value: true },
diff --git a/packages/server/src/interfaces/BalanceSheet.ts b/packages/server/src/interfaces/BalanceSheet.ts
index a175c405f..dc2fe6f0b 100644
--- a/packages/server/src/interfaces/BalanceSheet.ts
+++ b/packages/server/src/interfaces/BalanceSheet.ts
@@ -44,7 +44,7 @@ export interface IBalanceSheetQuery extends IFinancialSheetBranchesQuery {
numberFormat: INumberFormatQuery;
noneTransactions: boolean;
noneZero: boolean;
- basis: 'cash' | 'accural';
+ basis: 'cash' | 'accrual';
accountIds: number[];
percentageOfColumn: boolean;
diff --git a/packages/server/src/interfaces/TrialBalanceSheet.ts b/packages/server/src/interfaces/TrialBalanceSheet.ts
index bd6c19331..a3cc37568 100644
--- a/packages/server/src/interfaces/TrialBalanceSheet.ts
+++ b/packages/server/src/interfaces/TrialBalanceSheet.ts
@@ -4,7 +4,7 @@ export interface ITrialBalanceSheetQuery {
fromDate: Date | string;
toDate: Date | string;
numberFormat: INumberFormatQuery;
- basis: 'cash' | 'accural';
+ basis: 'cash' | 'accrual';
noneZero: boolean;
noneTransactions: boolean;
onlyActive: boolean;
diff --git a/packages/server/src/services/FinancialStatements/ProfitLossSheet/utils.ts b/packages/server/src/services/FinancialStatements/ProfitLossSheet/utils.ts
index b9a707f88..8f17be584 100644
--- a/packages/server/src/services/FinancialStatements/ProfitLossSheet/utils.ts
+++ b/packages/server/src/services/FinancialStatements/ProfitLossSheet/utils.ts
@@ -17,7 +17,7 @@ export const getDefaultPLQuery = (): IProfitLossSheetQuery => ({
formatMoney: 'total',
precision: 2,
},
- basis: 'accural',
+ basis: 'accrual',
noneZero: false,
noneTransactions: false,
diff --git a/packages/server/src/services/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetService.ts b/packages/server/src/services/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetService.ts
index bf7b9e611..e06ed6b02 100644
--- a/packages/server/src/services/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetService.ts
+++ b/packages/server/src/services/FinancialStatements/TrialBalanceSheet/TrialBalanceSheetService.ts
@@ -35,7 +35,7 @@ export default class TrialBalanceSheetService extends FinancialSheet {
formatMoney: 'total',
precision: 2,
},
- basis: 'accural',
+ basis: 'accrual',
noneZero: false,
noneTransactions: true,
onlyActive: false,
diff --git a/packages/webapp/package-lock.json b/packages/webapp/package-lock.json
index 10375684a..00b70f61c 100644
--- a/packages/webapp/package-lock.json
+++ b/packages/webapp/package-lock.json
@@ -1205,9 +1205,9 @@
}
},
"@blueprintjs-formik/core": {
- "version": "0.2.1",
- "resolved": "https://registry.npmjs.org/@blueprintjs-formik/core/-/core-0.2.1.tgz",
- "integrity": "sha512-YGJe+QorDGbkWDSUg6x69LYGN62Kgvb92Iz/voqmszVRKj4KcoPvd/7coF8Jmu+ZQE6LcwM/9ccB2i63L99ITA==",
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/@blueprintjs-formik/core/-/core-0.3.3.tgz",
+ "integrity": "sha512-ko7g54YSEcSq2K/GEpmiTG0foGLqe7DwgXGhkGxYEiHhLAUv8WvQmrFsm8e/KOW7n8mLGq0uaZVe2l8m3JTGGQ==",
"requires": {
"lodash.get": "^4.4.2",
"lodash.keyby": "^4.6.0",
@@ -7298,6 +7298,11 @@
"locate-path": "^3.0.0"
}
},
+ "flat": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz",
+ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ=="
+ },
"flat-cache": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz",
diff --git a/packages/webapp/package.json b/packages/webapp/package.json
index 1c49ec017..333d4ef9d 100644
--- a/packages/webapp/package.json
+++ b/packages/webapp/package.json
@@ -3,7 +3,7 @@
"version": "1.7.1",
"private": true,
"dependencies": {
- "@blueprintjs-formik/core": "^0.2.1",
+ "@blueprintjs-formik/core": "^0.3.3",
"@blueprintjs-formik/datetime": "^0.3.4",
"@blueprintjs-formik/select": "^0.2.3",
"@blueprintjs/core": "^3.50.2",
@@ -45,6 +45,7 @@
"deepdash": "^5.3.9",
"dependency-graph": "^0.11.0",
"fast-deep-equal": "^3.1.3",
+ "flat": "^5.0.2",
"formik": "^2.2.5",
"http-proxy-middleware": "^1.0.0",
"jest": "24.9.0",
diff --git a/packages/webapp/src/components/Forms/Select.tsx b/packages/webapp/src/components/Forms/Select.tsx
index 56faf3f3a..459912b62 100644
--- a/packages/webapp/src/components/Forms/Select.tsx
+++ b/packages/webapp/src/components/Forms/Select.tsx
@@ -46,7 +46,7 @@ const SelectButton = styled(Button)`
margin-right: 12px;
border-radius: 1px;
}
- &:not([class*='bp3-intent-']) {
+ &:not([class*='bp3-intent-']):not(.bp3-disabled) {
&,
&:hover {
background: #fff;
diff --git a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx
index fa45caa9a..491e7bffd 100644
--- a/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx
+++ b/packages/webapp/src/containers/FinancialStatements/GeneralLedger/common.tsx
@@ -30,7 +30,7 @@ export const getDefaultGeneralLedgerQuery = () => {
return {
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
toDate: moment().endOf('year').format('YYYY-MM-DD'),
- basis: 'accural',
+ basis: 'accrual',
filterByOption: 'with-transactions',
branchesIds: [],
accountsIds: [],
diff --git a/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx b/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx
index bcc9c432c..bafa46384 100644
--- a/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx
+++ b/packages/webapp/src/containers/FinancialStatements/Journal/utils.tsx
@@ -13,7 +13,7 @@ export const getDefaultJournalQuery = () => {
return {
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
toDate: moment().endOf('year').format('YYYY-MM-DD'),
- basis: 'accural',
+ basis: 'accrual',
};
};
diff --git a/packages/webapp/src/containers/FinancialStatements/RadiosAccountingBasis.tsx b/packages/webapp/src/containers/FinancialStatements/RadiosAccountingBasis.tsx
index 41ba632a3..8d221c43f 100644
--- a/packages/webapp/src/containers/FinancialStatements/RadiosAccountingBasis.tsx
+++ b/packages/webapp/src/containers/FinancialStatements/RadiosAccountingBasis.tsx
@@ -27,7 +27,7 @@ export default function RadiosAccountingBasis(props) {
{...rest}
>
-
+
)}
diff --git a/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx b/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx
index e31deb3f4..6bbec6db7 100644
--- a/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx
+++ b/packages/webapp/src/containers/FinancialStatements/TrialBalanceSheet/utils.tsx
@@ -13,7 +13,7 @@ export function getDefaultTrialBalanceQuery() {
return {
fromDate: moment().startOf('year').format('YYYY-MM-DD'),
toDate: moment().endOf('year').format('YYYY-MM-DD'),
- basis: 'accural',
+ basis: 'accrual',
filterByOption: 'with-transactions',
branchesIds: [],
};
diff --git a/packages/webapp/src/containers/Preferences/Accountant/Accountant.schema.tsx b/packages/webapp/src/containers/Preferences/Accountant/Accountant.schema.tsx
index d2aee3fbb..b52b2404e 100644
--- a/packages/webapp/src/containers/Preferences/Accountant/Accountant.schema.tsx
+++ b/packages/webapp/src/containers/Preferences/Accountant/Accountant.schema.tsx
@@ -2,12 +2,18 @@
import * as Yup from 'yup';
const Schema = Yup.object().shape({
- accounting_basis: Yup.string().required(),
- account_code_required: Yup.boolean().nullable(),
- account_code_unique: Yup.boolean().nullable(),
- withdrawal_account: Yup.number().nullable(),
- preferred_deposit_account: Yup.number().nullable(),
- preferred_advance_deposit: Yup.number().nullable(),
+ organization: Yup.object({
+ accountingBasis: Yup.string().required(),
+ }),
+ accounts: Yup.object({
+ accountCodeRequired: Yup.boolean().nullable(),
+ accountCodeUnique: Yup.boolean().nullable(),
+ }),
+ paymentReceives: Yup.object({
+ preferredDepositAccount: Yup.number().nullable(),
+ preferredAdvanceDeposit: Yup.number().nullable(),
+ withdrawalAccount: Yup.number().nullable(),
+ })
});
export const AccountantSchema = Schema;
diff --git a/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx b/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx
index 880f316f8..457f3ae5a 100644
--- a/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx
+++ b/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx
@@ -1,16 +1,9 @@
// @ts-nocheck
import React from 'react';
import intl from 'react-intl-universal';
-import { Form, FastField, useFormikContext } from 'formik';
+import { Form, useFormikContext } from 'formik';
import styled from 'styled-components';
-import {
- FormGroup,
- RadioGroup,
- Radio,
- Checkbox,
- Button,
- Intent,
-} from '@blueprintjs/core';
+import { FormGroup, Radio, Button, Intent } from '@blueprintjs/core';
import { useHistory } from 'react-router-dom';
import {
@@ -19,8 +12,9 @@ import {
FieldRequiredHint,
CardFooterActions,
FFormGroup,
+ FCheckbox,
+ FRadioGroup,
} from '@/components';
-import { handleStringChange, inputIntent } from '@/utils';
import { ACCOUNT_PARENT_TYPE, ACCOUNT_TYPE } from '@/constants/accountTypes';
import { useAccountantFormContext } from './AccountantFormProvider';
@@ -30,7 +24,6 @@ import { useAccountantFormContext } from './AccountantFormProvider';
export default function AccountantForm() {
const history = useHistory();
const { accounts } = useAccountantFormContext();
-
const { isSubmitting } = useFormikContext();
const handleCloseClick = () => {
@@ -48,78 +41,54 @@ export default function AccountantForm() {
}
className={'accounts-checkbox'}
>
- {/*------------ Account code (required) -----------*/}
-
- {({ field }) => (
-
-
- }
- name={'account_code_required'}
- {...field}
- />
-
- )}
-
+ {/*------------ Account Code (required) -----------*/}
+
+
+ }
+ name={'accounts.accountCodeRequired'}
+ />
+
- {/*------------ Account code (unique) -----------*/}
-
- {({ field }) => (
-
-
- }
- name={'account_code_unique'}
- {...field}
+ {/*------------ Account Code (unique) -----------*/}
+
+
-
- )}
-
+ }
+ name={'accounts.accountCodeUnique'}
+ />
+
- {/* ----------- Accounting basis ----------- */}
-
- {({
- form: { setFieldValue },
- field: { value },
- meta: { error, touched },
- }) => (
- }
- intent={inputIntent({ error, touched })}
- label={
-
-
-
- }
- >
- {
- setFieldValue('accounting_basis', _value);
- })}
- >
-
-
-
-
- )}
-
+ {/* ----------- Accounting Basis ----------- */}
+ }
+ label={
+
+
+
+ }
+ >
+
+
+
+
+
- {/* ----------- Deposit customer account ----------- */}
+ {/* ----------- Deposit Customer Account ----------- */}
@@ -136,7 +105,7 @@ export default function AccountantForm() {
fastField={true}
>
}
filterByTypes={[
@@ -148,9 +117,9 @@ export default function AccountantForm() {
/>
- {/* ----------- Withdrawal vendor account ----------- */}
+ {/* ----------- Withdrawal Vendor Account ----------- */}
@@ -167,7 +136,7 @@ export default function AccountantForm() {
fastField={true}
>
}
filterByTypes={[
@@ -179,9 +148,9 @@ export default function AccountantForm() {
/>
- {/* ----------- Withdrawal customer account ----------- */}
+ {/* ----------- Withdrawal Customer Account ----------- */}
@@ -198,7 +167,7 @@ export default function AccountantForm() {
fastField={true}
>
}
filterByParentTypes={[ACCOUNT_PARENT_TYPE.CURRENT_ASSET]}
diff --git a/packages/webapp/src/containers/Preferences/Accountant/AccountantFormPage.tsx b/packages/webapp/src/containers/Preferences/Accountant/AccountantFormPage.tsx
index c18692698..7b83add3c 100644
--- a/packages/webapp/src/containers/Preferences/Accountant/AccountantFormPage.tsx
+++ b/packages/webapp/src/containers/Preferences/Accountant/AccountantFormPage.tsx
@@ -1,55 +1,66 @@
// @ts-nocheck
import React, { useEffect } from 'react';
+import * as R from 'ramda';
import intl from 'react-intl-universal';
import { Formik } from 'formik';
-import { pick } from 'lodash';
import { Intent } from '@blueprintjs/core';
+import { flatten, unflatten } from 'flat';
import { AppToaster } from '@/components';
-
import withDashboardActions from '@/containers/Dashboard/withDashboardActions';
import withSettings from '@/containers/Settings/withSettings';
import AccountantForm from './AccountantForm';
import { AccountantSchema } from './Accountant.schema';
import { useAccountantFormContext } from './AccountantFormProvider';
-import { transformToOptions } from './utils';
-import { compose, transformGeneralSettings } from '@/utils';
+import { transferObjectOptionsToArray } from './utils';
+import { compose, transformToForm, transfromToSnakeCase } from '@/utils';
import '@/style/pages/Preferences/Accounting.scss';
+const defaultFormValues = flatten({
+ organization: {
+ accountingBasis: 'accrual',
+ },
+ accounts: {
+ accountCodeRequired: false,
+ accountCodeUnique: false,
+ },
+ billPayments: {
+ withdrawalAccount: '',
+ },
+ paymentReceives: {
+ preferredDepositAccount: '',
+ preferredAdvanceDeposit: '',
+ },
+});
+
// Accountant preferences.
function AccountantFormPage({
//# withDashboardActions
changePreferencesPageTitle,
// #withSettings
- organizationSettings,
- paymentReceiveSettings,
- accountsSettings,
- billPaymentSettings,
+ allSettings,
}) {
const { saveSettingMutate } = useAccountantFormContext();
- const accountantSettings = {
- ...billPaymentSettings,
- ...accountsSettings,
- ...pick(organizationSettings, ['accountingBasis']),
- ...pick(paymentReceiveSettings, ['preferredDepositAccount', 'preferredAdvanceDeposit']),
- };
-
- const initialValues = {
- ...transformGeneralSettings(accountantSettings),
- };
-
useEffect(() => {
changePreferencesPageTitle(intl.get('accountant'));
}, [changePreferencesPageTitle]);
+ const initialValues = unflatten({
+ ...defaultFormValues,
+ ...transformToForm(flatten(allSettings), defaultFormValues),
+ });
+ // Handle the form submitting.
const handleFormSubmit = (values, { setSubmitting }) => {
- const options = transformToOptions(values);
-
+ const options = R.compose(
+ transferObjectOptionsToArray,
+ transfromToSnakeCase,
+ )(values);
setSubmitting(true);
+
const onSuccess = () => {
AppToaster.show({
message: intl.get('the_accountant_preferences_has_been_saved'),
@@ -57,8 +68,7 @@ function AccountantFormPage({
});
setSubmitting(false);
};
-
- const onError = (errors) => {
+ const onError = () => {
setSubmitting(false);
};
saveSettingMutate({ options }).then(onSuccess).catch(onError);
@@ -75,18 +85,8 @@ function AccountantFormPage({
}
export default compose(
- withSettings(
- ({
- organizationSettings,
- paymentReceiveSettings,
- accountsSettings,
- billPaymentSettings,
- }) => ({
- organizationSettings,
- paymentReceiveSettings,
- accountsSettings,
- billPaymentSettings,
- }),
- ),
+ withSettings(({ allSettings }) => ({
+ allSettings,
+ })),
withDashboardActions,
)(AccountantFormPage);
diff --git a/packages/webapp/src/containers/Preferences/Accountant/AccountantFormProvider.tsx b/packages/webapp/src/containers/Preferences/Accountant/AccountantFormProvider.tsx
index 56d51a13e..c9a08f117 100644
--- a/packages/webapp/src/containers/Preferences/Accountant/AccountantFormProvider.tsx
+++ b/packages/webapp/src/containers/Preferences/Accountant/AccountantFormProvider.tsx
@@ -17,7 +17,7 @@ function AccountantFormProvider({ ...props }) {
// Fetches the accounts list.
const { isLoading: isAccountsLoading, data: accounts } = useAccounts();
- //Fetches Organization Settings.
+ // Fetches Organization Settings.
const { isLoading: isSettingsLoading } = useSettings();
// Save Organization Settings.
@@ -29,7 +29,7 @@ function AccountantFormProvider({ ...props }) {
isAccountsLoading,
saveSettingMutate,
};
-
+ // Detarmines whether if any query is loading.
const isLoading = isSettingsLoading || isAccountsLoading;
return (
diff --git a/packages/webapp/src/containers/Preferences/Accountant/utils.tsx b/packages/webapp/src/containers/Preferences/Accountant/utils.tsx
index c5fe63218..fb7313fdc 100644
--- a/packages/webapp/src/containers/Preferences/Accountant/utils.tsx
+++ b/packages/webapp/src/containers/Preferences/Accountant/utils.tsx
@@ -1,38 +1,6 @@
// @ts-nocheck
-export const transformToOptions = (option) => {
- return [
- {
- key: 'accounting_basis',
- value: option.accounting_basis,
- group: 'organization',
- },
- {
- key: 'withdrawal_account',
- value: option.withdrawal_account,
- group: 'bill_payments',
- },
- {
- key: 'preferred_deposit_account',
- value: option.preferred_deposit_account,
- group: 'payment_receives',
- },
- {
- key: 'preferred_advance_deposit',
- value: option.preferred_advance_deposit,
- group: 'payment_receives',
- },
- {
- key: 'account_code_required',
- value: option.account_code_required,
- group: 'accounts',
- },
- {
-
- key: 'account_code_unique',
- value: option.account_code_unique,
- group: 'accounts',
- },
- ];
-};
-
+export const transferObjectOptionsToArray = (input) =>
+ Object.entries(input).flatMap(([group, options]) =>
+ Object.entries(options).map(([key, value]) => ({ group, key, value })),
+ );
diff --git a/packages/webapp/src/containers/Preferences/Currencies/CurrenciesDataTable.tsx b/packages/webapp/src/containers/Preferences/Currencies/CurrenciesDataTable.tsx
index e57a52b6b..2777f8656 100644
--- a/packages/webapp/src/containers/Preferences/Currencies/CurrenciesDataTable.tsx
+++ b/packages/webapp/src/containers/Preferences/Currencies/CurrenciesDataTable.tsx
@@ -10,6 +10,7 @@ import { ActionMenuList, useCurrenciesTableColumns } from './components';
import withDialogActions from '@/containers/Dialog/withDialogActions';
import withAlertActions from '@/containers/Alert/withAlertActions';
+import styled from 'styled-components';
/**
* Currencies table.
@@ -46,7 +47,7 @@ function CurrenciesDataTable({
};
return (
-
{/* ---------- Organization name ---------- */}
-
- {({ field, meta: { error, touched } }) => (
- }
- labelInfo={}
- inline={true}
- intent={inputIntent({ error, touched })}
- className={'form-group--org-name'}
- helperText={}
- >
-
-
- )}
-
+ }
+ labelInfo={}
+ inline={true}
+ helperText={}
+ fastField={true}
+ >
+
+
{/* ---------- Industry ---------- */}
-
- {({ field, meta: { error, touched } }) => (
- }
- inline={true}
- intent={inputIntent({ error, touched })}
- helperText={}
- className={'form-group--org-industry'}
- >
-
-
- )}
-
+ }
+ inline={true}
+ fastField={true}
+ >
+
+
{/* ---------- Location ---------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- className={classNames(
- 'form-group--business-location',
- CLASSES.FILL,
- )}
- inline={true}
- helperText={}
- intent={inputIntent({ error, touched })}
- >
- {
- form.setFieldValue('location', value);
- }}
- selectedItem={value}
- selectedItemProp={'value'}
- defaultText={}
- textProp={'name'}
- popoverProps={{ minimal: true }}
- />
-
- )}
-
+ }
+ inline={true}
+ fastField={true}
+ >
+ }
+ popoverProps={{ minimal: true }}
+ fastField={true}
+ />
+
{/* ---------- Base currency ---------- */}
- }
+ labelInfo={}
+ inline={true}
+ helperText={
+
+ }
+ fastField={true}
shouldUpdate={shouldBaseCurrencyUpdate}
>
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- className={classNames('form-group--base-currency', CLASSES.FILL)}
- inline={true}
- intent={inputIntent({ error, touched })}
- helperText={
-
- }
- >
- {
- form.setFieldValue('base_currency', currency.key);
- }}
- selectedItem={value}
- selectedItemProp={'key'}
- defaultText={}
- textProp={'name'}
- labelProp={'key'}
- popoverProps={{ minimal: true }}
- disabled={baseCurrencyDisabled}
- />
-
- )}
-
+ }
+ popoverProps={{ minimal: true }}
+ disabled={baseCurrencyDisabled}
+ fastField={true}
+ shouldUpdate={shouldBaseCurrencyUpdate}
+ baseCurrencyDisabled={baseCurrencyDisabled}
+ />
+
{/* --------- Fiscal Year ----------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- className={classNames('form-group--fiscal-year', CLASSES.FILL)}
- inline={true}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- {
- form.setFieldValue('fiscal_year', option.key);
- }}
- selectedItem={value}
- selectedItemProp={'key'}
- defaultText={}
- textProp={'name'}
- popoverProps={{ minimal: true }}
- />
-
- )}
-
+ }
+ labelInfo={}
+ inline={true}
+ helperText={}
+ fastField={true}
+ >
+ }
+ popoverProps={{ minimal: true }}
+ fastField={true}
+ />
+
{/* ---------- Language ---------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- inline={true}
- className={classNames('form-group--language', CLASSES.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- }
- selectedItem={value}
- onItemSelect={(item) =>
- form.setFieldValue('language', item.value)
- }
- popoverProps={{ minimal: true }}
- />
-
- )}
-
+ }
+ labelInfo={}
+ inline={true}
+ fastField={true}
+ >
+ }
+ popoverProps={{ minimal: true }}
+ fastField={true}
+ />
+
{/* ---------- Time zone ---------- */}
@@ -222,30 +185,24 @@ export default function PreferencesGeneralForm({ isSubmitting }) {
{/* --------- Data format ----------- */}
-
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={}
- inline={true}
- className={classNames('form-group--date-format', CLASSES.FILL)}
- intent={inputIntent({ error, touched })}
- helperText={}
- >
- {
- form.setFieldValue('date_format', dateFormat.key);
- }}
- selectedItem={value}
- selectedItemProp={'key'}
- defaultText={}
- textProp={'label'}
- popoverProps={{ minimal: true }}
- />
-
- )}
-
+ }
+ labelInfo={}
+ inline={true}
+ helperText={}
+ fastField={true}
+ >
+ }
+ popoverProps={{ minimal: true }}
+ fastField={true}
+ />
+