diff --git a/packages/webapp/src/components/Currencies/CurrencySelect.tsx b/packages/webapp/src/components/Currencies/CurrencySelect.tsx
index 1e47c9b9d..ecf01af05 100644
--- a/packages/webapp/src/components/Currencies/CurrencySelect.tsx
+++ b/packages/webapp/src/components/Currencies/CurrencySelect.tsx
@@ -2,7 +2,6 @@
import React from 'react';
import intl from 'react-intl-universal';
-import { MenuItem, Button } from '@blueprintjs/core';
import { FSelect } from '../Forms';
/**
@@ -28,23 +27,6 @@ const currencyItemPredicate = (query, currency, _index, exactMatch) => {
}
};
-/**
- * @param {*} currency
- * @returns
- */
-const currencyItemRenderer = (currency, { handleClick, modifiers, query }) => {
- return (
-
- );
-};
-
/**
*
* @param {*} currencies
@@ -54,20 +36,12 @@ export function CurrencySelect({ currencies, ...rest }) {
return (
);
}
-
-/**
- * @param {*} label
- * @returns
- */
-function CurrnecySelectButton({ label }) {
- return ;
-}
diff --git a/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx b/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx
index 3df48fc40..103a43b13 100644
--- a/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx
+++ b/packages/webapp/src/containers/Expenses/ExpenseForm/ExpenseFormHeaderFields.tsx
@@ -16,7 +16,8 @@ import { customersFieldShouldUpdate, accountsFieldShouldUpdate } from './utils';
import {
CurrencySelectList,
CustomerSelectField,
- AccountsSelectList,
+ FFormGroup,
+ AccountsSelect,
FieldRequiredHint,
Hint,
} from '@/components';
@@ -54,37 +55,26 @@ export default function ExpenseFormHeader() {
)}
- }
+ labelInfo={}
+ inline={true}
+ fastField={true}
shouldUpdate={accountsFieldShouldUpdate}
>
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- className={classNames(
- 'form-group--payment_account',
- 'form-group--select-list',
- Classes.FILL,
- )}
- labelInfo={}
- intent={inputIntent({ error, touched })}
- helperText={}
- inline={true}
- >
- {
- form.setFieldValue('payment_account_id', account.id);
- }}
- defaultSelectText={}
- selectedAccountId={value}
- filterByParentTypes={[ACCOUNT_PARENT_TYPE.CURRENT_ASSET]}
- allowCreate={true}
- />
-
- )}
-
+ }
+ filterByParentTypes={[ACCOUNT_PARENT_TYPE.CURRENT_ASSET]}
+ allowCreate={true}
+ fastField={true}
+ shouldUpdate={accountsFieldShouldUpdate}
+ fill={true}
+ />
+
{({ form, field: { value }, meta: { error, touched } }) => (
diff --git a/packages/webapp/src/containers/Expenses/ExpenseForm/utils.tsx b/packages/webapp/src/containers/Expenses/ExpenseForm/utils.tsx
index 905ca76f7..ff27b127b 100644
--- a/packages/webapp/src/containers/Expenses/ExpenseForm/utils.tsx
+++ b/packages/webapp/src/containers/Expenses/ExpenseForm/utils.tsx
@@ -114,7 +114,7 @@ export const customersFieldShouldUpdate = (newProps, oldProps) => {
*/
export const accountsFieldShouldUpdate = (newProps, oldProps) => {
return (
- newProps.accounts !== oldProps.accounts ||
+ newProps.items !== oldProps.items ||
defaultFastFieldShouldUpdate(newProps, oldProps)
);
};
diff --git a/packages/webapp/src/containers/Items/ItemFormBody.tsx b/packages/webapp/src/containers/Items/ItemFormBody.tsx
index 8d8230587..fd513fbf8 100644
--- a/packages/webapp/src/containers/Items/ItemFormBody.tsx
+++ b/packages/webapp/src/containers/Items/ItemFormBody.tsx
@@ -9,15 +9,15 @@ import {
ControlGroup,
} from '@blueprintjs/core';
import {
- AccountsSelectList,
+ AccountsSelect,
MoneyInputGroup,
Col,
Row,
Hint,
InputPrependText,
+ FFormGroup,
} from '@/components';
import { FormattedMessage as T } from '@/components';
-import classNames from 'classnames';
import { useItemFormContext } from './ItemFormProvider';
import withCurrentOrganization from '@/containers/Organization/withCurrentOrganization';
@@ -91,42 +91,27 @@ function ItemFormBody({ organization: { base_currency } }) {
{/*------------- Selling account ------------- */}
- }
name={'sell_account_id'}
+ labelInfo={
+ } />
+ }
+ inline={true}
+ items={accounts}
sellable={values.sellable}
- accounts={accounts}
shouldUpdate={sellAccountFieldShouldUpdate}
>
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={
- } />
- }
- inline={true}
- intent={inputIntent({ error, touched })}
- helperText={}
- className={classNames(
- 'form-group--sell-account',
- 'form-group--select-list',
- Classes.FILL,
- )}
- >
- {
- form.setFieldValue('sell_account_id', account.id);
- }}
- defaultSelectText={}
- selectedAccountId={value}
- disabled={!form.values.sellable}
- filterByParentTypes={[ACCOUNT_PARENT_TYPE.INCOME]}
- popoverFill={true}
- allowCreate={true}
- />
-
- )}
-
+ }
+ disabled={!values.sellable}
+ filterByParentTypes={[ACCOUNT_PARENT_TYPE.INCOME]}
+ fill={true}
+ allowCreate={true}
+ />
+
{/*------------- Cost account ------------- */}
- }
+ labelInfo={
+ } />
+ }
+ inline={true}
+ fastField={true}
>
- {({ form, field: { value }, meta: { error, touched } }) => (
- }
- labelInfo={
- } />
- }
- inline={true}
- intent={inputIntent({ error, touched })}
- helperText={}
- className={classNames(
- 'form-group--cost-account',
- 'form-group--select-list',
- Classes.FILL,
- )}
- >
- {
- form.setFieldValue('cost_account_id', account.id);
- }}
- defaultSelectText={}
- selectedAccountId={value}
- disabled={!form.values.purchasable}
- filterByParentTypes={[ACCOUNT_PARENT_TYPE.EXPENSE]}
- popoverFill={true}
- allowCreate={true}
- />
-
- )}
-
+ }
+ filterByParentTypes={[ACCOUNT_PARENT_TYPE.EXPENSE]}
+ popoverFill={true}
+ allowCreate={true}
+ fastField={true}
+ disabled={!values.purchasable}
+ purchasable={values.purchasable}
+ shouldUpdate={costAccountFieldShouldUpdate}
+ />
+
- {/*------------- Inventory account ------------- */}
- }
name={'inventory_account_id'}
- accounts={accounts}
+ items={accounts}
+ fastField={true}
shouldUpdate={accountsFieldShouldUpdate}
+ inline={true}
>
- {({ form, field: { value }, meta: { touched, error } }) => (
- }
- inline={true}
- intent={inputIntent({ error, touched })}
- helperText={}
- className={classNames(
- 'form-group--item-inventory_account',
- 'form-group--select-list',
- CLASSES.FILL,
- )}
- >
- {
- form.setFieldValue('inventory_account_id', account.id);
- }}
- defaultSelectText={}
- selectedAccountId={value}
- filterByTypes={[ACCOUNT_TYPE.INVENTORY]}
- />
-
- )}
-
+ }
+ filterByTypes={[ACCOUNT_TYPE.INVENTORY]}
+ fastField={true}
+ shouldUpdate={accountsFieldShouldUpdate}
+ />
+
diff --git a/packages/webapp/src/containers/Items/utils.tsx b/packages/webapp/src/containers/Items/utils.tsx
index c2694a3c3..3850cdaec 100644
--- a/packages/webapp/src/containers/Items/utils.tsx
+++ b/packages/webapp/src/containers/Items/utils.tsx
@@ -119,7 +119,7 @@ export const handleDeleteErrors = (errors) => {
*/
export const accountsFieldShouldUpdate = (newProps, oldProps) => {
return (
- newProps.accounts !== oldProps.accounts ||
+ newProps.items !== oldProps.items ||
defaultFastFieldShouldUpdate(newProps, oldProps)
);
};
@@ -149,7 +149,7 @@ export const sellPriceFieldShouldUpdate = (newProps, oldProps) => {
*/
export const sellAccountFieldShouldUpdate = (newProps, oldProps) => {
return (
- newProps.accounts !== oldProps.accounts ||
+ newProps.items !== oldProps.items ||
newProps.sellable !== oldProps.sellable ||
defaultFastFieldShouldUpdate(newProps, oldProps)
);
diff --git a/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx b/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx
index 112c82756..9be2e319d 100644
--- a/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx
+++ b/packages/webapp/src/containers/Preferences/Accountant/AccountantForm.tsx
@@ -14,12 +14,13 @@ import { useHistory } from 'react-router-dom';
import {
FormattedMessage as T,
- AccountsSelectList,
+ AccountsSelect,
FieldRequiredHint,
CardFooterActions,
+ FFormGroup,
} from '@/components';
import { handleStringChange, inputIntent } from '@/utils';
-import { ACCOUNT_TYPE } from '@/constants/accountTypes';
+import { ACCOUNT_PARENT_TYPE, ACCOUNT_TYPE } from '@/constants/accountTypes';
import { useAccountantFormContext } from './AccountantFormProvider';
@@ -28,6 +29,7 @@ import { useAccountantFormContext } from './AccountantFormProvider';
*/
export default function AccountantForm() {
const history = useHistory();
+ const { accounts } = useAccountantFormContext();
const { isSubmitting } = useFormikContext();
@@ -35,8 +37,6 @@ export default function AccountantForm() {
history.go(-1);
};
- const { accounts } = useAccountantFormContext();
-
return (