mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
BIG-55: fix customize report in inventory valuation report not working. BIG-56: fix customize report in Inventory item details report not working.
95 lines
2.9 KiB
JavaScript
95 lines
2.9 KiB
JavaScript
import React from 'react';
|
|
import { FastField, Field } from 'formik';
|
|
import { DateInput } from '@blueprintjs/datetime';
|
|
import { Classes, FormGroup, Position, Checkbox } from '@blueprintjs/core';
|
|
import { ContactsMultiSelect, FormattedMessage as T } from 'components';
|
|
import classNames from 'classnames';
|
|
import { Row, Col, FieldHint } from 'components';
|
|
import {
|
|
momentFormatter,
|
|
tansformDateValue,
|
|
inputIntent,
|
|
handleDateChange,
|
|
} from 'utils';
|
|
import { useCustomersBalanceSummaryGeneralContext } from './CustomersBalanceSummaryGeneralProvider';
|
|
|
|
/**
|
|
* Customers balance header - General panel - Content
|
|
*/
|
|
export default function CustomersBalanceSummaryGeneralPanelContent() {
|
|
const { customers } = useCustomersBalanceSummaryGeneralContext();
|
|
|
|
return (
|
|
<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>
|
|
</Col>
|
|
</Row>
|
|
|
|
<Row>
|
|
<Col xs={5}>
|
|
<FastField name={'percentage'} type={'checkbox'}>
|
|
{({ field }) => (
|
|
<FormGroup labelInfo={<FieldHint />}>
|
|
<Checkbox
|
|
inline={true}
|
|
name={'percentage'}
|
|
small={true}
|
|
label={<T id={'percentage_of_column'} />}
|
|
{...field}
|
|
/>
|
|
</FormGroup>
|
|
)}
|
|
</FastField>
|
|
</Col>
|
|
</Row>
|
|
|
|
<Row>
|
|
<Col xs={5}>
|
|
<Field name={'customersIds'}>
|
|
{({
|
|
form: { setFieldValue },
|
|
field: { value },
|
|
meta: { error, touched },
|
|
}) => (
|
|
<FormGroup
|
|
label={<T id={'Specific customers'} />}
|
|
className={classNames('form-group--select-list', Classes.FILL)}
|
|
>
|
|
<ContactsMultiSelect
|
|
onContactSelect={(contactsIds) => {
|
|
setFieldValue('customersIds', contactsIds);
|
|
}}
|
|
contacts={customers}
|
|
contactsSelected={value}
|
|
/>
|
|
</FormGroup>
|
|
)}
|
|
</Field>
|
|
</Col>
|
|
</Row>
|
|
</div>
|
|
);
|
|
}
|