mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
WIP Make journal entries.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import React from 'react';
|
||||
import AccountsSelectList from 'components/AccountsSelectList';
|
||||
import classNames from 'classnames';
|
||||
import {
|
||||
FormGroup,
|
||||
Classes,
|
||||
} from '@blueprintjs/core';
|
||||
|
||||
// Account cell renderer.
|
||||
const AccountCellRenderer = ({
|
||||
row: { index, original },
|
||||
payload: { accounts }
|
||||
}) => {
|
||||
return (
|
||||
<FormGroup
|
||||
className={classNames('form-group--select-list',
|
||||
'form-group--account', Classes.FILL)}
|
||||
>
|
||||
<AccountsSelectList
|
||||
accounts={accounts}
|
||||
onAccountSelected={() => {}} />
|
||||
</FormGroup>
|
||||
);
|
||||
};
|
||||
|
||||
export default AccountCellRenderer;
|
||||
31
client/src/components/DataTableCells/InputGroupCell.js
Normal file
31
client/src/components/DataTableCells/InputGroupCell.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import React, {useState, useEffect} from 'react';
|
||||
import {
|
||||
InputGroup
|
||||
} from '@blueprintjs/core';
|
||||
|
||||
const InputEditableCell = ({
|
||||
value: initialValue,
|
||||
row: { index },
|
||||
column: { id },
|
||||
payload,
|
||||
}) => {
|
||||
const [value, setValue] = useState(initialValue)
|
||||
|
||||
const onChange = e => {
|
||||
setValue(e.target.value)
|
||||
}
|
||||
const onBlur = () => {
|
||||
payload.updateData(index, id, value)
|
||||
}
|
||||
useEffect(() => {
|
||||
setValue(initialValue)
|
||||
}, [initialValue])
|
||||
|
||||
return (<InputGroup
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
onBlur={onBlur}
|
||||
fill={true} />);
|
||||
};
|
||||
|
||||
export default InputEditableCell;
|
||||
31
client/src/components/DataTableCells/MoneyFieldCell.js
Normal file
31
client/src/components/DataTableCells/MoneyFieldCell.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import React, { useCallback, useState } from 'react';
|
||||
import MoneyInputGroup from 'components/MoneyInputGroup';
|
||||
|
||||
// Input form cell renderer.
|
||||
const MoneyFieldCellRenderer = ({
|
||||
row: { index },
|
||||
column: { id },
|
||||
cell: { value: initialValue },
|
||||
payload
|
||||
}) => {
|
||||
const [value, setValue] = useState(initialValue);
|
||||
|
||||
const handleFieldChange = useCallback((e, value) => {
|
||||
setValue(value);
|
||||
}, []);
|
||||
|
||||
const onBlur = () => {
|
||||
payload.updateData(index, id, value)
|
||||
};
|
||||
|
||||
return (<MoneyInputGroup
|
||||
value={value}
|
||||
prefix={'$'}
|
||||
onChange={handleFieldChange}
|
||||
inputGroupProps={{
|
||||
fill: true,
|
||||
onBlur,
|
||||
}} />)
|
||||
};
|
||||
|
||||
export default MoneyFieldCellRenderer;
|
||||
9
client/src/components/DataTableCells/index.js
Normal file
9
client/src/components/DataTableCells/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import AccountsListFieldCell from './AccountsListFieldCell';
|
||||
import MoneyFieldCell from './MoneyFieldCell';
|
||||
import InputGroupCell from './InputGroupCell';
|
||||
|
||||
export {
|
||||
AccountsListFieldCell,
|
||||
MoneyFieldCell,
|
||||
InputGroupCell,
|
||||
}
|
||||
Reference in New Issue
Block a user