mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 21:30:31 +00:00
refactor(webapp): bound Formik fields
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
// @ts-nocheck
|
||||
import { FastField } from 'formik';
|
||||
import { DateInput } from '@blueprintjs/datetime';
|
||||
import { FormGroup, Position, Checkbox } from '@blueprintjs/core';
|
||||
import { Position } from '@blueprintjs/core';
|
||||
import {
|
||||
FormattedMessage as T,
|
||||
Row,
|
||||
@@ -9,13 +7,10 @@ import {
|
||||
FieldHint,
|
||||
CustomersMultiSelect,
|
||||
FFormGroup,
|
||||
FDateInput,
|
||||
FCheckbox,
|
||||
} from '@/components';
|
||||
import {
|
||||
momentFormatter,
|
||||
tansformDateValue,
|
||||
inputIntent,
|
||||
handleDateChange,
|
||||
} from '@/utils';
|
||||
import { momentFormatter } from '@/utils';
|
||||
import { filterCustomersOptions } from '../constants';
|
||||
import { useCustomersBalanceSummaryGeneralContext } from './CustomersBalanceSummaryGeneralProvider';
|
||||
import FinancialStatementsFilter from '../FinancialStatementsFilter';
|
||||
@@ -30,45 +25,40 @@ export default function CustomersBalanceSummaryGeneralPanelContent() {
|
||||
<div>
|
||||
<Row>
|
||||
<Col xs={5}>
|
||||
<FastField name={'asDate'}>
|
||||
{({ form, field: { value }, meta: { error } }) => (
|
||||
<FormGroup
|
||||
label={<T id={'as_date'} />}
|
||||
labelInfo={<FieldHint />}
|
||||
fill={true}
|
||||
intent={inputIntent({ error })}
|
||||
>
|
||||
<DateInput
|
||||
{...momentFormatter('YYYY/MM/DD')}
|
||||
value={tansformDateValue(value)}
|
||||
onChange={handleDateChange((selectedDate) => {
|
||||
form.setFieldValue('asDate', selectedDate);
|
||||
})}
|
||||
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
||||
minimal={true}
|
||||
fill={true}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
<FFormGroup
|
||||
name={'asDate'}
|
||||
label={<T id={'as_date'} />}
|
||||
labelInfo={<FieldHint />}
|
||||
fill
|
||||
fastField
|
||||
>
|
||||
<FDateInput
|
||||
name={'asDate'}
|
||||
{...momentFormatter('YYYY/MM/DD')}
|
||||
popoverProps={{ position: Position.BOTTOM, minimal: true }}
|
||||
minimal={true}
|
||||
fill={true}
|
||||
fastField
|
||||
/>
|
||||
</FFormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<Col xs={5}>
|
||||
<FastField name={'percentage_column'} type={'checkbox'}>
|
||||
{({ field }) => (
|
||||
<FormGroup labelInfo={<FieldHint />}>
|
||||
<Checkbox
|
||||
inline={true}
|
||||
name={'percentage'}
|
||||
small={true}
|
||||
label={<T id={'percentage_of_column'} />}
|
||||
{...field}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
<FFormGroup
|
||||
name={'percentage_column'}
|
||||
labelInfo={<FieldHint />}
|
||||
fastField
|
||||
>
|
||||
<FCheckbox
|
||||
name={'percentage_column'}
|
||||
inline={true}
|
||||
small={true}
|
||||
label={<T id={'percentage_of_column'} />}
|
||||
fastField
|
||||
/>
|
||||
</FFormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user