mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
fix: accounts suggest field
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
FormattedMessage as T,
|
||||
AccountsSuggestField,
|
||||
FAccountsSuggestField,
|
||||
InputPrependText,
|
||||
MoneyInputGroup,
|
||||
FieldRequiredHint,
|
||||
@@ -57,7 +57,7 @@ export default function OtherIncomeFormFields() {
|
||||
<FeatureCan feature={Features.Branches}>
|
||||
<Row>
|
||||
<Col xs={5}>
|
||||
<FFormGroup name={'amount'} label={<T id={'branch'} />}>
|
||||
<FFormGroup name={'branch_id'} label={<T id={'branch'} />}>
|
||||
<BranchSelect
|
||||
name={'branch_id'}
|
||||
branches={branches}
|
||||
@@ -75,13 +75,11 @@ export default function OtherIncomeFormFields() {
|
||||
{/*------------ Date -----------*/}
|
||||
<FastField name={'date'}>
|
||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
<FFormGroup
|
||||
name={'date'}
|
||||
label={<T id={'date'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name="date" />}
|
||||
minimal={true}
|
||||
className={classNames(CLASSES.FILL, 'form-group--date')}
|
||||
fill
|
||||
>
|
||||
<DateInput
|
||||
{...momentFormatter('YYYY/MM/DD')}
|
||||
@@ -95,7 +93,7 @@ export default function OtherIncomeFormFields() {
|
||||
}}
|
||||
intent={inputIntent({ error, touched })}
|
||||
/>
|
||||
</FormGroup>
|
||||
</FFormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</Col>
|
||||
@@ -128,31 +126,20 @@ export default function OtherIncomeFormFields() {
|
||||
<Row>
|
||||
<Col xs={5}>
|
||||
{/*------------ other income account -----------*/}
|
||||
<FastField name={'credit_account_id'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'cash_flow_transaction.other_income_account'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name="credit_account_id" />}
|
||||
className={'form-group--credit_account_id'}
|
||||
>
|
||||
<AccountsSuggestField
|
||||
accounts={accounts}
|
||||
onAccountSelected={({ id }) =>
|
||||
form.setFieldValue('credit_account_id', id)
|
||||
}
|
||||
filterByTypes={[
|
||||
ACCOUNT_TYPE.INCOME,
|
||||
ACCOUNT_TYPE.OTHER_INCOME,
|
||||
]}
|
||||
inputProps={{
|
||||
intent: inputIntent({ error, touched }),
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
<FFormGroup
|
||||
name={'credit_account_id'}
|
||||
label={<T id={'cash_flow_transaction.other_income_account'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
>
|
||||
<FAccountsSuggestField
|
||||
name={'credit_account_id'}
|
||||
items={accounts}
|
||||
filterByTypes={[
|
||||
ACCOUNT_TYPE.INCOME,
|
||||
ACCOUNT_TYPE.OTHER_INCOME,
|
||||
]}
|
||||
/>
|
||||
</FFormGroup>
|
||||
</Col>
|
||||
|
||||
<Col xs={5}>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import { FastField, ErrorMessage } from 'formik';
|
||||
import { FormGroup, Position, ControlGroup } from '@blueprintjs/core';
|
||||
import { Position, ControlGroup } from '@blueprintjs/core';
|
||||
import classNames from 'classnames';
|
||||
import { DateInput } from '@blueprintjs/datetime';
|
||||
import {
|
||||
FormattedMessage as T,
|
||||
AccountsSuggestField,
|
||||
FAccountsSuggestField,
|
||||
InputPrependText,
|
||||
FieldRequiredHint,
|
||||
Col,
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
BranchSelect,
|
||||
BranchSelectButton,
|
||||
FeatureCan,
|
||||
|
||||
FFormGroup,
|
||||
FMoneyInputGroup,
|
||||
FTextArea,
|
||||
@@ -70,13 +71,11 @@ export default function OwnerContributionFormFields() {
|
||||
{/*------------ Date -----------*/}
|
||||
<FastField name={'date'}>
|
||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
<FFormGroup
|
||||
name={'date'}
|
||||
label={<T id={'date'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name="date" />}
|
||||
minimal={true}
|
||||
className={classNames(CLASSES.FILL, 'form-group--date')}
|
||||
fill
|
||||
>
|
||||
<DateInput
|
||||
{...momentFormatter('YYYY/MM/DD')}
|
||||
@@ -90,7 +89,7 @@ export default function OwnerContributionFormFields() {
|
||||
}}
|
||||
intent={inputIntent({ error, touched })}
|
||||
/>
|
||||
</FormGroup>
|
||||
</FFormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</Col>
|
||||
@@ -122,29 +121,17 @@ export default function OwnerContributionFormFields() {
|
||||
<Row>
|
||||
<Col xs={5}>
|
||||
{/*------------ equity account -----------*/}
|
||||
<FastField name={'credit_account_id'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'cash_flow_transaction.label_equity_account'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name="credit_account_id" />}
|
||||
className={'form-group--credit_account_id'}
|
||||
>
|
||||
<AccountsSuggestField
|
||||
accounts={accounts}
|
||||
onAccountSelected={(account) => {
|
||||
form.setFieldValue('credit_account_id', account.id);
|
||||
form.setFieldValue('currency_code', account.currency_code);
|
||||
}}
|
||||
filterByTypes={ACCOUNT_TYPE.EQUITY}
|
||||
inputProps={{
|
||||
intent: inputIntent({ error, touched }),
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
<FFormGroup
|
||||
name={'credit_account_id'}
|
||||
label={<T id={'cash_flow_transaction.label_equity_account'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
>
|
||||
<FAccountsSuggestField
|
||||
name={'credit_account_id'}
|
||||
items={accounts}
|
||||
filterByTypes={ACCOUNT_TYPE.EQUITY}
|
||||
/>
|
||||
</FFormGroup>
|
||||
</Col>
|
||||
|
||||
<Col xs={5}>
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
// @ts-nocheck
|
||||
import React, { useMemo } from 'react';
|
||||
import { FastField, Field, ErrorMessage } from 'formik';
|
||||
import { FormGroup } from '@blueprintjs/core';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
FormattedMessage as T,
|
||||
AccountsSuggestField,
|
||||
FAccountsSuggestField,
|
||||
FieldRequiredHint,
|
||||
ListSelect,
|
||||
Col,
|
||||
Row,
|
||||
FFormGroup,
|
||||
FSelect,
|
||||
} from '@/components';
|
||||
import { inputIntent } from '@/utils';
|
||||
import { CLASSES, getAddMoneyInOptions } from '@/constants';
|
||||
|
||||
import { useMoneyInDailogContext } from './MoneyInDialogProvider';
|
||||
@@ -50,32 +46,20 @@ export default function TransactionTypeFields() {
|
||||
|
||||
<Col xs={5}>
|
||||
{/*------------ Current account -----------*/}
|
||||
<FastField name={'cashflow_account_id'}>
|
||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'cash_flow_transaction.label_current_account'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name="cashflow_account_id" />}
|
||||
minimal={true}
|
||||
className={classNames(
|
||||
CLASSES.FILL,
|
||||
'form-group--cashflow_account_id',
|
||||
)}
|
||||
>
|
||||
<AccountsSuggestField
|
||||
accounts={cashflowAccounts}
|
||||
onAccountSelected={({ id }) => {
|
||||
form.setFieldValue('cashflow_account_id', id);
|
||||
setAccountId(id);
|
||||
}}
|
||||
inputProps={{
|
||||
intent: inputIntent({ error, touched }),
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
<FFormGroup
|
||||
name={'cashflow_account_id'}
|
||||
label={<T id={'cash_flow_transaction.label_current_account'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
fill
|
||||
>
|
||||
<FAccountsSuggestField
|
||||
name={'cashflow_account_id'}
|
||||
items={cashflowAccounts}
|
||||
onItemSelect={({ id }) => {
|
||||
setAccountId(id);
|
||||
}}
|
||||
/>
|
||||
</FFormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
</div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { FormGroup, Position, ControlGroup } from '@blueprintjs/core';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
FormattedMessage as T,
|
||||
AccountsSuggestField,
|
||||
FAccountsSuggestField,
|
||||
InputPrependText,
|
||||
FieldRequiredHint,
|
||||
Col,
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
BranchSelect,
|
||||
BranchSelectButton,
|
||||
FMoneyInputGroup,
|
||||
FInputGroup,
|
||||
FFormGroup,
|
||||
FTextArea,
|
||||
} from '@/components';
|
||||
@@ -63,18 +62,17 @@ export default function TransferFromAccountFormFields() {
|
||||
</Row>
|
||||
<BranchRowDivider />
|
||||
</FeatureCan>
|
||||
|
||||
<Row>
|
||||
<Col xs={5}>
|
||||
{/*------------ Date -----------*/}
|
||||
<FastField name={'date'}>
|
||||
{({ form, field: { value }, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
<FFormGroup
|
||||
name={'date'}
|
||||
label={<T id={'date'} />}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name="date" />}
|
||||
minimal={true}
|
||||
className={classNames(CLASSES.FILL, 'form-group--date')}
|
||||
fill
|
||||
>
|
||||
<DateInput
|
||||
{...momentFormatter('YYYY/MM/DD')}
|
||||
@@ -88,7 +86,7 @@ export default function TransferFromAccountFormFields() {
|
||||
}}
|
||||
intent={inputIntent({ error, touched })}
|
||||
/>
|
||||
</FormGroup>
|
||||
</FFormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
</Col>
|
||||
@@ -118,34 +116,23 @@ export default function TransferFromAccountFormFields() {
|
||||
<Row>
|
||||
<Col xs={5}>
|
||||
{/*------------ Transfer from account -----------*/}
|
||||
<FastField name={'credit_account_id'}>
|
||||
{({ form, field, meta: { error, touched } }) => (
|
||||
<FormGroup
|
||||
label={
|
||||
<T id={'cash_flow_transaction.label_transfer_from_account'} />
|
||||
}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
intent={inputIntent({ error, touched })}
|
||||
helperText={<ErrorMessage name="credit_account_id" />}
|
||||
className={'form-group--credit_account_id'}
|
||||
>
|
||||
<AccountsSuggestField
|
||||
accounts={accounts}
|
||||
onAccountSelected={({ id }) =>
|
||||
form.setFieldValue('credit_account_id', id)
|
||||
}
|
||||
filterByTypes={[
|
||||
ACCOUNT_TYPE.CASH,
|
||||
ACCOUNT_TYPE.BANK,
|
||||
ACCOUNT_TYPE.CREDIT_CARD,
|
||||
]}
|
||||
inputProps={{
|
||||
intent: inputIntent({ error, touched }),
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
<FFormGroup
|
||||
name={'credit_account_id'}
|
||||
label={
|
||||
<T id={'cash_flow_transaction.label_transfer_from_account'} />
|
||||
}
|
||||
labelInfo={<FieldRequiredHint />}
|
||||
>
|
||||
<FAccountsSuggestField
|
||||
name={'credit_account_id'}
|
||||
items={accounts as any[]}
|
||||
filterByTypes={[
|
||||
ACCOUNT_TYPE.CASH,
|
||||
ACCOUNT_TYPE.BANK,
|
||||
ACCOUNT_TYPE.CREDIT_CARD,
|
||||
]}
|
||||
/>
|
||||
</FFormGroup>
|
||||
</Col>
|
||||
|
||||
<Col xs={5}>
|
||||
|
||||
Reference in New Issue
Block a user