From 9c1edace50d274d12f3711f719d50590a800504d Mon Sep 17 00:00:00 2001 From: elforjani3 Date: Tue, 1 Dec 2020 20:32:37 +0200 Subject: [PATCH] fix: newline & clear all line in ExpenseFormEntries. --- .../Accounting/MakeJournalEntriesForm.js | 2 +- .../Expenses/ExpenseFormEntriesField.js | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/client/src/containers/Accounting/MakeJournalEntriesForm.js b/client/src/containers/Accounting/MakeJournalEntriesForm.js index 6a255b78c..bcbfa7354 100644 --- a/client/src/containers/Accounting/MakeJournalEntriesForm.js +++ b/client/src/containers/Accounting/MakeJournalEntriesForm.js @@ -225,7 +225,7 @@ function MakeJournalEntriesForm({ }, [setSubmitPayload], ); - console.log(submitPayload, 'RR'); + return (
@@ -12,10 +14,19 @@ export default function ExpenseFormEntriesField({ entries={value} error={error} onChange={(entries) => { - form.setFieldValue('categories', entries) + form.setFieldValue('categories', entries); + }} + onClickAddNewRow={() => { + form.setFieldValue('categories', [...value, defaultRow]); + }} + onClickClearAllLines={() => { + form.setFieldValue( + 'categories', + orderingLinesIndexes([...repeatValue(defaultRow, linesNumber)]) + ); }} /> )} - ) -} \ No newline at end of file + ); +}