WIP Make journal entries page.

This commit is contained in:
Ahmed Bouhuolia
2020-04-07 16:44:50 +02:00
parent 490979ded5
commit aed7df7931
11 changed files with 144 additions and 58 deletions

View File

@@ -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>
);
};