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

@@ -6,7 +6,7 @@ import { FormGroup, Position, ControlGroup } from '@blueprintjs/core';
import classNames from 'classnames';
import {
FormattedMessage as T,
AccountsSuggestField,
FAccountsSuggestField,
InputPrependText,
FieldRequiredHint,
Col,
@@ -69,13 +69,11 @@ export default function OwnerDrawingsFormFields() {
{/*------------ 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')}
@@ -89,7 +87,7 @@ export default function OwnerDrawingsFormFields() {
}}
intent={inputIntent({ error, touched })}
/>
</FormGroup>
</FFormGroup>
)}
</FastField>
</Col>
@@ -100,7 +98,6 @@ export default function OwnerDrawingsFormFields() {
</Row>
{/*------------ Amount -----------*/}
<Row>
<Col xs={10}>
<FormGroup
@@ -122,28 +119,17 @@ export default function OwnerDrawingsFormFields() {
<Row>
<Col xs={5}>
{/*------------ equitty 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={({ id }) =>
form.setFieldValue('credit_account_id', id)
}
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}>