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:
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;
|
||||
Reference in New Issue
Block a user