mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
WIP Make journal entries page.
This commit is contained in:
@@ -2,7 +2,9 @@ import React, {useMemo, useCallback, useState} from 'react';
|
||||
import {omit} from 'lodash';
|
||||
import {
|
||||
MenuItem,
|
||||
Button
|
||||
FormGroup,
|
||||
Button,
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
import {Select} from '@blueprintjs/select';
|
||||
// import MultiSelect from 'components/MultiSelect';
|
||||
@@ -10,6 +12,7 @@ import {Select} from '@blueprintjs/select';
|
||||
export default function AccountsMultiSelect({
|
||||
accounts,
|
||||
onAccountSelected,
|
||||
error,
|
||||
}) {
|
||||
const [selectedAccount, setSelectedAccount] = useState(null);
|
||||
|
||||
@@ -30,18 +33,20 @@ export default function AccountsMultiSelect({
|
||||
}, [setSelectedAccount, onAccountSelected]);
|
||||
|
||||
return (
|
||||
|
||||
<Select
|
||||
items={accounts}
|
||||
noResults={<MenuItem disabled={true} text='No results.' />}
|
||||
itemRenderer={accountItem}
|
||||
popoverProps={{ minimal: true }}
|
||||
filterable={true}
|
||||
onItemSelect={onAccountSelect}
|
||||
onItemSelect={onAccountSelect}
|
||||
>
|
||||
<Button
|
||||
rightIcon='caret-down'
|
||||
text={selectedAccount ? selectedAccount.name : 'Select account'}
|
||||
/>
|
||||
</Select>
|
||||
|
||||
);
|
||||
}
|
||||
@@ -1,24 +1,36 @@
|
||||
import React from 'react';
|
||||
import React, {useCallback} from 'react';
|
||||
import AccountsSelectList from 'components/AccountsSelectList';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
FormGroup,
|
||||
Classes,
|
||||
Intent,
|
||||
} from '@blueprintjs/core';
|
||||
|
||||
// Account cell renderer.
|
||||
const AccountCellRenderer = ({
|
||||
column: { id, value },
|
||||
row: { index, original },
|
||||
payload: { accounts }
|
||||
payload: { accounts, updateData, errors },
|
||||
}) => {
|
||||
const handleAccountSelected = useCallback((account) => {
|
||||
updateData(index, id, account.id);
|
||||
}, [updateData, index, id]);
|
||||
|
||||
const { account_id = false } = (errors[index] || {});
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
className={classNames('form-group--select-list',
|
||||
'form-group--account', Classes.FILL)}
|
||||
intent={account_id ? Intent.DANGER : ''}
|
||||
className={classNames(
|
||||
'form-group--select-list',
|
||||
'form-group--account',
|
||||
Classes.FILL)}
|
||||
>
|
||||
<AccountsSelectList
|
||||
accounts={accounts}
|
||||
onAccountSelected={() => {}} />
|
||||
onAccountSelected={handleAccountSelected}
|
||||
error={account_id} />
|
||||
</FormGroup>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ const MoneyFieldCellRenderer = ({
|
||||
}, []);
|
||||
|
||||
const onBlur = () => {
|
||||
payload.updateData(index, id, value)
|
||||
payload.updateData(index, id, parseFloat(value));
|
||||
};
|
||||
|
||||
return (<MoneyInputGroup
|
||||
|
||||
Reference in New Issue
Block a user