mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
Fix: Add prepend and money field group to customer & vendors
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { FormGroup, Position, Classes } from '@blueprintjs/core';
|
||||
import { FormGroup, ControlGroup, Position, Classes } from '@blueprintjs/core';
|
||||
import { DateInput } from '@blueprintjs/datetime';
|
||||
import { FastField, ErrorMessage } from 'formik';
|
||||
import { MoneyInputGroup, CurrencySelectList, Row, Col } from 'components';
|
||||
import {
|
||||
MoneyInputGroup,
|
||||
InputPrependText,
|
||||
CurrencySelectList,
|
||||
Row,
|
||||
Col,
|
||||
} from 'components';
|
||||
import { FormattedMessage as T } from 'react-intl';
|
||||
|
||||
import withCurrencies from 'containers/Currencies/withCurrencies';
|
||||
@@ -50,7 +56,12 @@ function VendorFinanicalPanelTab({
|
||||
</FastField>
|
||||
{/*------------ Opening balance -----------*/}
|
||||
<FastField name={'opening_balance'}>
|
||||
{({ field, field: { value }, meta: { error, touched } }) => (
|
||||
{({
|
||||
form: { values },
|
||||
field,
|
||||
field: { value },
|
||||
meta: { error, touched },
|
||||
}) => (
|
||||
<FormGroup
|
||||
label={<T id={'opening_balance'} />}
|
||||
className={classNames(
|
||||
@@ -60,16 +71,19 @@ function VendorFinanicalPanelTab({
|
||||
intent={inputIntent({ error, touched })}
|
||||
inline={true}
|
||||
>
|
||||
<MoneyInputGroup
|
||||
value={value}
|
||||
onChange={field.onChange}
|
||||
prefix={'$'}
|
||||
inputGroupProps={{
|
||||
fill: true,
|
||||
...field,
|
||||
}}
|
||||
disabled={vendorId}
|
||||
/>
|
||||
<ControlGroup>
|
||||
<InputPrependText text={values.currency_code } />
|
||||
<MoneyInputGroup
|
||||
value={value}
|
||||
onChange={field.onChange}
|
||||
prefix={'$'}
|
||||
inputGroupProps={{
|
||||
fill: true,
|
||||
...field,
|
||||
}}
|
||||
disabled={vendorId}
|
||||
/>
|
||||
</ControlGroup>
|
||||
</FormGroup>
|
||||
)}
|
||||
</FastField>
|
||||
|
||||
@@ -22,6 +22,7 @@ import VendorFloatingActions from './VendorFloatingActions';
|
||||
import withDashboardActions from 'containers/Dashboard/withDashboardActions';
|
||||
import withVendorDetail from './withVendorDetail';
|
||||
import withVendorActions from './withVendorActions';
|
||||
import withSettings from 'containers/Settings/withSettings';
|
||||
|
||||
import { compose, transformToForm } from 'utils';
|
||||
|
||||
@@ -73,6 +74,9 @@ function VendorForm({
|
||||
requestSubmitVendor,
|
||||
requestEditVendor,
|
||||
|
||||
// #withSettings
|
||||
baseCurrency,
|
||||
|
||||
// #OwnProps
|
||||
vendorId,
|
||||
}) {
|
||||
@@ -88,6 +92,7 @@ function VendorForm({
|
||||
const initialValues = useMemo(
|
||||
() => ({
|
||||
...defaultInitialValues,
|
||||
currency_code: baseCurrency,
|
||||
...transformToForm(vendor, defaultInitialValues),
|
||||
}),
|
||||
[defaultInitialValues],
|
||||
@@ -181,5 +186,8 @@ function VendorForm({
|
||||
export default compose(
|
||||
withVendorDetail(),
|
||||
withDashboardActions,
|
||||
withSettings(({ organizationSettings }) => ({
|
||||
baseCurrency: organizationSettings?.baseCurrency,
|
||||
})),
|
||||
withVendorActions,
|
||||
)(VendorForm);
|
||||
|
||||
Reference in New Issue
Block a user