WIP: Feature JournalNumber dialog / Fix: ItemCategory & EditMakeJournal & Expenses

This commit is contained in:
elforjani3
2020-10-19 19:53:10 +02:00
parent 00ba1bb75e
commit d804007596
12 changed files with 413 additions and 94 deletions

View File

@@ -164,10 +164,10 @@ function ExpenseForm({
...expense.categories.map((category) => ({
...pick(category, Object.keys(defaultCategory)),
})),
...repeatValue(
defaultCategory,
Math.max(MIN_LINES_NUMBER - expense.categories.length, 0),
),
// ...repeatValue(
// defaultCategory,
// Math.max(MIN_LINES_NUMBER - expense.categories.length, 0),
// ),
],
}
: {
@@ -226,10 +226,12 @@ function ExpenseForm({
});
return;
}
const categories = values.categories.filter(
(category) =>
category.amount && category.index && category.expense_account_id,
);
const form = {
...values,
publish: payload.publish,
@@ -329,10 +331,21 @@ function ExpenseForm({
const handleClearAllLines = () => {
formik.setFieldValue(
'categories',
orderingCategoriesIndex([...repeatValue(defaultCategory, MIN_LINES_NUMBER)]),
orderingCategoriesIndex([
...repeatValue(defaultCategory, MIN_LINES_NUMBER),
]),
);
};
const categories = formik.values.categories.filter(
(category) =>
category.amount && category.index && category.expense_account_id,
);
console.log(categories, 'V');
console.log(formik.errors, 'Error');
return (
<div className={'expense-form'}>
<form onSubmit={formik.handleSubmit}>