fix: accounts suggest field

This commit is contained in:
Ahmed Bouhuolia
2025-12-21 16:03:15 +02:00
parent b22328cff9
commit 31f5cbf335
22 changed files with 1189 additions and 2224 deletions

View File

@@ -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}>