- feat: Filter expense and payment accounts on expense form.

- feat: Make journal errors with receivable and payable accounts.
- fix: Handle database big numbers.
- fix: Indexing lines when add a new line on make journal form.
- fix: Abstruct accounts type component.
This commit is contained in:
Ahmed Bouhuolia
2020-07-06 21:22:27 +02:00
parent 3fc390652d
commit 282da55d08
40 changed files with 1031 additions and 747 deletions

View File

@@ -1,4 +1,5 @@
import React, { useCallback, useState, useEffect } from 'react';
import { FormGroup, Intent } from '@blueprintjs/core';
import MoneyInputGroup from 'components/MoneyInputGroup';
// Input form cell renderer.
@@ -6,7 +7,7 @@ const MoneyFieldCellRenderer = ({
row: { index },
column: { id },
cell: { value: initialValue },
payload
payload: { errors, updateData },
}) => {
const [value, setValue] = useState(initialValue);
@@ -15,26 +16,36 @@ const MoneyFieldCellRenderer = ({
}, []);
function isNumeric(data) {
return !isNaN(parseFloat(data)) && isFinite(data) && data.constructor !== Array;
return (
!isNaN(parseFloat(data)) && isFinite(data) && data.constructor !== Array
);
}
const onBlur = () => {
const updateValue = isNumeric(value) ? parseFloat(value) : value;
payload.updateData(index, id, updateValue);
updateData(index, id, updateValue);
};
useEffect(() => {
setValue(initialValue);
}, [initialValue])
}, [initialValue]);
return (<MoneyInputGroup
value={value}
prefix={'$'}
onChange={handleFieldChange}
inputGroupProps={{
fill: true,
onBlur,
}} />)
const error = errors?.[index]?.[id];
return (
<FormGroup
intent={error ? Intent.DANGER : null}>
<MoneyInputGroup
value={value}
prefix={'$'}
onChange={handleFieldChange}
inputGroupProps={{
fill: true,
onBlur,
}}
/>
</FormGroup>
);
};
export default MoneyFieldCellRenderer;
export default MoneyFieldCellRenderer;